Prabhu Ramachandran | 21 Jul 14:50
Picon

Re: show mesh in mayavi2, segfault

Ondrej Certik wrote:
>> Double-click on Surface module in the tree, then in Property,
>> select Representation: wireframe.
>>
>> It does what you want.
> 
> Yes! Thanks a lot, that's exactly what I wanted. Is there a way to see
> the Representation popup in the mayavi2 window directly, without
> having to call double click on the Surface module?

It should!  There should be a pane for mayavi object editor below the 
tree view that allows you to set the objects properties.  Don't you get 
that?  I'll admit that the UI For that can be a bit painful with funky 
scrollbars etc. but the pane should be there below the tree view. 
single clicking on a node should bring up the UI for that node there.

> Yes, it does exactly what I wanted. Thanks again. Is there a way to
> script mayavi from ipython? If I do the following, it breaks:
> 
> In [1]: from enthought.mayavi.scripts import mayavi2
> 
> In [2]: mayavi2.standalone(globals())

*NEVER* use that standalone line.  As the comment on the example states, 
this is only a hack to allow users to run the script as python script.py.

Fred has the right idea for scripting but even easier might be the mlab 
interface like this:

$ ipython -wthread

In [1]: from enthought.mayavi import mlab
In [2]: mlab.figure()
In [3]: mlab.show_engine()
In [4]: e = mlab.get_engine()

With trunk you could do this:

e.open('mesh.vtk')

but with 2.2.0 you will have to do as Fred says,

from enthought.mayavi.sources.api import VTKFileReader
r = VTKFileReader()
r.initialize('mesh.vtk')
e.add_source(r)
from enthought.mayavi.modules.api import Surface
s = Surface()
e.add_module(s)
s.actor.property.representation = 'w'

and so on.

With trunk you can right click on the source, add new objects or click 
on the adder nodes etc. but with 2.2.0 this would again need explicit 
scripting.

cheers,
prabhu

Gmane