ZYSNOR

Glossary · CAD and BIM

What is a DXF File? Meaning, Example and How It Works

By , Founder of ZYSNOR · Updated · Checked · 5 min read

In simple words

DXF (Drawing Exchange Format, also Drawing Interchange Format) is a CAD file format from Autodesk made for exchanging drawings between AutoCAD and other programs. Its specification is published by Autodesk, and the common form is a plain text (ASCII) file.

DXF was introduced with early AutoCAD so that other programs could read and write drawings. AutoCAD can save DXF in ASCII (text) or binary form; the text form is the one most programs exchange.

How it works

A DXF file is a long list of pairs. Each pair is a group code on one line and its value on the next. The group code says what the value means: 0 starts a new object, 8 is the layer name, 10, 20 and 30 are the X, Y and Z of the first point, and 11, 21 and 31 the X, Y and Z of the second point. Because the meaning travels with every value, any program that knows the codes can rebuild the drawing.

Sections of a DXF file

Six sections in order: HEADER, CLASSES, TABLES, BLOCKS, ENTITIES and OBJECTS
ENTITIES holds the objects you see on screen; the file ends with EOF.
  • HEADER: drawing settings such as units and limits.
  • CLASSES: information about application-defined classes.
  • TABLES: layers, linetypes, text styles, views and other named tables.
  • BLOCKS: the definitions of every block used in the drawing.
  • ENTITIES: the drawing objects themselves, including block references.
  • OBJECTS: non-graphical data such as dictionaries and layouts.

Worked example: reading one line

The ENTITIES section contains this line object:

Table of the group codes for one LINE: 0, 8, 10/20/30, 11/21/31 and 62
Each group code says what the value next to it means.

From the codes, the line runs from (0, 0, 0) to (4000, 3000, 0) on layer A-WALL and is coloured red. Its length can be worked out from the codes alone:

  • Change in X: 4000 − 0 = 4000
  • Change in Y: 3000 − 0 = 3000
  • Length: √(4000² + 3000²) = √(16,000,000 + 9,000,000) = √25,000,000 = 5,000
Bar chart of X change 4000, Y change 3000 and length 5000 mm
A program reading the DXF finds the same 5,000 mm that AutoCAD shows.

In a drawing set in millimetres, that is a wall line 5,000 mm (5.00 m) long. The DXF does not say "millimetres" next to the number; the unit comes from the header setting or from what the sender tells you.

Where DXF is used

Laser cutters, CNC routers and plasma cutters, GIS software, older CAD programs and many web and engineering tools import DXF even when they cannot read DWG. It is also handy for scripts: because the text form is readable, a short program can pull every line on one layer out of a DXF file.

Step by step: making a DXF for another program

  1. Clean the drawing: delete construction lines, PURGE unused items and explode objects the receiver cannot read (ask first).
  2. Run SAVEAS (or DXFOUT) and pick the DXF version the receiver supports; older versions are read by more programs.
  3. Choose ASCII unless the receiver asks for binary.
  4. Tell the receiver the drawing units.
  5. Open the DXF in the receiving program, or a viewer, and check a known dimension.

Common mistakes

  • Expecting every AutoCAD feature to survive: complex objects may arrive as simple lines or not at all.
  • Wrong units after import, so the part is cut 25.4 or 1,000 times the right size.
  • Choosing a DXF version newer than the receiving program understands.
  • Very large files: a text DXF is usually much bigger than the same DWG.
  • Splines, text and hatches the machine cannot use; many cutters want only lines, arcs and closed polylines.

Related terms

Frequently asked questions

How do I make a DXF in AutoCAD?

Use SAVEAS and choose a DXF file type (or DXFOUT).

Is DXF open?

Its specification is published by Autodesk, so other programs can read and write it.

Sources

← All glossary terms