# How to delete a cell from vtk unstructuredGrid

**URL:** https://discourse.vtk.org/t/how-to-delete-a-cell-from-vtk-unstructuredgrid/12627
**Category:** Support
**Tags:** code
**Created:** [November 6, 2023, 10:58pm UTC](https://discourse.vtk.org/t/how-to-delete-a-cell-from-vtk-unstructuredgrid/12627 "2023-11-06T22:58:22Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Fran\_Wang](https://discourse.vtk.org/user_avatar/discourse.vtk.org/fran_wang/32/7931_2.png) [@Fran\_Wang](https://discourse.vtk.org/u/Fran_Wang)
#### Post date: [November 6, 2023, 10:58pm UTC](https://discourse.vtk.org/t/how-to-delete-a-cell-from-vtk-unstructuredgrid/12627/1 "2023-11-06T22:58:22Z")

</div>

Hello,

I have a vtkUnstructuredGrid, and what I’d like to do is delete some old cells and then add some new cells to it. But I haven’t found any way to do that.

1. My current plan is to use vtkPolydata instead of vtkUnstructuredGrid because I know how to delete cells from vtkPolyData([https://examples.vtk.org/site/Cxx/PolyData/DeleteCells/#:~:text=This%20example%20demonstrates%20how%20to,suitable%20for%20efficient%20delete%20operations.](https://examples.vtk.org/site/Cxx/PolyData/DeleteCells/#:~:text=This%20example%20demonstrates%20how%20to,suitable%20for%20efficient%20delete%20operations.))

2. My second thought is to do this operation on vtkCellArray, but I found no way.

Thank you!

---

<div class="post-metadata">

### Author: ![rexthor](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rexthor/32/6481_2.png) [@rexthor](https://discourse.vtk.org/u/rexthor)
#### Post date: [November 7, 2023, 4:40pm UTC](https://discourse.vtk.org/t/how-to-delete-a-cell-from-vtk-unstructuredgrid/12627/2 "2023-11-07T16:40:21Z")

</div>

Perhaps relevant are [this link](https://discourse.vtk.org/t/delete-modify-a-cell-in-a-unstructuredgrid/6772) and [this link](https://discourse.vtk.org/t/can-i-avoid-adding-duplicate-cells-to-a-vtkpolydata/12483/2). I never found an _elegant_ way … and I’d like to see if there is one.

---

<div class="post-metadata">

### Author: ![Fran\_Wang](https://discourse.vtk.org/user_avatar/discourse.vtk.org/fran_wang/32/7931_2.png) [@Fran\_Wang](https://discourse.vtk.org/u/Fran_Wang)
#### Post date: [November 7, 2023, 7:40pm UTC](https://discourse.vtk.org/t/how-to-delete-a-cell-from-vtk-unstructuredgrid/12627/3 "2023-11-07T19:40:40Z")

</div>

Thank you! I will try those out too
