Skip to main content

ezdwg

PyPI version

DWG (R14-R2018 / AC1014-AC1032) reader with a Python API inspired by ezdxf. This project is a DWG read-focused parser with growing high-level entity coverage while providing a native AC1015 writer for basic entities.

Documentation: https://monozukuri-ai.github.io/ezdwg/

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 include LINE, ARC, LWPOLYLINE, POINT, CIRCLE, ELLIPSE, TEXT, MTEXT, DIMENSION, INSERT/MINSERT, HATCH, and SPLINE
  • Raw API exposes the corresponding entity decoders plus low-level POLYLINE/VERTEX helpers
  • Output units/angles: high-level API returns ARC angles in degrees

Install

Install from PyPI:

pip install ezdwg

Plotting (optional):

pip install "ezdwg[plot]"

DWG to DXF conversion (optional, ezdxf backend):

pip install "ezdwg[dxf]"

If you want to contribute or develop locally, you can install from source: Rust toolchain is required (PyO3 build).

git clone https://github.com/monozukuri-ai/ezdwg.git
cd ezdwg
maturin develop
pip install -e .

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 INSERT MINSERT HATCH SPLINE"
):
    print(e.dxftype, e.handle, e.dxf)

Drawing units and header variables:

import ezdwg

doc = ezdwg.read("path/to/file.dwg")
doc.units                        # "millimeters" ($INSUNITS; None for R14)
doc.header_variables()["extmin"]  # model-space extents, unit formats, ...

Plot in matplotlib:

import ezdwg

doc = ezdwg.read("path/to/file.dwg")
doc.plot()

CLI

uvx ezdwg --version
uvx ezdwg inspect examples/data/line_2000.dwg
uvx ezdwg inspect examples/data/line_2000.dwg --verbose
uvx --from "ezdwg[dxf]" ezdwg convert examples/data/line_2000.dwg /tmp/line_2000_out.dxf
uvx --from "ezdwg[dxf]" ezdwg convert examples/data/arc_2000.dwg /tmp/arc_2000_out.dxf --types "ARC" --dxf-version R2010
uvx ezdwg write examples/data/line_2000.dwg /tmp/line_2000_out.dwg --types "LINE" --dwg-version AC1015

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")

DWG to DWG (Native AC1015 Writer)

import ezdwg

result = ezdwg.to_dwg(
    "examples/data/line_2000.dwg",
    "/tmp/line_2000_rewrite.dwg",
    version="AC1015",
)
print(result)

Or from an already opened document/layout:

doc = ezdwg.read("examples/data/line_2000.dwg")
doc.export_dwg("/tmp/line_2000_rewrite.dwg", version="AC1015")

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

  • Native DWG write currently targets AC1015 only
  • Native DWG write supports a subset of entities: LINE/RAY/XLINE/POINT/ARC/CIRCLE/LWPOLYLINE/TEXT/MTEXT
  • 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)

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.11.1.tar.gz (261.7 kB view details)

Uploaded Source

Built Distributions

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

ezdwg-0.11.1-cp310-abi3-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.10+Windows x86-64

ezdwg-0.11.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

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

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

File metadata

  • Download URL: ezdwg-0.11.1.tar.gz
  • Upload date:
  • Size: 261.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for ezdwg-0.11.1.tar.gz
Algorithm Hash digest
SHA256 d11f7dbb39e9d3ddea7038105857ea2068ce796a8257e37e6a41867a5ca75ae5
MD5 9252ca65dcaaac948856582436210b21
BLAKE2b-256 97d5b75f9b07bf5501c4d42e49e4bc940e4adaf1c3465bb08df8819c5b2ba232

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ezdwg-0.11.1-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for ezdwg-0.11.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 80551a375e1c7873b5b9840744618e06bd1bb86ceb4025e8cd129bc4761741cc
MD5 2d15e7eae6faaae6b7d6158039840263
BLAKE2b-256 84d9fbb6884396275a149e2b95fd6798f1b8269a6b761ecac57b890cc88a0176

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ezdwg-0.11.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 94b64cafa7925a94874588c639ed9ee0bb6e71bb93de6ec43969db05e4604056
MD5 cd4d5d146bb16d3492f5b175bebc4347
BLAKE2b-256 2df67981f159d16c826d8977c8825a07a316e0cf21edeeb3888ba88bc1c743f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ezdwg-0.11.1-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 2045b3e6e2f1b7217bb1052074fc9c9d4170e9fc602abc677f7f0cf9ffb29f8d
MD5 d4b3d3dc0cb028cdb8c1a2077d60e805
BLAKE2b-256 d5a3d4ed5e95a14b39cfd1aec5476674de19fb8443401b06308e755328e1cac7

See more details on using hashes here.

Release history Release notifications | RSS feed

0.12.7

4 files

0.12.6

4 files

0.12.5

4 files

0.12.4

4 files

0.12.3

4 files

0.12.2

4 files

0.12.1

4 files

0.12.0

4 files

This release

0.11.1 This release

4 files

0.11.0

4 files

0.10.0

4 files

0.9.0

4 files

0.8.1

4 files

0.8.0

4 files

0.7.0

4 files

0.6.0

4 files

0.5.0

4 files

0.4.0

4 files

0.3.0

4 files

0.2.0

4 files

0.1.0

4 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page