Minimal read-only DWG parser (Rust core + Python API)
Project description
ezdwg
Minimal DWG (R2000-R2013 / AC1015-AC1027) reader with a Python API inspired by ezdxf. This project is DWG read-focused today and focuses on a simple, friendly API.
Status
- High-level API (
ezdwg.read): R2000 / AC1015, R2004 / AC1018, R2007 / AC1021, R2010 / AC1024, R2013 / AC1027 - Raw API (
ezdwg.raw): R2000 / AC1015, R2004 / AC1018, R2007 / AC1021, plus native AC1024/AC1027 support for object listing andLINE/ARC/LWPOLYLINEdecode - High-level entities: LINE, ARC, LWPOLYLINE, POINT, CIRCLE, ELLIPSE, TEXT, MTEXT, DIMENSION (linear + radius + diameter)
- Additional raw decode: INSERT (+ low-level POLYLINE/VERTEX helpers)
- Output units/angles: high-level API returns ARC angles in degrees
Install
Rust toolchain is required (PyO3 build).
pip install -e .
Plotting (optional):
pip install "ezdwg[plot]"
DWG to DXF conversion (optional, ezdxf backend):
pip install "ezdwg[dxf]"
Quick Start
import ezdwg
doc = ezdwg.read("path/to/file.dwg")
msp = doc.modelspace()
for e in msp.query("LINE LWPOLYLINE ARC CIRCLE ELLIPSE POINT TEXT MTEXT DIMENSION"):
print(e.dxftype, e.handle, e.dxf)
Plot in matplotlib:
import ezdwg
doc = ezdwg.read("path/to/file.dwg")
doc.plot(types="ARC", arc_segments=96)
CLI
ezdwg --version
ezdwg inspect examples/data/line_2000.dwg
python -m ezdwg inspect examples/data/line_2000.dwg
ezdwg convert examples/data/line_2000.dwg /tmp/line_2000_out.dxf
ezdwg convert examples/data/arc_2000.dwg /tmp/arc_2000_out.dxf --types "ARC" --dxf-version R2010
DWG to DXF
ezdxf is used as the DXF writing backend.
import ezdwg
result = ezdwg.to_dxf(
"examples/data/line_2000.dwg",
"/tmp/line_2000_out.dxf",
types="LINE ARC LWPOLYLINE",
dxf_version="R2010",
)
print(result)
Or from an already opened document/layout:
doc = ezdwg.read("examples/data/line_2000.dwg")
doc.export_dxf("/tmp/line_2000_out.dxf")
Examples
Sample DWG files are available under examples/data/.
python examples/basic_read.py
python examples/query_types.py
python examples/plot.py
python examples/text_mtext.py
python examples/dimensions.py
python examples/raw_insert_2004.py
python examples/convert_to_dxf.py
Low-Level API
If you need raw decode access:
from ezdwg import raw
raw.decode_line_entities("path/to/file.dwg")
Limitations
- Read‑only
- High-level API supports R2000 (AC1015), R2004 (AC1018), R2007 (AC1021), R2010 (AC1024), and R2013 (AC1027)
- AC1021/AC1024/AC1027 use native decode for LINE/ARC/LWPOLYLINE/POINT/CIRCLE/ELLIPSE and are regression-tested against paired DXF samples
- TEXT/MTEXT/DIMENSION decoders now use version-aware common header paths internally; R2007+ dedicated sample regression coverage is still pending
- AC1021/AC1024/AC1027 entity style/layer color resolution is currently best-effort on some files
- Legacy
POLYLINE/VERTEX/SEQENDsamples are not yet covered in AC1018 test data - ARC angles in raw API are radians (high‑level API converts to degrees)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ezdwg-0.1.0.tar.gz.
File metadata
- Download URL: ezdwg-0.1.0.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76fbce24ad409c3e3892861d4d612358cc7b98691da258eeecacf4e19faa8a31
|
|
| MD5 |
b7756adc35f351828dfe5d0c4ddd2428
|
|
| BLAKE2b-256 |
3069fec444ccd51952b7804f585e492ac958929eb0a937b6d180a571a63d5f7d
|
File details
Details for the file ezdwg-0.1.0-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: ezdwg-0.1.0-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 389.7 kB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3f9ce648965b2d3010805dfe92fe03fa56004a1e8f31068dfb067a9634c6216
|
|
| MD5 |
1551df907d379de7b749b9525513b161
|
|
| BLAKE2b-256 |
2f39fcb42e6f0ec174c9dad6bc9cdc0194aa930236f79b4231ab9c8a828d627c
|
File details
Details for the file ezdwg-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: ezdwg-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 475.8 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7933c9d9f86be81e966319124f98762ce04c711b2c15b94b5e8321ad783e32c
|
|
| MD5 |
e4bee76548e46fe35b149dc3f2763922
|
|
| BLAKE2b-256 |
88aa6a82b291d901e72424bf804b3798db5227b99344b15158951b52dba43327
|
File details
Details for the file ezdwg-0.1.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: ezdwg-0.1.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 850.9 kB
- Tags: CPython 3.10+, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b9bdb06cec163072c4df32cba0ee344ec4549185f0d154f514abdd7052a30ae
|
|
| MD5 |
30a12a4356e2b7647aabaded869a355c
|
|
| BLAKE2b-256 |
2bb8894ebcc21d42405fd9e7e7f1cea463f331d43fdf1e9c57522fe9da9c1046
|