Take the 2-minute tour ×
Computational Science Stack Exchange is a question and answer site for scientists using computers to solve scientific problems. It's 100% free, no registration required.

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!


share|improve this question
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. –  Stefano M Jan 16 '13 at 16:26
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. –  dmon Jan 16 '13 at 18:37
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. –  dim_voly Aug 15 '13 at 10:13
add comment

2 Answers

up vote 3 down vote accepted

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.)

share|improve this answer
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. –  dmon Jan 17 '13 at 18:00
@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.) –  Stefano M Jan 17 '13 at 20:31
Cheers Stefano, you've been extremely helpful. –  dmon Jan 22 '13 at 11:36
add comment

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.

share|improve this answer
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! –  dmon Jan 22 '13 at 14:13
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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