# How to manage several polydata at the same time

**URL:** https://discourse.vtk.org/t/how-to-manage-several-polydata-at-the-same-time/6761
**Category:** Support
**Created:** [October 4, 2021, 3:28pm UTC](https://discourse.vtk.org/t/how-to-manage-several-polydata-at-the-same-time/6761 "2021-10-04T15:28:52Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Texas](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@Texas](https://discourse.vtk.org/u/Texas)
#### Post date: [October 4, 2021, 3:28pm UTC](https://discourse.vtk.org/t/how-to-manage-several-polydata-at-the-same-time/6761/1 "2021-10-04T15:28:52Z")

</div>

Hello,  
I have a mesh named my\_initial\_mesh with, let say for the example 6 cells named [0 1 2 3 4 5]

I would like to delete 2 cells and plot the results of both at the same time  
so i do :  
my\_troncated\_mesh=my\_mesh  
my\_troncated\_mesh.DeleteCell(2)  
my\_troncated\_mesh.DeleteCell(3)  
my\_troncated\_mesh.RemoveDeletedCells()

and then, when i plot my\_troncated\_mesh i have exactly what i want, both cell 2 and cell 3 have been deleted

my problem : when i plot or print my\_initial\_mesh, those 2 cells are also deleted on that mesh… I would like to have my\_initial\_mesh with the 6 cells and my\_troncated\_mesh with 4 cells.

But those polydata seems liked and i do not understand why. And i think i concidare my mesh as kind of array. if write  
a=[1, 2 ,3 ,4 ,5]  
b=a  
b.pop(2)  
if I print a, i have “[1, 2 ,3 ,4 ,5]” and if i print b i have “[1, 2 ,4 ,5]”,  
a and b are not linked

Thanks in advance for any help or any tips

---

<div class="post-metadata">

### Author: ![codeling](https://discourse.vtk.org/user_avatar/discourse.vtk.org/codeling/32/3792_2.png) [@codeling](https://discourse.vtk.org/u/codeling)
#### Post date: [October 4, 2021, 5:10pm UTC](https://discourse.vtk.org/t/how-to-manage-several-polydata-at-the-same-time/6761/2 "2021-10-04T17:10:37Z")

</div>

I suppose you need to do a `DeepCopy` to get an actual copy - something like

```
my_troncated_mesh=vtkPolyData()
my_troncated_mesh.DeepCopy(my_mesh)

```

I don’t really know VTK’s python interface, what I show here is just cobbled together from examples I found, hope you get the gist.  
At least under C++, without a DeepCopy, the internal data structures are all reused (that is, shared between the original and the copy - which would explain the behavior you see with the cells also being deleted in the original mesh).
