Personal tools
You are here: Home / cmgui / Wiki / Cmgui File Formats
Log in

Forgot your password?

Cmgui File Formats


Cmgui can deal with a number of different file formats used to describe geometries.

To read in a geometry we use one of the following

  • exnode/exelm
  • fml

Cmgui can also export geometries to the following file formats

  • exnode/exelem (for cmgui)
  • ipnode/ipelem (for cm)
  • iges (cad/cam programs)
  • vrml (wrl files)
  • wavefront (obj files)

When exporting you will often need to specify a group (or region). Groups and regions are now essentially the same. Regions replace groups but some of the older routines still use the word "group" rather than region.

Reading in geometry

Exnode and exelem files

Usually geometry is read in from exnode and exelem files. These exported node and exported elem files are the format cm exports a mesh to, for reading into cmgui. The exnode file describes the locations of the nodes in the mesh. The exelem file describes the connectivity (including lines, faces and 3d elements).

The exnode file format is fairly simple. Fore each node it lists the coordinates and any field values.

The exelem file format is more complicated. An explanation of some of the details of the exelem format can be found here: Node, Line and Element numbering in exelem files. See example a/a2 for an example of an exnode and exlem file used to describe a cube.

To read in a exnode and exelem files use

gfx read node mymesh.exnode;
gfx read elem mymesh.exelem;

Cmgui can read in gzipped exnode and exelem files. It can be convenient to gzip your files if they are large. To read them in just specify the file name as usual. eg 'gfx read node mymesh.exnode.gz'

Field ML

Cmgui can also read in a mesh described using FieldML. A fml file incorporates both node locations and mesh connectivity. See example a/a1 for a simple fml file to describe a cube.

To read an fml file use

gfx read region mymesh.fml;

Generating exnode and exlem files

Although cmgui only reads in a couple of file formats, it may be possible to write a script to generate the exnode and exlem files from a different file format.

Some scripts already exist. For example there is a script to generate exnode/exelem files for a tetrahedral mesh described in tecplot format. It is available <a href="" >here</a>.

Some work is also being done on the IGES format.

Exporting geometries

exnode and exelem

To write out an exnode and exelem file use

gfx write mymesh.exnode
gfx write mymesh.exelem

field ml

Note that you muse specify which region (group) to write out, otherwise the file will not be read in properly. For the example below assume there is a group called cube which contains nodes and elements.

To write out a fml file use

gfx write region group cube mymesh.fml

ipnode and ipelem

It is possible to write out the mesh to the ipnode and ipelem format used to read a mesh into cm. In addition other ip files that may be required are also written. All files need to be specified, even if you are only interested in the ipnode and ipelem files. As for the fieldml example you must specify a region (group) that contains nodes and elements to write out. You must also specify which field you will write out.

To write out an ipnode and ipelem file use

gfx export cm ipcoor mymesh.ipcoor ipbase mymesh.ipbase ipmap mymesh.ipmap ipnode mymesh.ipnode ipelem mymesh.ipelem region cube field coordinates


As for the fieldml example you must specify a group (region) that contains nodes and elements to write out. You must also specify the coordinate_field you will use.

To write out an iges file use

gfx export iges coordinate_field coordinates group cube mymesh.igs

VRML (wrl files)

A vrml export will write out all objects from a particular scene to vrml format.

To write these out to a wrl file use

gfx export vrml file mymesh.wrl

Wavefront (obj files)

Not fully implemented yet. I'm not sure how much you can write out to a file.