Search code examples
pythonvisualizationvtkpoints

Convert Points Datatype of vtkUnstructuredGrid


I have an unstructured grid where the points are given as doubles. I'd like to convert them to floats. What's the easiest way to do this? So far I've been resorting to the hacky method of writing the grid to a legacy vtk ascii file and simply exchanging double for float in the header...


Solution

  • You could just recreate a dataset manually, or use a vtkArrayCalculator Filter for this task, with the following parameters :

    • Coordinate Results : ON
    • Function : "coords"
    • Result Array Type : Float

    If you used ParaView, it would look like this :

    enter image description here