Skip to main content

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

Project description

ezdwg

PyPI version

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 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 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/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.2.0.tar.gz (1.0 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.2.0-cp310-abi3-win_amd64.whl (395.4 kB view details)

Uploaded CPython 3.10+Windows x86-64

ezdwg-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (481.6 kB view details)

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

ezdwg-0.2.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (858.6 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.2.0.tar.gz.

File metadata

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

File hashes

Hashes for ezdwg-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a0854e45a94d6e28c44e34e94d2a49c5b4b95a0e945c760bdaba077c8f831f44
MD5 6390bac6743e4578a9d6b989d8d7d18e
BLAKE2b-256 009d669601cb25fbeccf2d7eff21201627c91a672ed638cee1ff979fb12aa62c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ezdwg-0.2.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 395.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.2.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 07d690acef0bc0ad836ca83bf1dfbec870b12de1889bd2ced209be1421ed5366
MD5 727233ea37eb35875672a34b4255a647
BLAKE2b-256 1e1690b1e844517e71fbff4625f3bac69e3d17afa5779c220ef898631dc30f10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ezdwg-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7ef43e4afa92e73b51cfb2fc72475ae981f057a6c77652f24508666c5874fe42
MD5 47dd5fce64f27e5c17467cf0f1859f64
BLAKE2b-256 59f003903179361f0ff2bc4fb58cd603e0586b8d5a7649806502b16edcdd7107

See more details on using hashes here.

File details

Details for the file ezdwg-0.2.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.2.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 6fa90174b34f3dd175840bc0c28b1d6c2dddd152f860f03a31e4b67c8647760d
MD5 77f17b7f5fde18019393d3c8ca7d82df
BLAKE2b-256 7a0909a25041f43969ecad84ed2fa3308983adf5d313fc975098b46ef0f6968e

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