[vtkusers] vtkPolyDataWriter in vtkpython
Olumide
50295 at web.de
Wed May 13 20:20:53 EDT 2009
Olumide wrote:
>> Apply a vtkTransform filter.
>
> Thanks. I have (see my attempt below -- the transform has no noticeable
> effect). I do not wish to visualize the data. Rather, my intention is to
> have the script write a VTK file.
Got it. Here's how I did it, please correct any superfluous steps:
#!/usr/bin/env python
import vtk
cone = vtk.vtkConeSource()
cone.SetHeight( 3.0 )
cone.SetRadius( 1.0 )
cone.SetResolution( 10 )
transform = vtk.vtkTransform()
transform.Translate(8, 8, 8)
transform.Scale(1, 2, 5)
transform.RotateY(45)
tpd1 = vtk.vtkTransformPolyDataFilter()
tpd1.SetInputConnection(cone.GetOutputPort())
tpd1.SetTransform(transform)
appendF = vtk.vtkAppendPolyData()
appendF.AddInput(tpd1.GetOutput())
appendF.AddInput(cone.GetOutput())
#Write in file
w = vtk.vtkPolyDataWriter()
#w.SetInput(tpd1.GetOutput())
w.SetInput(appendF .GetOutput())
w.SetFileName("junk.vtk")
w.Write()
More information about the vtkusers
mailing list