On Fri, Apr 16, 2010 at 05:48:15PM +0200, Luca Penasa wrote:
> Im trying out mayavi and related python modules for creating a little
> gui for visualizing a vtkUnstructuredGrid object.
> My code is similar (couse i started from from that...) to the one
> presented into this example:
> http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/auto/example_mlab_interactive_dialog.html#example-mlab-interactive-dialog
> BUT i visualize a vtkobject loaded from a .vtk file in this way:
> vtksource = tvtk.UnstructuredGrid(vtkUnstructuredGrid)
> source = VTKDataSource(data = vtksource)
> after loading the file i create all i need for visualizing, like in the
> example cited above, in this way:
> HasTraits.scene.engine.add_source(source)
> from enthought.mayavi.modules.surface import Surface
> surface = Surface()
> HasTraits.scene.engine.add_filter(surface)
> at the end i call configure_traits() for show the window
> ---> is this the best way to insert a vtkUnstructuredGrid into a scene?
If you start from a file, you can simply do:
source = mlab.pipeline.open('file.vtk')
> ---> code i have yet writed make some changes on the vtkUnstructuredGrid
> object using the vtk functionalities (rotating, translating and other
> similar stuff...) and i would like that everytime i make changes on my
> vtk-object the visualization update itself in agree with my changes.
> how can i get this?? Is not there something
> like ...engine.update_source() or ...engine.set_source(UpdatedSource) or
> change_source(UpdatedSource). Is there a way to force a re-read of the
> source, leaving untouched the filters pipeline??
I believe that
source.reader.modified()
source.update()
should do the trick, if not please ping me.
HTH,
Gaƫl
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
MayaVi-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mayavi-users