[Gmsh] How to set MSH file format to 2

Andress randalandress1507 at comcast.net
Tue Mar 24 18:02:32 CET 2020

Christophe ,
Many thanks!  I suppose I should read all the FAQ :-(
Kind regards,

-----Original Message----- 
From: Christophe Geuzaine
Sent: Tuesday, March 24, 2020 2:03 AM
To: Andress
Cc: Gmsh
Subject: Re: [Gmsh] How to set MSH file format to 2

> 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 

How can I save a mesh file with a given (e.g. older) MSH file format 
• 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