Announcement

Collapse
No announcement yet.

SORT OF SOLVED: MayaVi and Xfree error...Any suggestions?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    SORT OF SOLVED: MayaVi and Xfree error...Any suggestions?

    Hello all:

    I have been trying to run a MayaVi example from Python:

    http://mayavi.sourceforge.net/docs/guide/ch04.html

    and the script I use is:
    Code:
    # generate the data.
    from scipy import *
    #import scipy
    x = (arange(50.0)-25)/2.0
    y = (arange(50.0)-25)/2.0
    r = sqrt(x[:,newaxis]**2+y**2)
    z = 5.0*special.j0(r) # Bessel function of order 0
    # now dump the data to a VTK file.
    import pyvtk
    # Flatten the 2D array data as per VTK's requirements.
    z1 = reshape(transpose(z), (-1,))
    point_data = pyvtk.PointData(pyvtk.Scalars(z1))
    grid = pyvtk.StructuredPoints((50,50, 1), (-12.5, -12.5, 0), (0.5, 0.5, 1))
    data = pyvtk.VtkData(grid, point_data)
    data.tofile('/tmp/test.vtk')
    
    import mayavi
    v = mayavi.mayavi() # create a MayaVi window.
    d = v.open_vtk('/tmp/test.vtk', config=0) # open the data file.
     # The config option turns on/off showing a GUI control for the data/filter/module.
    # load the filters.
    f = v.load_filter('WarpScalar', config=0) 
    n = v.load_filter('PolyDataNormals', 0)
    n.fil.SetFeatureAngle (45) # configure the normals.
    # Load the necessary modules.
    m = v.load_module('SurfaceMap', 0)
    a = v.load_module('Axes', 0)
    a.axes.SetCornerOffset(0.0) # configure the axes module.
    o = v.load_module('Outline', 0)
    v.Render() # Re-render the scene.

    And I was getting some errors regarding PyVTK being too old. So I've installed NumPy, SciPy, and PyVTK from source and tried to run the example script again.

    This time it runs, opens MayaVi with the example image for a second, then closes. The error I get is:

    Xlib: extension "XFree86-DRI" missing on display ":0.0".

    SORT OF SOLVED PART:

    I added the line below and now the window stays open...duh. But still get the Xfree error message, but I can live with that.


    Add this as the last line in the above code...
    Code:
    v.master.wait_window()
    Cheers,

    t.





    GPG Key ID# 0x3AE05130
Working...
X