Skip to content
Tutorials Center
My learning

Topics

Lesson 4 of 38 ยท Getting Started

DWG, DXF and Drawing Recovery in AutoCAD

Understand DWG, DXF, DWT, DWS, PDF and DWF files, DWG version compatibility, how DXF stores entities as text, and how to recover damaged drawings with RECOVER, AUDIT and backups.

CAD work is mostly about sharing files with other people: clients, consultants, fabricators, and people on older software. Knowing what each format keeps and loses saves you from broken deliveries. This lesson covers the common file types, DWG versions, the DXF text structure (with a runnable Python reader), and what to do when a file will not open.

The file types you will meet

Extension What it is
.dwg The native binary drawing format (all entities, layers, layouts, styles).
.dxf Drawing Exchange Format, a documented tagged-text or binary export for other programs.
.dwt Template: a DWG used as a starting point.
.dws Standards file: layers, styles, linetypes to check drawings against.
.bak Backup of the previous save; rename to .dwg to open it.
.sv$ Autosave file; rename to .dwg to recover after a crash.
.pdf / .dwf Plot outputs for sharing a non-editable view.
.dwl/.dwl2 Lock files that mark a drawing as open by someone. Never edit these.

DWG versions

DWG changes format every few releases (names such as AC1027, 2013, or 2018). A new AutoCAD opens older files, but an old AutoCAD cannot open a newer DWG. When a consultant has older software, use SAVEAS and pick an older "AutoCAD 2013 Drawing" style type; some newer features (certain objects, visual effects) may be converted or lost. The eTransmit command gathers a drawing plus its referenced files (XREFs, fonts, plot styles) into one package so nothing is missing at the other end.

What DXF looks like

DXF is the format to know if you ever generate or read drawings with code. ASCII DXF is a sequence of group code / value pairs, two lines each: a number saying what the next value means, then the value. Sections are wrapped as 0 / SECTION, 2 / ENTITIES, ... 0 / ENDSEC. A line entity looks like this:

TEXT
  0
LINE
  8
WALLS
 10
0.0
 20
0.0
 30
0.0
 11
100.0
 21
50.0
 31
0.0
  0

The common group codes: 0 entity type, 8 layer name, 10/20/30 first point X/Y/Z, 11/21/31 second point (line end), 40 radius (circle) or text height, 1 text string, 62 colour index. Because it is documented, many programs (laser cutters, CNC software, GIS, Python libraries) read and write it.

flowchart TD
    A["DXF file"] --> B["HEADER: variables"]
    A --> C["TABLES: layers, linetypes"]
    A --> D["BLOCKS: block definitions"]
    A --> E["ENTITIES: lines, circles, text"]
    A --> F["EOF"]

A DXF is organised into sections; ENTITIES holds the geometry you see.

Stand-in: reading a tiny DXF

This runnable stand-in is a minimal reader for the ENTITIES section. It handles only LINE and CIRCLE and ignores everything else, so it is a teaching tool, not a full parser.

Python Stand-in: parse LINE and CIRCLE entities from DXF text

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Stand-in: writing DXF

Generating a DXF from your own program is a good way to feed a laser cutter. Here is a writer for lines.

Python Stand-in: write a rectangle as DXF LINE entities

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Real DXF files for modern AutoCAD also include a HEADER and TABLES section; very simple files like this one are accepted by many tools but not guaranteed everywhere.

Interoperability tips

  • PDF in, PDF out: PDFIMPORT converts PDF vector content to AutoCAD objects; the PDF plot driver exports sheets. Fonts may turn into plain geometry.
  • XREFs (external references) link other DWGs into yours; use eTransmit, or "Bind", to avoid missing references.
  • IMPORT/EXPORT handle formats such as SAT, STL (3D printing), FBX and others in full AutoCAD.
  • Fonts and plot styles must travel with the drawing, otherwise text changes.

Recovering a damaged drawing

  1. Try RECOVER (File > Drawing Utilities > Recover). It repairs errors and opens the file; RECOVERALL also fixes attached XREFs.
  2. AUDIT (answer Y to "fix any errors") inside an open drawing checks internal consistency.
  3. Open the .bak or autosave .sv$ copy (rename the extension to .dwg first).
  4. As a last resort, use INSERT or copy-and-paste into a fresh drawing from your template; salvage geometry by selecting it in the damaged file.
  5. Prevent the problem: PURGE unused items occasionally, keep drawings under control in size, and save to local disk, not directly over an unstable network.

Common mistakes

  • Sending a newer DWG to someone with older software, then wondering why it will not open.
  • Emailing a DWG without its XREFs, fonts or plot styles.
  • Treating DXF as a perfect copy: some objects (3D solids, dynamic blocks, annotative scales) lose fidelity.
  • Opening a .dwl or renaming the wrong file instead of the .bak.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which file is a plain, documented exchange format other programs can read?

    DXF is documented and widely supported; DWG is the native format.
  2. 2. In a DXF entity, what does group code 8 hold?

    Group code 8 is the layer name. 10/20/30 are the first point; 40 is radius for circles.
  3. 3. How do you open an autosave .sv$ file?

    Rename the file extension to .dwg, then open it. The same works for .bak files.
  4. 4. Which command gathers a drawing with its XREFs and fonts for delivery?

    eTransmit packages the drawing and its dependencies.

Summary

  • DWG is native; DXF is the open text exchange format; DWT is a template; BAK and SV$ are recovery copies.
  • Newer DWG files cannot open in older AutoCAD; SAVEAS an older version when needed.
  • DXF is pairs of group code and value; 0 = type, 8 = layer, 10/20 = point, 40 = radius.
  • Use eTransmit for deliveries; use RECOVER, AUDIT and backups when a file is damaged.

Next: A Tour of the AutoCAD Interface