Skip to main content

DXF Format

Read AutoCAD DXF drawings as one record per modelspace entity.

Overview

PropertyValue
Format iddxf
ClassDXFIterable
Extensions.dxf
ReadYes
WriteNo
Extradxf (ezdxf)
Maturitystable

Record shape

Common fields plus geometry keyed by entity type (LINE, CIRCLE, ARC, POINT, TEXT, LWPOLYLINE, POLYLINE, …):

{
"dxftype": "LINE",
"layer": "0",
"color": 256,
"handle": "1A",
"start": (0.0, 0.0, 0.0),
"end": (1.0, 0.0, 0.0),
}

totals() returns the modelspace entity count.

Usage

from iterable import open_iterable

with open_iterable("drawing.dxf") as source:
for entity in source:
print(entity["dxftype"], entity.get("layer"))

Install with pip install iterabledata[dxf].

See also