On Sun, Feb 20, 2011 at 01:33:25PM +0000, Michele Mattioni wrote:
> > The 'surf' object that you created. Pass it after adding the scalars, at
> > the end of your script.

> If I add the surf as the last line of the script I get a Segmentation Fault.

Yes, same thing here. I recently coded a bit with VTK outside of Mayavi
and it's crazy how the thing likes to segfault. Each time it segault it's 
because the user did something not right according to its rules, but it
doesn't pardon anything. Unfortunately this behavior leaks a bit through
Mayavi.

> Maybe there is a way to add the scalars to the surf, but I really
> didn't find it.

You were almost there. If I change a bit the last lines of your script to
the following it works (don't know why I have to specify the vmin and
vmax explicitely):

figure = mlab.figure(1, size=(500, 500))
mlab.clf()

voltage = np.linspace(-90, 60, num=20)
surf = mlab.pipeline.surface(combination, vmin=voltage.min(),
                                          vmax=voltage.max())
# Scalars
combination.point_data.scalars = np.repeat(voltage, 24) # 24 points per
cylinder
combination.point_data.scalars.name = 'Voltage'

# Selector and Picker
cyl_sel = CylSelector()
cyl_sel.picker = figure.on_mouse_pick(cyl_sel.picker_callback,
type='cell')

mlab.scalarbar(surf)


------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
MayaVi-users mailing list
MayaVi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users

Reply via email to