[Paraview] Convert file types with python

David Doria daviddoria at gmail.com
Sat Apr 25 14:19:34 EDT 2009


On Sat, Apr 25, 2009 at 2:03 PM, pat marion <pat.marion at kitware.com> wrote:

> > The only remaining question is why is there no obj support?
> >
> > Thanks,
> >
> > David
>
> There is the vtkOBJReader.  It's not in paraview, but you can access
> it from the vtk.io module bundled with paraview.
>
> import paraview.vtk.io as vtkio
>
> # for pv 3.4, use instead: import vtkIOPython as vtkio
> #     or on posix, import libvtkIOPython as vtkio
>
> r = vtkio.vtkOBJReader()
> w = vtkio.vtkXMLPolyDataWriter()
> r.SetFileName("/home/pat/porsche.obj")
> w.SetFileName("/home/pat/porsche.vtp")
> w.SetInput(r.GetOutput())
> w.Write()
>
>
> The above code is purely in the vtk world, so you can't mix it with
> things from servermanager, and you can't do things like
> Reader(FileName=foo)
>
> Pat
>

Thanks for the reading obj example, Pat. I looked at dir(vtkio) after
importing it, and it looks like there is an ObjReader, but not an ObjWriter
(makes sense, because I've been wondering the same thing about the missing
objwriter in c++ vtk). How do people generally write obj files from
polydata's?

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20090425/b93e6f78/attachment.htm>


More information about the ParaView mailing list