[vtkusers] STL and vtkPolyData in Python

David Gobbi david.gobbi at gmail.com
Tue Dec 16 18:19:03 EST 2014

Hi Ricardo,

The code you sent in your email should work fine if "trianglePolyData" is a
So my best guess is that it isn't a vtkPolyData.

Try this:

  print trianglePolyData.GetClassName()

 - David

On Tue, Dec 16, 2014 at 4:08 PM, Ricardo Santos <
ricardo.c.r.santos at gmail.com> wrote:
> Hello everyone!
>       I am having a little bit of a hard time trying to save a vtkPolyData
> to a stl file using Python. My main problem is that vtkSTLWriter needs a
> input that I can't find in vtkPolyData.
>       The relevant code is as follows:
> stlWriter = vtk.vtkSTLWriter()
> stlWriter.SetFileName("test.stl")
> stlWriter.SetInput(trianglePolyData) //also used
> stlWriter.SetInputPort(trianglePolyData) and it has not worked
> stlWriter.Write()
>      Does anyone know how I could save the STL file?
> Ricardo Santos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141216/0f2feaa6/attachment.html>

More information about the vtkusers mailing list