[vtkusers] How to save/restore viewpoint/camera from python - no pickler support

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Wed Mar 3 09:52:47 EST 2004


>>>>> "MA" == Mark Asbach <mark.asbach at post.rwth-aachen.de> writes:

[...]
    MA> It would be fine, if I could somehow read out at least the
    MA> viewpoint / camera position with a python command and restore
    MA> it later. The standard way of using the module pickle doesn't
    MA> work because vtkWrapPython does nothing to provide
    MA> __setstate__() and __reduce__() methods.

[...]
    MA> I'm a bit stuck now and would welcome any hints.

Look at MayaVi's vtkPipeline package (http://mayavi.sf.net).  Its 100%
pure Python, and trivial to save/reload most VTK objects using it.  It
works fine with the camera too.  For example:

 from vtkPipeline import vtkMethodParser
 p = vtkMethodParser.VtkPickler()
 p.dump(some_vtk_obj, file_obj_or_a_dict)
 # ...
 p.load(some_vtk_obj, file_obj_or_a_dict)

cheers,
prabhu



More information about the vtkusers mailing list