Skip to main content

Minimal read-only DWG parser (Rust core + Python API)

Project description

ezdwg

PyPI version

Minimal DWG (R14-R2018 / AC1014-AC1032) 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): R14 / AC1014 (experimental), R2000 / AC1015, R2004 / AC1018, R2007 / AC1021, R2010 / AC1024, R2013 / AC1027, R2018 / AC1032
  • Raw API (ezdwg.raw): R14 / AC1014 (version detect + object headers), R2000 / AC1015, R2004 / AC1018, R2007 / AC1021, plus native AC1024/AC1027/AC1032 support for object listing and LINE/ARC/LWPOLYLINE decode
  • 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 R14 (AC1014, experimental), R2000 (AC1015), R2004 (AC1018), R2007 (AC1021), R2010 (AC1024), R2013 (AC1027), and R2018 (AC1032)
  • AC1014 currently has stable version detection/object-header listing; entity geometry decoding coverage is limited
  • AC1021/AC1024/AC1027/AC1032 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/AC1032 entity style/layer color resolution is currently best-effort on some files
  • Legacy POLYLINE/VERTEX/SEQEND samples are not yet covered in AC1018 test data
  • ARC angles in raw API are radians (high‑level API converts to degrees)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ezdwg-0.3.0.tar.gz (3.2 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ezdwg-0.3.0-cp310-abi3-win_amd64.whl (453.4 kB view details)

Uploaded CPython 3.10+Windows x86-64

ezdwg-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (537.2 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

ezdwg-0.3.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (960.9 kB view details)

Uploaded CPython 3.10+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file ezdwg-0.3.0.tar.gz.

File metadata

  • Download URL: ezdwg-0.3.0.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.11.5

File hashes

Hashes for ezdwg-0.3.0.tar.gz
Algorithm Hash digest
SHA256 a6bc621e1ebe5aee0f3f457f3138a8ada8e28b1a894c087e7873b8ea48062405
MD5 41c4504658d82eb549f7abb01ef0d7b8
BLAKE2b-256 2b3803050c09f8cf4aabb3057f2d3e418b1174694ee60d174657ef67781162c0

See more details on using hashes here.

File details

Details for the file ezdwg-0.3.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: ezdwg-0.3.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 453.4 kB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.11.5

File hashes

Hashes for ezdwg-0.3.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8589953a6f606c76a58893901a7fc17787ece09ae59f1d7ed3ec72ce3782ed0e
MD5 213f9074233856fdaed3135c965f5b69
BLAKE2b-256 376f352b0a7d39ded5c3c338a65240c1f1b29bb0e824d2577d25e13161179829

See more details on using hashes here.

File details

Details for the file ezdwg-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ezdwg-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5cb78e5e889299639b2d074b7085346040ecde9ee11918ff23064208e3f10ae3
MD5 60fce3c4702788b7b950febc8fed9957
BLAKE2b-256 e404779cee3dc7c79ffb6ce55750979c9f4b70fc1ff6f55634e85c2b2576ab2a

See more details on using hashes here.

File details

Details for the file ezdwg-0.3.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for ezdwg-0.3.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 efcea91f5e512e49c128ad0b741a3146f98d02a1ff28e0399970fd7e2b7e778b
MD5 a87f06f41d2db095a69c606352d3b545
BLAKE2b-256 db1720c74e52e2bb7faf0fa018b0b2d901bf423b28036dec9a8d593e7303fb08

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page