I sincerely apologise if this question is a duplicate. Though it is clearly a question that must have been asked and answered a 1000 times I can't find any reasonable solution.

How do I take a simple 2D CAD Drawing (.dwg file) of a 2D boundary and generate a 2D computational mesh suitable for FEM analysis in any of the following file formats:

.xml (DOLFIN XML), .ele/.node (Triangle file format), .mesh (Medit generated by TetGen), .msh/.gmsh (Gmsh), .grid (Diffpack tetrahedral), .inp (Abaqus tetrahedral), .e/.exo/.ncdf (Sandia Exodus II), .vrt/.cell (Star-CD)

I'm doing this on my own time so it must be free software. Any assistance would be greatly appreciated!


  • 1
    $\begingroup$ Are you asking for automated mesh generation, without user intervention, or just for a free/open source mesh generation program with a graphic user interface? Please specify also the problem you are going to solve by the FEM. $\endgroup$
    – Stefano M
    Commented Jan 16, 2013 at 16:26
  • $\begingroup$ I expect some level of user intervention will be required. For drawings I'm using DraftSight (but am happy to use another free CAD tool) and for FEM solution I'm using the FEniCS package with Python. Currently I can only create meshes with GMSH, which is great but not quite a CAD package. What I would like to be able to do is import a CAD drawing and mesh it. $\endgroup$
    – dmon
    Commented Jan 16, 2013 at 18:37
  • $\begingroup$ Sorry to do this via an answer (I have no rep), but for Abaqus, it might be easier to use a .py script to generate the .inp file. So you'll have: IGES/STEP (Stefano's Suggestion) -> Abaqus python script to import it into CAE -> in the same script, generate a job and write input (.inp). Use the Abaqus macro recorder to figure out the code required and the Abaqus PDE to debug it. But later you can invoke it via command line by adding "noGUI=script.py" and it will carry the script out quicker. $\endgroup$
    – dim_voly
    Commented Aug 15, 2013 at 10:13

2 Answers 2


For your setup the most common strategy is to transfer data from the CAD program to the FEM preprocessor via a neutral file format, e.g. IGES or STEP, which are both supported by Gmsh.

Unfortunately I have no direct experience of DraftSight, so please check if it is capable of exporting (saving) models in IGES or STEP format. (Most CAD programs have native support for IGES or STEP, so I would expect that also DraftSight has this capability.)

  • $\begingroup$ This sounds like exactly what I'm looking for. Unfortunately, IGES appears to be a defunct standard, based on a rather quick internet search, and is not a save as option in DraftSight. There appears to be a lot of reported difficulty converting from .dwg to .iges reported in on-line forms. STEP is also not supported by Draftsight either so I need to figure this out. Great answer though, I'll see what I can do about converting and give this a go. Thank you. $\endgroup$
    – dmon
    Commented Jan 17, 2013 at 18:00
  • $\begingroup$ @dmon IGES was the industrial graphics interchange standard years ago, and somehow is still a must in present commercial CAD software: however I agree, using IGES can be quite a difficult task. On the contrary STEP is more modern and stable, although not always supported in legacy SW. Have a look at Inventor Fusion which should be able to load .dwg files and save STEP. (No endorsement for Autodesk intended... just an option among a number possible solutions.) $\endgroup$
    – Stefano M
    Commented Jan 17, 2013 at 20:31
  • $\begingroup$ Cheers Stefano, you've been extremely helpful. $\endgroup$
    – dmon
    Commented Jan 22, 2013 at 11:36

I would add my two cents about meshing with Gmsh. Even though Gmsh has some abilities to define geometry, Gmsh is not CAD package. So for complex models you need to use any third-party CAD software. For example,

  • OpenCASCADE (library)
  • Salome
  • FreeCAD
  • PythonCAD
  • BlenderCAD
  • Archimedes
  • OpenSCAD

I would give you links for all of these packages but StackExchange prohibits me to do this because I'm quite new here. However you can find them here or just googling by name. These packages are all free and most of them are open-source. To bind the model from these packages with Gmsh, you need to export geometry in one of OpenCascade formats (BRep, STEP or IGES, but note that IGES format is not recommended), or any other compatible to Gmsh format (STL and many others). If any of presented packages doesn't export a model in suitable format, you can save it in some CAD format and then use CAD Exchanger for converting.

  • $\begingroup$ CAD Exchanger seems to be what I've been looking for after Stefano's help above, cheers. And a great list of open-source/free CAD packages! $\endgroup$
    – dmon
    Commented Jan 22, 2013 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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