[Paraview] Convert file types with python

pat marion pat.marion at kitware.com
Sat Apr 25 14:03:22 EDT 2009


> 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


More information about the ParaView mailing list