Group / Select multiple cells as a single cell VTK_UNSTRUCTURED_GRID


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:

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 …).

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?


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 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 holding the cell data.

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

1 Like

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.


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?

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

Thank you very much @Kenneth_Moreland