I am trying to create a scene in SOFA (Simulation Open Framework ) in which I require to specify a .msh file(mesh topology) for a .obj file(model).

Is there any way to generate a .msh file in blender or a way to convert obj to .msh.



Orbiter Import/Export .MSH Files Addon

The current version of the add-on works only with Blender 2.63 or later with Bmesh (new powerful mesh system with Ngons).

The addon exports and imports geometry, UVs, materials and textures from/into Blender scene.


  1. Download the latest Blender build from Graphicall.org

  2. Download the archive from links below

    or you can download Git repository from

    • git://gitorious.org/blender-orbiter-io/blender-orbiter-io.git

    • git://github.com/vlad32768/blender-orbiter-io.git

  3. Place io_orbiter_msh.py into Blender's addons directory

  4. Enable module in File->User Preferences->Add-Ons dialog

Notes on .msh import:

  1. You should import meshes from Orbiter installation. The module will autodedect Orbiter directory and load textures from Orbiter installation.

  2. The script doesn't import vertex normals. It seems that Blender often recalculates vertex normals, so it's useless to import them.

  3. If there is one material with different textures in .msh file, the script will create a copy of this material for every texture.

  4. There are no ambient and emissive colors in Blender, so the script doesn't import ambient colors, but calculates emit component

  5. Some models (for example DGIV and DG-XR) have got materials with shiny specular and zero hardness. That doesn't look good in blender. You can use "Raise small hardness" parameter in file import dialog to set minimal hardness manually

Notes on .msh export

  1. The script exports selected objects. To export the whole scene, select all objects by pressing "a".

    1a. Blender has to be in object mode before exporting ( to avoid some Python API issues and, of course, to select mesh objects for export). If not, object mode will be set automatically during export.

  2. Coordinate system: The script does conversion to left handed coordinate system, so there is the proper way to place your model in Blender when you start modeling:

    • Y axis is the direction of the main thruster's exhaust; -Y is the main thrust direction;

    • Z axis points UP;

    • X axis points LEFT.

  3. Materials:

    • You should use Blender Internal renderer; don't use Cycles if you want to export your model to Blender;

    • The script exports only the first material of a mesh object;

    • The script makes Ambient color equal to Diffuse;

    • Emissive color is equal to Diffuse*emit

  4. Textures

    • The script exports only the first texture of a material; this texture's type must be "IMAGE".

    • If you export your model to "file.msh", textures will be saved in "filetex" directory near the .msh file. "file.msh" should be copied to Orbiter's "Meshes" directory, "filetex" directory

    • to "Textures" (see TEXTURES section of .msh file)

    • Blender does not support writing .DDS files. In most cases the script will save .png files (check it).

    So you have to convert textures to .dds manually. However, the script writes names with .dds extension in .msh TEXTURES section

(Source: http://www.orbiter-forum.com/showthread.php?t=18661 )

| improve this answer | |
  • $\begingroup$ I was able to successfully export .msh file. However when I tried to load in Gmsh or Sofa it is reporting errrors . In Gmsh error is Line 2 :Unknown variable GROUPS. $\endgroup$ – user3351750 Apr 28 '14 at 18:24
  • $\begingroup$ Attached the torus.msh file. $\endgroup$ – user3351750 Apr 28 '14 at 18:32
  • $\begingroup$ @user3351750 then apparently that program can't deal with those lines, you can always manually delete everything but the geometry stuff $\endgroup$ – PeterT Apr 28 '14 at 18:44
  • $\begingroup$ @PeterT I have tried deleting the line except GEOM Line , and its showing syntax error on GEOM. I do not have much idea about the syntax of mesh file but I referred to a .msh file which is loading properly and it has $NOD for node and $ELM for elem . $\endgroup$ – user3351750 Apr 28 '14 at 18:52
  • $\begingroup$ @user3351750 maybe it's not the right .msh format after all, why can't you just use *.obj. Their obj parser looks like it should work. $\endgroup$ – PeterT Apr 28 '14 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.