DXF File Format
Design reads and writes the DXF (Drawing Exchange Format), an open file format originally developed by Autodesk as the interoperability standard for CAD drawings. DXF files can be opened by virtually all CAD applications and are the primary way to share drawings created in Design.
Overview
DXF is a plain-text (ASCII) format. Each file is a sequence of group code / value pairs — an integer group code on one line followed by its value on the next. The group code identifies what the value means:
0 ← group code: entity type
LINE ← value: this is a LINE entity
10 ← group code: X coordinate of start point
100.0 ← value
20 ← group code: Y coordinate of start point
50.0 ← value
Group codes are consistent across entity types — for example, group code 10 always represents the primary X coordinate of an entity regardless of which entity type it belongs to.
File Structure
A DXF file is divided into named sections, each beginning with a SECTION marker and ending with ENDSEC. The sections appear in the following order:
Section |
Purpose |
|---|---|
|
Drawing-wide variables: units, limits, current layer, snap settings, etc. |
|
Application-defined object classes (rarely edited manually). |
|
Named object definitions: layers, line types, text styles, dimension styles, and block record table. |
|
Block definitions, including the implicit |
|
All drawing entities in model space (legacy; modern files store entities in |
|
Non-graphical objects such as dictionaries and extended data. |
Common Group Codes
The following group codes appear in almost every entity:
Code |
Meaning |
|---|---|
|
Entity type name (e.g. |
|
Entity handle — a unique hex identifier |
|
Line type name ( |
|
Layer name |
|
Primary point X and Y coordinates (start point, centre, or insertion point) |
|
Secondary point X and Y coordinates (end point or direction) |
|
Thickness (extrusion depth; |
|
Colour number ( |
|
Line weight ( |
DXF Entities
Each drawing entity has its own set of required group codes in addition to the common ones above. The pages below describe how each Design entity is represented in DXF:
commands/line —
LINEentitycommands/circle —
CIRCLEentitycommands/arc —
ARCentitycommands/polyline —
LWPOLYLINEentitycommands/rectangle —
LWPOLYLINEentity (closed flag set)commands/text —
TEXTentitycommands/hatch —
HATCHentitycommands/dimension —
DIMENSIONentitycommands/block —
BLOCKdefinition +INSERTentity