DXF Data Format
Normally a DXF file is organised as follows:
The HEADER section of the DXF file contains variables assigned to drawings. These variables are set by diverse commands, and is the data shown by the STATUS command.
In the HEADER section, each variable is specified by a group 9 code that determines variable, followed by the type of group that determines the value.
Sample: HEADER variables, following groups and their respective values:
$ANGBASE |
50 |
Angle direction |
$AUNITS |
70 |
Angle unit mode |
$EXTMAX |
10,20,30 |
Upper right point of drawing limits reported in World coordinates |
$EXTMIN |
10,20,30 |
Lower left point of drawing limits reported in World coordinates |
$INSBASE |
10,20,30 |
Insertion base set with the command BASE |
This section contains definitions of designated functions:
- Line Type Table
- Layer Table
- Style Table
- Area Table
- UCS Table User Coordinate System
- VPORT Table Viewport Configuration
- DIMSTYL Dimension Table
- APPID Application Identification Table
The TABLES section of the DXF files contains a number of tables.
The LTYPE table must always precede the LAYER table. The sequence of the remaining tables is arbitrary.
Group 0, TABLE designation, is the first entry in each table. This is followed by a group 2 code, identifying the appropriate table: VPORT, LTYPE, LAYER, STYLE, VIEW, DIMSTYLE, BKS or APPID.
These groups are followed by Group 70, specifying the maximum number of subsequent table entries.
Table names are always written in HIGHCASE..
The BLOCKS section of the DXF file contains all BLOCK definitions, and thus all drawing objects associated with the relevant blocks.
All objects in the BLOCK section appear between BLOCK and WNDBLK objects.
Block definitions are never nested, i.e. a BLOCK is never inserted between another BLOCK - ENDBLK pair.
The ENTITIES section of the DXF file contains object elements. The first entry, for each object begins with a group 0 code, i.e. object identification.
Each object possesses a group 8 code designating the layer on which the object is located. It is also possible to assign elevation or object thickness/height data as well as line type or colour information to each object.
A DXF file always ends with the entry, END OF FILE: EOF.

The example below shows an empty DXF file containing only section delimiters and table headers:
0 Start of HEADER section
SECTION
2
HEADER
<< from now on all functions are defined >>
0
ENDSEC ends the HEADER section
0 Start of the TABLES section
SECTION
2
TABLES
0
TABLE
2
VPORT
70
Calculation of maximum number of elements in the VPORTS table
<<Definition of elements in the VPORTS table>>
0
ENDTAB
0
TABLE
2
LTYPE, Layer, STYLE, UCS, ou DWGMGR
70
Calculation of the maximum number of table elements
<<Definition of divers table elements>>
0
ENDTAB
0
ENDSEC
End of TABLES section
0 Start of BLOCKS section
SECTION
2
BLOCKS
<<Definition of elements associated with BLOCKS>>
0
ENDSEC
End of BLOCKS section
0 Start of ENTITIES section
SECTION
2
ENTITES
<< Definition of all entities in the drawing>>
0
ENDSEC
End of ENTITIES section
0
EOF End of File
Groups
A DXF file is made up of a number of GROUPS, with each group occupying two lines. The first line contains the group code, while the second specifies the group value. Format is dependent on the type of group.
Group code assignment is dependent on the type of element being described.
Group code |
Values |
Group code |
Values |
0 - 9 |
string |
999 |
remark |
10 - 59 |
floating point |
1000 - 1009 |
string |
60 - 79 |
integer |
1010 - 1059 |
floating point |
210 - 239 |
floating point |
1060 - 1079 |
integer |
Group codes are used to designate the type and overall application of the group.
Groups with file delimiters (group code 0) serve the purpose of delimiting the file sections.

Group Code |
Value Type |
0 |
Identifies the start of an object, a table entry or a file delimiting character. The following text value indicates the type of the section. |
1 |
Primary text value of an object |
2 |
A name, attribute name, block name etc. |
3 - 4 |
Other text and name values |
5 |
Object reference in hexadecimal character string |
6 |
Name determining line type |
7 |
Name determining text style |
8 |
Name determining layer |
9 |
Id of the variable name (only in the HEADER section of the DXF file) |
10 |
Primary x-coordinate of a line start point, a text element, a circle centre etc. |
11 - 18 |
Other x-coordinates |
20 |
Primary y-coordinate |
21 - 28 |
Other y-coordinates |
30 |
Primary z-coordinates |
31 - 37 |
Other z-coordinates |
38 |
Elevation of an object if unequal 0 |
39 |
Height of an object if unequal 0 |
40 - 48 |
Floating point for text height, scaling factors etc. |
49 |
Repeated value |
50 - 58 |
Angle |
62 |
Colour number, determined |
66 |
"Element sequence", Flag determined |
70 - 78 |
Integer, e.g. repeated counts, flag-bits or modes |
210, 220, 230 |
x-, y- and z-components for direction of "loft" |
999 |
Comments |
1000 |
ASCII-character string |
1001 |
Registered application name |
..... ...... |
|