Re: [MayaVi-users] How to plot triangular mesh without the GUI coming up?
Status: Beta
Brought to you by:
prabhu_r
From: John R. C. <ca...@tx...> - 2009-05-28 21:51:36
|
Thanks for your help. I am still getting a window popping up, so may need to investigate the virtual X server or another solution. John Cary Gael Varoquaux wrote: > On Mon, May 25, 2009 at 09:53:08AM -0600, John R. Cary wrote: > >> It seems that the gui always comes up. I just want to >> create my scene and save it in a png without the GUI >> coming up. >> > > You are looking for offscreen rendering. I have sketched modifications to > your script that should do it: > > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > import tables > import numpy > from enthought.mayavi import mlab > mlab.options.offscreen = True > > def run(): > > # Then generate points and triangles > > # Then at the bottom I have > > # Create script and add triangles > tmesh = mlab.triangular_mesh(points[:, 0], points[:, 1], > points[:, 2], triangles) > > # Set the view > mlab.view(45, 15) > mlab.savefig("crabcav.png", size=(640,480)) > > if __name__ == '__main__': > run() > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > You should also read > http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/tips.html#off-screen-rendering > as to avoid having a window poping up, you may need to do more, depending > on your platform. > > HTH, > > Gaël > > |