On Sat, Apr 17, 2010 at 01:05:49PM +0200, Luca Penasa wrote:
>  > 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')

>    I think this is not my case becouse i want to visualize/modify a
>    vtkUnstructuredGrid object that other scripts loaded for me.

OK, then the code that you showed seems good to me. Maybe it would be
sightly nicer to call the 'to_tvtk' function on the vtk object, rather
the tvtk.UnstructuredGrid contrusctor, using the following:

from enthought.tvtk.api import tvtk
vtksource = tvtk.to_vtk(vtkUnstructuredGrid)

>    I have tried calling update() on my VTKDataSource() object but maybe this
>    only update the content of the VTKDataSource() object and not what is
>    rendered into my window. How could i force a re-rendering?

I believe that you need to call the '.modified()' method of the vtksource
object before calling the 'update' method on the VTKDataSource.

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

Reply via email to