4 Aug 17:13
Re: Modify surf output (axes, scaling)
From: Gael Varoquaux <gael.varoquaux@...>
Subject: Re: Modify surf output (axes, scaling)
Newsgroups: gmane.comp.python.enthought.devel
Date: 2008-08-04 15:13:58 GMT
Subject: Re: Modify surf output (axes, scaling)
Newsgroups: gmane.comp.python.enthought.devel
Date: 2008-08-04 15:13:58 GMT
On Mon, Aug 04, 2008 at 04:52:40PM +0200, Thomas Königstein wrote: > About the original topic: how do I apply the filter via shell? > enthought.mayavi.filters.poly_data_normals.Instance(s) seems to create an > instance of the filter, but it dooesn't show up in the scene explorer. What is your version of mayavi? With recent-enough versions of mayavi, you can do this: out = mlab.pipeline.polydatanormals(src) where src is the object you want to apply your filter on, and out the output of the filter. Note that in mayavi2, version 3.0, that we are going to release next week, this has changed to pipeline.poly_data_normals Now you will have to build the pipeline yourself if you want control on it. The surf command boils down to: P = mlab.pipeline src = P.array2dsource(z) w = P.warpscalar(src) s = P.suface(w) Each of these steps take keyword arguments to control their properties, you can have a look at there docstring to find these out. Alternatively, if you have a really old version of mayavi, you can add retrieve the adding functions manually: from enthought.mayavi.tools.sources import array2dsource from enthought.mayavi.tools.filters import warpscalar from enthought.mayavi.tools.modules import surface Now in your oldish version of mayavi, you don't have PolyDataNormals accessible in that way, so you have do to it the manual way: from enthought.mayavi.filters.poly_data_normals import PolyDataNormals p = PolyDataNormals() w.add_filter(p) and then you can do s = P.surface(p). As you can see this is a part of mlab that got a fair amount of work lately. This is alos the reason why it wasn't documented. I have only become happy with the implementation this coming release. > And on another note: Can I somehow change the behavior of the camera/mouse > interaction? I'd like the system to rorate only about two axes, the > vertical and the horizontal one. In other words, the axis which is > separately activated when I press ctrl should be disabled when moving the > viewport with the mouse normally. Is that possible? I don't know. Prabhu may know. > Also, how can I move a glyph-plot relative to the origin of the scene (for > example, from enthought.mayavi.mlab import quiver3d;from numpy import > array;quiver3d(*array(range(6))) )? Moving surf-plots works by choosig > Array2DSource->Data->Origin. Is there a equivalent way to do this via > shell or explorer for a quiver3d plot? Are you looking for the extent keyword argument? I am not too sure what you want to do, here. HTH, Gaël
_______________________________________________ Enthought-dev mailing list Enthought-dev@... https://mail.enthought.com/mailman/listinfo/enthought-dev
RSS Feed