How to convert polydata vtk file to structured grid vtk file

Hello,

Here is a little update to this post:

I was also looking for a “polydata to unstructered grid conversion” but I wanted to do it inside a Python-based programmable filter. The “Clean to Grid” filter uses the “vtkmCleanGrid” class but it is actually difficult to find an example of how to implement it in a python programmable filter. So, here is the example (works fine in ParaView 5.10.0):

import vtk
input = self.GetInputDataObject(0, 0)

clean = vtk.vtkmCleanGrid()
clean.SetInputData(input)
clean.Update()
self.GetOutput().ShallowCopy(clean.GetOutput())

Note: VTK-m does not currently support mixed cell types or triangle strips in vtkPolyData.

1 Like