Gael Varoquaux | 23 Jul 09:45
Favicon

Re: show mesh in mayavi2, segfault

On Mon, Jul 21, 2008 at 01:49:56PM +0200, Ondrej Certik wrote:
> On Mon, Jul 21, 2008 at 11:33 AM, fred <fredmfp@...> wrote:
> > Ondrej Certik a écrit :

> >> It only shows a white rectangle, for me. I would like to see the
> >> actual mesh. If you do "paraview --data=mesh.vtk", click apply and
> >> then set Display->Style->Representation->    Surface With Edges   (it
> >> is a popup on the toolbar), it shows the mesh. 10x10 in this case.

> > Ondrej,

> > 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?

Actually, when I want to display cool meshes, I use something like

In [1]: from enthought.mayavi import mlab

# Somecode to create a mesh, it could really be anything.    
In [2]: from numpy import mgrid, random

In [3]: x, y = mgrid[0:5, 0:5]

In [4]: z = random.random(x.shape)

In [5]: m = mlab.mesh(x, y, z, opacity=0.4)

In [6]: e = mlab.pipeline.extract_edges(m)

In [7]: t = mlab.pipeline.tube(e, tube_radius=0.1)

In [8]: s = mlab.pipeline.surface(t, color=(0, 0, 0))

Enjoy :). VTK is really cool, and I am starting to think that we are
getting a nice API over it that allows to do very powerfull things in an
easy way.

In older versions of mayavi, extract_edges might be called extraedges,
but this was in violation of the ETS coding standards, and was harder to
read. We fixed that in Mayavi 3.0a.

Gaël

PS: Prabhu, s.remove() makes really controling the pipeline from the
command line a real pleasure, eg when you make a mistake. Thanks for
adding this.

Gmane