Full DXF Support
Read, write and create DXF versions R12, R2000, R2004, R2007, R2010, R2013 and R2018. Read-only support for older versions.
A Python package to create, read, modify and write DXF documents — with compatibility across DXF versions R12 through R2018.
Built for programmers who need precise, reliable DXF processing.
Read, write and create DXF versions R12, R2000, R2004, R2007, R2010, R2013 and R2018. Read-only support for older versions.
Loads and edits DXF files while preserving all content. Unfamiliar third-party tags are retained for future modifications.
Fully type-annotated codebase. Passes mypy --ignore-missing-imports for confident integration.
Optional C-extensions bundled in binary wheels on PyPI for Windows, Linux and macOS.
Translate DXF data to render backends. Export to PNG, PDF or SVG via matplotlib, or display interactively with Qt.
The ezdxf CLI lets you view, draw, inspect, browse and audit DXF files directly from your shell.
r12writer, dxf2code, pycsg, MTextExplode, text2path, geo interface, mesh exchange, OpenSCAD and ODA File Converter bridges.
Full read and write support for both ASCII DXF and Binary DXF formats.
Create a new DXF document, add a layer, draw a line and place some text.
import ezdxf
from ezdxf import colors
from ezdxf.enums import TextEntityAlignment
# Create a new DXF document.
doc = ezdxf.new(dxfversion="R2010")
# Create new table entries (layers, linetypes, text styles, ...).
doc.layers.add("TEXTLAYER", color=colors.RED)
# DXF entities (LINE, TEXT, ...) reside in a layout (modelspace,
# paperspace layout or block definition).
msp = doc.modelspace()
# Add entities to a layout by factory methods: layout.add_...()
msp.add_line((0, 0), (10, 0), dxfattribs={"color": colors.YELLOW})
msp.add_text(
"Test",
dxfattribs={
"layer": "TEXTLAYER"
}).set_placement((0, 0.2), align=TextEntityAlignment.CENTER)
# Save the DXF document.
doc.saveas("test.dxf")
Install from PyPI. Optional C-extensions are bundled with the binary wheels.
The core package with C-extensions to create, read, modify and write DXF documents:
pip install ezdxf
Includes matplotlib and PySide6 for rendering DXF to PNG, PDF and SVG and interactive viewing:
pip install ezdxf[draw]
Everything you need to learn, use and contribute to ezdxf.
Full reference and user guide for the development version.
ezdxf.mozman.at/docsSource code, issue tracker and pull requests.
github.com/mozman/ezdxfDiscussions, questions and community feedback on GitHub.
github.com/mozman/ezdxf/discussionsReleases and binary wheels for Windows, Linux and macOS.
pypi.org/project/ezdxfAdditional notes, release notes and changelog beyond the docs.
ezdxf.mozman.at/notes