Skip to main content

ezsxf

A fast SXF parser and drawing converter for Python, implemented in Rust with PyO3.

ezsxf supports both SXF formats:

  • P21 (ISO-10303-21 based)
  • SFC (SXF feature blocks)

Status

The SFC parser covers all 34 feature types in the SXF Ver.3.1 SFC specification, including resolved drawing/compound-figure/composite-curve structure. The P21 reader currently exposes the generic Part 21 entity representation.

Features

  • Parse P21 and SFC from file path, text, or bytes
  • Decode SFC files as UTF-8 or Windows Shift-JIS/CP932 without lossy replacement
  • Strict and lenient parsing modes
  • Structured parse output (header, entities, typed_features, model, warnings)
  • Resolve layer/style code tables, compound-figure placements, and hatch boundaries
  • Decode ATRF/ATRU/ATRS attribute attachments separately from drawing groups
  • Validate compound-figure placement counts, hierarchy, and drawing-group transforms
  • Convert SFC drawings to AutoCAD 2007 ASCII DXF without another runtime dependency
  • Draw SFC drawings with the optional matplotlib backend
  • Python API + CLI (ezsxf / python -m ezsxf)

Installation

python -m venv .venv
source .venv/bin/activate
pip install maturin
maturin develop

Install the plotting extra when using the matplotlib backend:

pip install ".[plot]"

Quick Start

import ezsxf

result = ezsxf.parse_sfc("./data/D0LS004ZSFC/D0LS004Z.SFC", strict=True)
print(result["format"])          # "sfc"
print(len(result["typed_features"]))
print(result["model"]["sheet"]["component_ids"])

Convert the original input or an already parsed result to DXF:

ezsxf.to_dxf("./data/D0LS004ZSFC/D0LS004Z.SFC", "drawing.dxf")

parsed = ezsxf.parse_sfc("./data/D0LS004ZSFC/D0LS004Z.SFC")
dxf_text = ezsxf.to_dxf(parsed)

Draw with matplotlib and save through the returned Axes:

ax = ezsxf.plot("./data/D0LS004ZSFC/D0LS004Z.SFC")
ax.figure.savefig("drawing.png", dpi=200, bbox_inches="tight")

Both backends share the same hierarchy, placement, layer, color, line type, line width, text, dimension, and hatch conversion. Curves are converted to polylines; use curve_segments to control the approximation resolution.

Drawing conversion currently targets SFC input. Externally defined symbols are shown as insertion markers, while externally defined and tiled hatch patterns retain only boundaries marked visible by the SXF data.

CLI

# smoke test
python -m ezsxf

# parse to JSON
python -m ezsxf parse sfc ./data/D0LS004ZSFC/D0LS004Z.SFC --pretty
python -m ezsxf parse p21 ./data/D0LS004ZP21/D0LS004Z.P21 --lenient

# convert SFC to DXF
python -m ezsxf to-dxf ./data/D0LS004ZSFC/D0LS004Z.SFC drawing.dxf

# save or interactively display a matplotlib drawing
python -m ezsxf plot ./data/D0LS004ZSFC/D0LS004Z.SFC drawing.png --dpi 200
python -m ezsxf plot ./data/D0LS004ZSFC/D0LS004Z.SFC

Development

cargo fmt --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test

# Python-level tests
python -m unittest discover -s tests -p 'test_*.py' -v

Repository Layout

  • src/*.rs: Rust parser, resolved model, and PyO3 bindings
  • src/ezsxf/: Python API, CLI, DXF writer, matplotlib backend, and stubs
  • data/: SXF sample datasets used for validation
  • resources/: SXF specification PDFs (reference only)

License

MIT License. See LICENSE.

Metadata

Release files for ezsxf 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ezsxf 0.1.0
File Size Uploaded Provenance Actions
ezsxf-0.1.0.tar.gz 71.1 kB With provenance Details for ezsxf-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for ezsxf 0.1.0
File Interpreter ABI Platform Actions
ezsxf-0.1.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for ezsxf-0.1.0-cp39-abi3-win_amd64.whl
ezsxf-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for ezsxf-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
ezsxf-0.1.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.9 abi3 macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64, macOS 10.12+ x86-64 Details for ezsxf-0.1.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Total release size: 2.1 MB

Release files / ezsxf-0.1.0.tar.gz

Download URL ezsxf-0.1.0.tar.gz
Size 71.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d4baebffbffed53fdf87ff6ac8d36662082f4029eac46ec5bcab372547c5b8ba
BLAKE2b-256 checksum
How to use checksums
149fa179ac55d43539f8bcd379965e0104b561d9d8ecbdbc863ff2e29b2de0c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.

Transparency log

Release files / ezsxf-0.1.0-cp39-abi3-win_amd64.whl

Download URL ezsxf-0.1.0-cp39-abi3-win_amd64.whl
Size 452.4 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
24f7e117a73785874e7b06ab4a95a12fe4f2120aef12d52256ca2c282f772139
BLAKE2b-256 checksum
How to use checksums
fa7c45686895f8e3a8520d5701b54ffdb8f16e7ba048d502341b8added2050b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.

Transparency log

Release files / ezsxf-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL ezsxf-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 579.5 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
5c66898290e366e97933d41ab18a65dc4dffdf537f987ec91d35db2a110ac9f1
BLAKE2b-256 checksum
How to use checksums
4fa4b0de87fcecadce9496b9c2ac8f9d05f1baeb163f7bc4a30c29305e05c875
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.

Transparency log

Release files / ezsxf-0.1.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL ezsxf-0.1.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 1.0 MB
Tags CPython 3.9 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0361322f8bd91bca77246a72deba7d5e8cffe859ccf0a47045c8aa75b9878c67
BLAKE2b-256 checksum
How to use checksums
fb4bbeded12e13f68db3ffe48a47bcadac3df354b04b2cbaf55fc938d9d84977
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.

Transparency log

Security for ezsxf 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for ezsxf-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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