[vtkusers] How to transform an unstructured grid

Marco Nawijn nawijn at gmail.com
Wed Sep 7 16:24:29 EDT 2011


Dear All,

I have been struggling a while now on how to transform (e.g. translate
in X-direction) a complete unstructured grid. I have the following (in
Python):

        # Create the transformation
        t = vtkTransform()
        t.Translate(-dx, -dy, 0.0)

        # Apply the transformation to the grid
        tf = vtkTransformFilter()
        tf.SetInput(grid)    # Grid is of type vtkUnstructuredGrid()
        tf.SetTransform(t)
        tf.Update()

        grid.Modified()

The code runs fine, but  when looking at output of grid.GetBounds()
nothing has happened. Obviously I don't fully understand how
transformations work in VTK. What I see consistently in the
documentation is (from one of the examples):
    tf = vtkTransformFilter()
    tf.SetInputConnection(<some source object>.GetOutputPort())

However an UnstructuredGrid object does not have the GetOutputPort() method.

Thanks in advance for any help.

Marco



More information about the vtkusers mailing list