[Gmsh] How to set MSH file format to 2

Christophe Geuzaine cgeuzaine at uliege.be
Tue Mar 24 08:03:28 CET 2020

> On 24 Mar 2020, at 05:33, Andress <randalandress1507 at comcast.net> wrote:
> Is it possible to set MSH file format to 2 as an option for the later versions (4.5.4) of Gmsh, so that when the .msh is saved from the GUI, it will produce MSH2 instead of MSH4 ascii files?

Sure. With the GUI, select File->Export, enter a .msh filename, then select the format you want in the dropdown menu. Then use File->Save Options as Default. This will save your options in ~/.gmsh-options.

See also FAQ 17 in http://gmsh.info/doc/texinfo/gmsh.html#Mesh-module-questions:

How can I save a mesh file with a given (e.g. older) MSH file format version?
		• In the GUI: open ‘File->Export’, enter your filename.msh and then pick the version in the dropdown menu.
		• On the command line: use the -format option (e.g. gmsh file.geo -format msh2 -2).
		• In a .geo script: add the line Mesh.MshFileVersion = x.y; for any version number x.y. You can also save this in your default options.
		• In the API: gmsh::option::setNumber("Mesh.MshFileVersion", x.y).
As an alternative method, you can also not specify the format explicitly, and just choose a filename with the .msh2 or .msh4 extension.


> Kind regards,
> Randal 
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh

Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 

More information about the gmsh mailing list