GiD customisation: Example
Exporting GiD Mesh to Autocad DXF
One of the most powerful skills of GiD is the capability to create a personalised
output file. (See User Manual-Configuration and Compilation Files). In particular,
a mesh created by GiD can be converted to the Autocad DXF format with a little
code presented in the following lines.
Create a new problem type called DXFout, i.e., create a subdirectory
called DXFout.gid in the Gid directory.
Create the file called DXFout.prb with the next text:
PROBLEM DATA
END PROBLEM DATA
Create the file DXFout.mat to define different materials in the model.
The materials will be treated as layers in the DXF format:
NUMBER: 1 MATERIAL: Generic
QUESTION: Property:
VALUE: NONE
END MATERIAL
Create the file DXFout.bas with the specific DXF format description:
*realformat "%15.5f"
*intformat "%7i"
*# Interface GID-DXF R12
*# Export triangle/quadrilateral mesh
*# Created by Kike III - November 1999
*Set var HANDLE=21
0
SECTION
2
ENTITIES
0
POLYLINE
5
*format "%i"
*HANDLE
*Set var HANDLE=operation(HANDLE(int)+1)
8
GiD
66
1
10
0.0
20
0.0
30
0.0
70
64
71
*npoin
72
*nelem
*loop nodes
0
VERTEX
5
*format "%i"
*HANDLE
*Set var HANDLE=operation(HANDLE(int)+1)
8
GiD
10
*NodesCoord(1,real)
20
*NodesCoord(2,real)
30
*NodesCoord(3,real)
70
192
*end nodes
*Set elems(Triangle)
*Add elems(Quadrilateral)
*Loop elems
0
VERTEX
5
*format "%i"
*HANDLE
*Set var HANDLE=operation(HANDLE(int)+1)
8
*#GiD
*format "%i"
M*elemsmat
10
0.0
20
0.0
30
0.0
70
128
*for(INODO=1;INODO<=nnode;INODO=INODO+1)
*format "%i"
7*INODO
*elemsConec(*INODO,int)
*end INODO
*end elems
0
SEQEND
5
*format "%i"
*HANDLE
*Set var HANDLE=operation(HANDLE(int)+1)
8
GiD
0
ENDSEC
0
EOF
Now you can export your meshes from GiD to a Autocad DXF format with the next
two steps:
-
1st Step: From GiD, select DXFout in the problem type (Data -> Problem
Type -> DXFout) and work with your model as usual.
-
2nd Step: Write your DXF file (Files -> Import/Export -> Write Calculation
File).
You can also download DXFout.tar.gz
( 91 KB) or DXFout.zip
( 96 KB)
GiD Mesh of a spoon
Autocad render of the spoon imported in DXF format from GiD
|