[vtkusers] vtkPolyDataWriter in vtkpython

David E DeMarle dave.demarle at kitware.com
Thu May 14 07:11:11 EDT 2009


congrats!

In the first program, did you forget to change the writer's input from
the cone to the output of the transform filter? VTK filter's never
modify their inputs directly.

I think in the second program that the append filter is superfluous,
unless you want both original and transformed data together for your
work.

David E DeMarle
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x109



On Wed, May 13, 2009 at 8:20 PM, Olumide <50295 at web.de> wrote:
> 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()
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list