[Gmsh] Conversion to ASCII by command line

Christophe Geuzaine cgeuzaine at ulg.ac.be
Sun Oct 18 23:53:39 CEST 2009


Jean-Michel FONTAINE wrote:
> Dear Gmsh developpers
> 
> First congratulations for your software, which is like a dream in
> opensource scientific softwares, regarding accessibility, reliability
> and ergonomy.
> 
> I would need to automate mesh generation to openFoam. OpenFoam includes
> a converter from ASCII .msh files, but not from binary .msh files. And
> your software provides a command line converter only to  binary files.
> 
> Is there a work around to have a command line or a script which would :
> load a .med mesh, convert it to ASCII .msh and exit ?

It's a bit brutal but you can simply do this:

   gmsh file.med -3

(Gmsh will not remesh anything since the CAD representation is purely 
"discrete".)

A cleaner way would be to write a little script containing

   Save "file.msh";
   Exit;

and parse it with "gmsh file.med myscript -": this will save the file in 
.msh format with the default options and exit. You could also add 
various options to control the format before the Save command in the 
same script.

Ch.


> 
> Thanks in advance
> 
> Jean-Michel
> 
> 
> 
> _______________________________________________
> gmsh mailing list
> gmsh at geuz.org
> http://www.geuz.org/mailman/listinfo/gmsh
> 
> 


-- 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science
http://www.montefiore.ulg.ac.be/~geuzaine