[Gmsh] exporting views in graphics format (png) in batch

Christophe Geuzaine geuzaine at acm.caltech.edu
Tue Aug 2 20:09:48 CEST 2005


Cristian Tibirna wrote:
> Hello
> 
> I have a large number of .pos files containing one view each. I'd like to 
> export them all to png to put them in a latex document. I think I perused all 
> documentation attentively but I didn't find how to do this in batch.
> 
> I can generate automatically a number of script files of the form
> 
> Merge "test.pos";
> Draw;
> Print Sprintf("test.png");
> 
> 
> but then I don't know how to at least quit gmsh automatically if not even not 
> map the window at all to the screen.

If the files have "nice" names, you could use a loop to create all the
files in a single script. For example, if your files are named 
test1.pos, test2.pos, ..., test10.pos, you could use:

For i In {1:10}
   Merge Sprintf("test%g.pos", i);
   Draw;
   Print Sprintf("test%g.png", i);
EndFor

Otherwise, to quit Gmsh from a script, you can use "Exit;".

There is currently no way to print graphics without mapping the OpenGL
window. There was a message on the mailing list recently about a similar 
issue for machines without graphic cards (with a neat workaround using 
VNC): http://www.geuz.org/pipermail/gmsh/2005/001600.html.

Take care,

Christophe


-- 
Christophe Geuzaine
Applied and Computational Mathematics, Caltech
geuzaine at acm.caltech.edu - http://geuz.org