Drawing Exchange Format (DXF)
This page is unfinished. Feel free to help the project by sharing your knowledge about this subject.
Drawing Exchange Format (DXF) is a file format designed by Autodesk to allow exchange with their AutoCAD software. While they publish specs it is not an open format as they alone control iterations to the format. Autodesk and the Open Design Alliance sell commercial licenses for accessing DXF files. There is generally better support for DXF in free/libre software, compared to Drawing (DWG) format.
DXF can be thought of as an exchange version of the Drawing (DWG) format developed by Autodesk. File sizes may be larger, as it is in plaintext, whereas DWG is binary, and it may not contains data of proprietary AutoCAD extensions. Autodesk has discouraged the use of DWG, by inserting an encrypted proprietary signature that determines whether or not a DWG comes from Autodesk software. However, despite this discouragement, DWG creation is commonplace. Large parts of the DXF specs are undocumented, only the common basic entities are described, but not any advanced like dynamic blocks, 3d solids, 3d surfaces or parametric blocks. Likewise no free external library supports these.
Support for DXFs in free software
The LibreDWG project has an example application for SVG and Postscript conversion, converters from and to DXF.
Blender is capable of importing DXFs with absolute coordinates with the BlenderGIS add-on. However, this workflow may have issues in recent releases. Blender's support for DXF is based on an older DXF library, and therefore may have compatibility issues with newer DXFs being produced.
Libraries for Software Development
- dxflib by panjh is an open source C++ library mainly for parsing DXFTM files.
- dxflib by Ribbonsoft is a C++ GPLv2-or-later library used in QCAD
- dxflibrw is an open source library for reading DWG files (pre 2018) and readgin /writing DXF files. It is used in many separate forks, importantly by LibreCADgithub and Solvespace reference
- LibreDWG supports DXF & DWG (details are on the linked page)
- ezdxf is a python library supporting DXF versions up to 2018
Advantages and Disadvantages
For the purpose of documentation is worth comparing DXF to Scalable_Vector_Graphics_(SVG)
Pros of DXF:
- Is designed to capture the same data that Drawing (DWG) can capture. So if DWG is your native format, DXF ensures a minimum of data loss.
- Data in 3 dimensions (Scalable Vector Graphics (SVG) files are only two dimensions)
- Easy to read, easy to write, and a variety of data types of play with (blocks, polylines, polyfaces...)
- Layers with styles baked into it
- Model space. Paper space. Multiple paper spaces.
Cons of DXF:
- No units information in the file
- Requires a DXF viewer.
- Is an "open" standard, but at the same time it's kinda like Autodesk's less favourite cousin that has to follow Drawing (DWG) but lacks some of the proprietary add-ons that DWG has.
- Very hard to parse, many parts are undocumented, very irregular.
- Discussion on documentation formats on the OSArch discussion forum What is best for documentation when svg, dxf, dwg?
- DXF at Wikipedia
- Autodesk DXF Reference