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
P21andSFCfrom 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/ATRSattribute 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
matplotlibbackend - Python API + CLI (
ezsxf/python -m ezsxf)
Installation
From source (recommended currently)
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 bindingssrc/ezsxf/: Python API, CLI, DXF writer, matplotlib backend, and stubsdata/: SXF sample datasets used for validationresources/: SXF specification PDFs (reference only)
License
MIT License. See LICENSE.
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 ezsxf-0.1.0.tar.gz.
File metadata
- Download URL: ezsxf-0.1.0.tar.gz
- Upload date:
- Size: 71.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4baebffbffed53fdf87ff6ac8d36662082f4029eac46ec5bcab372547c5b8ba
|
|
| MD5 |
3efc1da4311ad5a1dfd5df1af1246dbf
|
|
| BLAKE2b-256 |
149fa179ac55d43539f8bcd379965e0104b561d9d8ecbdbc863ff2e29b2de0c4
|
Provenance
The following attestation bundles were made for ezsxf-0.1.0.tar.gz:
Publisher:
release.yml on monozukuri-ai/ezsxf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ezsxf-0.1.0.tar.gz -
Subject digest:
d4baebffbffed53fdf87ff6ac8d36662082f4029eac46ec5bcab372547c5b8ba - Sigstore transparency entry: 2209091432
- Sigstore integration time:
-
Permalink:
monozukuri-ai/ezsxf@df6e2b60943a0504331542c626120314b6659486 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/monozukuri-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@df6e2b60943a0504331542c626120314b6659486 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ezsxf-0.1.0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: ezsxf-0.1.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 452.4 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24f7e117a73785874e7b06ab4a95a12fe4f2120aef12d52256ca2c282f772139
|
|
| MD5 |
dfc1436be387acc9b76328a4be16f55a
|
|
| BLAKE2b-256 |
fa7c45686895f8e3a8520d5701b54ffdb8f16e7ba048d502341b8added2050b9
|
Provenance
The following attestation bundles were made for ezsxf-0.1.0-cp39-abi3-win_amd64.whl:
Publisher:
release.yml on monozukuri-ai/ezsxf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ezsxf-0.1.0-cp39-abi3-win_amd64.whl -
Subject digest:
24f7e117a73785874e7b06ab4a95a12fe4f2120aef12d52256ca2c282f772139 - Sigstore transparency entry: 2209091488
- Sigstore integration time:
-
Permalink:
monozukuri-ai/ezsxf@df6e2b60943a0504331542c626120314b6659486 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/monozukuri-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@df6e2b60943a0504331542c626120314b6659486 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ezsxf-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: ezsxf-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 579.5 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c66898290e366e97933d41ab18a65dc4dffdf537f987ec91d35db2a110ac9f1
|
|
| MD5 |
a46ba076b551682a2ece55df09cf02a0
|
|
| BLAKE2b-256 |
4fa4b0de87fcecadce9496b9c2ac8f9d05f1baeb163f7bc4a30c29305e05c875
|
Provenance
The following attestation bundles were made for ezsxf-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on monozukuri-ai/ezsxf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ezsxf-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
5c66898290e366e97933d41ab18a65dc4dffdf537f987ec91d35db2a110ac9f1 - Sigstore transparency entry: 2209091464
- Sigstore integration time:
-
Permalink:
monozukuri-ai/ezsxf@df6e2b60943a0504331542c626120314b6659486 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/monozukuri-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@df6e2b60943a0504331542c626120314b6659486 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ezsxf-0.1.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: ezsxf-0.1.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.9+, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0361322f8bd91bca77246a72deba7d5e8cffe859ccf0a47045c8aa75b9878c67
|
|
| MD5 |
f58191d86a7a7c6fb31bd4ddbd336b23
|
|
| BLAKE2b-256 |
fb4bbeded12e13f68db3ffe48a47bcadac3df354b04b2cbaf55fc938d9d84977
|
Provenance
The following attestation bundles were made for ezsxf-0.1.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:
Publisher:
release.yml on monozukuri-ai/ezsxf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ezsxf-0.1.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl -
Subject digest:
0361322f8bd91bca77246a72deba7d5e8cffe859ccf0a47045c8aa75b9878c67 - Sigstore transparency entry: 2209091507
- Sigstore integration time:
-
Permalink:
monozukuri-ai/ezsxf@df6e2b60943a0504331542c626120314b6659486 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/monozukuri-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@df6e2b60943a0504331542c626120314b6659486 -
Trigger Event:
push
-
Statement type: