# Group / Select multiple cells as a single cell VTK\_UNSTRUCTURED\_GRID

**URL:** https://discourse.paraview.org/t/group-select-multiple-cells-as-a-single-cell-vtk-unstructured-grid/13047
**Category:** ParaView Support
**Tags:** python, vtk
**Created:** [October 16, 2023, 9:58am UTC](https://discourse.paraview.org/t/group-select-multiple-cells-as-a-single-cell-vtk-unstructured-grid/13047 "2023-10-16T09:58:15Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![anshakeel](https://discourse.paraview.org/user_avatar/discourse.paraview.org/anshakeel/32/10709_2.png) [@anshakeel](https://discourse.paraview.org/u/anshakeel)
#### Post date: [October 16, 2023, 9:58am UTC](https://discourse.paraview.org/t/group-select-multiple-cells-as-a-single-cell-vtk-unstructured-grid/13047/1 "2023-10-16T09:58:15Z")

</div>

Hello,

Is there any way to **group all the cells** of a source as a **single cell** and use it in **VtkUnstructuredGrid**? I’m more focused on Non-linear shapes like curved cylinders and straight cylinders. I have tried to explain what I’m trying to achieve in the image below:

 ![image](https://discourse.paraview.org/uploads/default/original/2X/e/e8cfcfa9ee5003666ef4b892ef4eba9b9b951c0a.png)

I attempted to _fake it_ using VTK\_POLYHEDRON to simulate a cylinder as a single cell (I knew that it was an ineffective approach). Although this allowed me to select the cylinder, it gave me an error when I applied a clip filter on it ( The polyhedron is not watertight or non-manifold …).

 ![image](https://discourse.paraview.org/uploads/default/original/2X/3/382c5e6ddd6f2e7c6745f8dd77c57bb78c170b7d.png)

**What’s the most effective approach to solve this problem?**  
Also, I have some curved shapes like curved cylinders and bends. How can I group or select them as a single cell?

Regards,  
Ans

---

<div class="post-metadata">

### Author: ![Kenneth\_Moreland](https://discourse.paraview.org/user_avatar/discourse.paraview.org/kenneth_moreland/32/15033_2.png) [@Kenneth\_Moreland](https://discourse.paraview.org/u/Kenneth_Moreland)
#### Post date: [October 16, 2023, 12:07pm UTC](https://discourse.paraview.org/t/group-select-multiple-cells-as-a-single-cell-vtk-unstructured-grid/13047/2 "2023-10-16T12:07:07Z")

</div>

This type of behavior is usually accomplished by creating a cell field of an integer type (usually `vtkIdType`) that has a unique ID for each group of cells you want to treat as a single identity. VTK will still treat the cells as independent (e.g. a brush selection will still select the cells independently), but you can easily select the cell group using `Find Data` ![image](https://discourse.paraview.org/uploads/default/original/2X/6/696b6cc61aa6f8b565168c75eed0c24f4d1efece.png) or just with the `Threshold` filter. A cell field like this that identifies logical groups of cells is called its _pedigree_ ids, and the pedigree ids can be set in the [vtkDataSetAttributes](https://vtk.org/doc/nightly/html/classvtkDataSetAttributes.html) holding the cell data.

In your case, you might be able to represent your cylinder as a single triangle strip cell.

---

<div class="post-metadata">

### Author: ![anshakeel](https://discourse.paraview.org/user_avatar/discourse.paraview.org/anshakeel/32/10709_2.png) [@anshakeel](https://discourse.paraview.org/u/anshakeel)
#### Post date: [October 16, 2023, 12:30pm UTC](https://discourse.paraview.org/t/group-select-multiple-cells-as-a-single-cell-vtk-unstructured-grid/13047/3 "2023-10-16T12:30:52Z")

</div>

Thank you @Kenneth_Moreland for your response.  
Actually I’m writing a plugin which converts opengl data to VTK. So basically I have only point coordinates like Node A and B of a cylinder with Point Data like displacements, forces etc.

So, what i want is basically directly converting that **Opengl cylinder** to **a single cell VTK cylinder source**. Is it possible to group or select multiple cells as a single cell on implementation level like while creating cells ? Like use of some non linear types of cells to achieve the same results?

Please refer to any example or dataset that would be to helpful related to the above problem.

Regards,  
Ans

---

<div class="post-metadata">

### Author: ![Kenneth\_Moreland](https://discourse.paraview.org/user_avatar/discourse.paraview.org/kenneth_moreland/32/15033_2.png) [@Kenneth\_Moreland](https://discourse.paraview.org/u/Kenneth_Moreland)
#### Post date: [October 16, 2023, 1:14pm UTC](https://discourse.paraview.org/t/group-select-multiple-cells-as-a-single-cell-vtk-unstructured-grid/13047/4 "2023-10-16T13:14:37Z")

</div>

VTK does not have a “cylinder” type of cell. If you want a representation of a hollow representation of cylinder, why not create a single triangle strip cell? In case I wasn’t clear before, VTK does have a triangle strip cell type that treats all the triangles in the strip as a single cell. The diagram you started with literally draws the cylinder as a triangle strip. Why not use the triangle strip as a single cell representation of a cylinder?

---

<div class="post-metadata">

### Author: ![anshakeel](https://discourse.paraview.org/user_avatar/discourse.paraview.org/anshakeel/32/10709_2.png) [@anshakeel](https://discourse.paraview.org/u/anshakeel)
#### Post date: [October 16, 2023, 5:55pm UTC](https://discourse.paraview.org/t/group-select-multiple-cells-as-a-single-cell-vtk-unstructured-grid/13047/5 "2023-10-16T17:55:27Z")

</div>

Ahaa, I never thought about this approach. Yet, it is the simplest and finest approach to the problem.  
**Results:**

 ![image](https://discourse.paraview.org/uploads/default/original/2X/7/7a5b7fdd166e572cb0169e4701a06abdd18ff58d.png)

Thank you very much @Kenneth_Moreland
