# Mesh simple 2d CAD boundry drawing

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!

Derek

-
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

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

-
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

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,