Skip to main content

sldkit

sldkit is an experimental, source-faithful parser for SolidWorks .SLDPRT, .SLDASM, and .SLDDRW files. The parsing core is written in Rust and exposed as a typed Python package through PyO3.

Capabilities

Capability Support
Container detection and bounded inventory Modern chunk, OLE2/CFB, and ZIP/OPC candidates
Stored and decoded stream extraction Supported where the container decoder recognizes the encoding
Exact binary-resource extraction Revalidates parser-produced path, decoded range, and SHA-256 before returning preview bytes
Modern metadata, properties, configurations, and references Partial, source-faithful profile
Typed component flags, unit settings, material labels, feature records, sheet facts, embedded virtual components Source tokens plus labelled inferences
Modern .SLDPRT B-Rep and tessellation Explicit partial profile with provenance and loss records
Saved display meshes Packed DisplayLists meshes, colors, and face outlines for Parts, Assemblies, and __ZLB OLE2 Parts without B-Rep decoding
Modern .SLDDRW source structure Exact XML record inventory plus unframed Drawing carrier candidates; no render semantics
Kernel-free geometry evaluation Sampled edge polylines, bounds, edge smoothness, and mesh quantities with explicit withheld states
Directory project graph Bounded and deterministic for decoded references, including embedded virtual components
Project index and bill of materials Reverse references across a project and occurrence expansion with quantities
Legacy OLE2/CFB metadata, properties, configurations, and previews Partial, bounded profile for observed layouts
ZIP/OPC document semantics Unsupported
Feature history, mates, and occurrence transforms Unsupported; raw transform tokens are retained as evidence
Drawing entities, dimensions, and view transforms Unsupported
Offline HTML viewer Recovered Part meshes, saved previews, and parse diagnostics

The package returns structured diagnostics and byte coverage. Missing, unsupported, malformed, and inferred source data are not collapsed into empty values or successful parses.

See the public documentation for architecture, compatibility boundaries, project scanning, and parser-rule provenance.

Python

import sldkit

probe = sldkit.probe_file("part.SLDPRT")
print(probe.envelope, probe.confidence)

inventory = sldkit.inspect_file("part.SLDPRT")
for entry in inventory.inventory.entries if inventory.inventory else ():
    print(entry.id, entry.path, entry.checksum)

entry = inventory.inventory.entries[0]
extracted = sldkit.extract_file("part.SLDPRT", entry.id)
assert extracted.data is not None

result = sldkit.parse_file("part.SLDPRT")
for config in result.document.configurations if result.document else ():
    print(config.index.value, config.name.value if config.name else None)
for prop in result.document.properties if result.document else ():
    print(prop.name.value, prop.value_state, prop.raw_value)
for diagnostic in result.diagnostics:
    print(diagnostic.code, diagnostic.kind, diagnostic.message)

for sheet in result.document.sheets if result.document else ():
    if sheet.preview is not None:
        preview = sldkit.extract_resource_file("drawing.SLDDRW", sheet.preview)
        assert preview.data is not None

geometry = sldkit.decode_geometry_file("part.SLDPRT")
if geometry.geometry is not None:
    print(len(geometry.geometry.model.bodies))
    for metric in geometry.geometry.topology_metrics:
        print(metric.body_id, metric.faces, metric.edges, metric.vertices)
    for loss in geometry.geometry.fidelity.losses:
        print(loss.code, loss.category, loss.severity)

drawing = sldkit.decode_drawing_structure_file("drawing.SLDDRW")
if drawing.structure is not None:
    for record in drawing.structure.records:
        print(record.id, record.record_class, record.source.decoded_offset)
    for carrier in drawing.structure.source_streams:
        print(carrier.stream_path, carrier.record_framing_verified)

graph = sldkit.scan_project(
    "project/top.SLDASM",
    project_root="project",
    configuration="Default",
)
for edge in graph.edges:
    print(edge.stored_path, edge.resolution_status, edge.resolved_path)

bom = sldkit.build_bom(graph)
for item in bom.part_items():
    print(item.display_name, item.key.configuration, item.quantity)

index = sldkit.index_project("project")
part = index.node_by_path("parts/bracket.SLDPRT")
if part is not None:
    for drawing in index.referencing_nodes(part.id, kind=sldkit.ReferenceKind.DRAWING_VIEW):
        print(drawing.path)

display = sldkit.decode_display_mesh_file("part.SLDPRT", profile="service")
if display.mesh is not None:
    print(display.mesh.triangle_count, len(display.positions), len(display.edges))

evaluation = sldkit.evaluate_geometry_file("part.SLDPRT", chord_tolerance_mm=0.05)
if evaluation.evaluation is not None:
    print(evaluation.evaluation.bounding_box, evaluation.evaluation.summary)

Typed component flags, document units, material labels, feature records, and sheet facts are described in document facts; geometry evaluation, saved display meshes, and project scanning cover the derived APIs.

Use strict=True with parse_file or parse_bytes when an unsupported or partial result must raise sldkit.ParseError. Geometry decoding has the same option and raises sldkit.GeometryError unless its status is decoded. Drawing structure inventory raises sldkit.DrawingStructureError in strict mode unless its status is inventoried; a partial result retains all located records and exact candidate-stream identities.

If no configuration is selected, the graph is the union of all decoded source configurations. Configuration names are matched exactly. Suppressed references are resolved but not traversed unless follow_suppressed=True is set.

The full graph contains source paths and hashes. Use the path-free aggregate when sharing compatibility results:

sldkit scan project/top.SLDASM --project-root project --summary
sldkit-rs scan project/top.SLDASM --project-root project --summary
sldkit drawing drawing.SLDDRW --limits service
sldkit display part.SLDPRT --limits service
sldkit-rs drawing drawing.SLDDRW --limits service
sldkit evaluate part.SLDPRT --chord-tolerance 0.05
sldkit index project --summary
sldkit bom project/top.SLDASM --project-root project --configuration Default --items-only
uv run python scripts/compare_drawing_structures.py baseline.SLDDRW variant.SLDDRW

Windows absolute paths are never opened as host paths on Linux or macOS. An explicit relocation can be supplied with --windows-prefix-map 'Z:\\CAD=/mnt/cad'; unresolved basename fallback remains labeled and never selects among multiple candidates.

Geometry fidelity includes verified per-domain field spans and typed/uninterpreted byte ranges. Complete byte accounting is separate from semantic geometry coverage; see geometry fidelity.

Architecture boundary

sldkit-parser uses the published Rust parasolid-core crate for embedded Parasolid headers and shared partial topology/geometry readers. No Python parasolid-kit installation or adjacent checkout is required. See the dependency boundary.

sldkit owns SolidWorks-specific parsing and source models. It does not depend on cad3d-ir, CadQuery, Open CASCADE, a vendor SDK, or COM. The opt-in Python viewer consumes public results and bundles Three.js for browser rendering. A separate adapter can depend on both sldkit and a downstream interchange model. The source distribution's optional SolidWorks capture script is controlled validation tooling; it is not imported by the package or included in wheels.

Offline viewer

sldkit view part.SLDPRT --output preview.html
sldkit view drawing.SLDDRW --output drawing.html --open

Open the generated HTML in a WebGL2-capable browser. JavaScript, meshes, and available saved previews are embedded; no server, CDN, or Node.js installation is needed to use it. Existing output requires --force.

from sldkit import decode_geometry_file
from sldkit.viewer import write_html

result = decode_geometry_file("part.SLDPRT")
write_html(result, "preview.html", title="My part")

The viewer displays only recovered meshes. A partial result may have incomplete or no geometry; saved images are labeled separately. Assembly placement and Drawing entity rendering remain unsupported. See viewer behavior.

Development

See the developer documentation for independent validation, release checks, and the development script catalog.

cargo test --workspace
CARGO_TARGET_DIR=target cargo test --locked --manifest-path vendor/cadmpeg-codec-sldprt/Cargo.toml --lib
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo +nightly fuzz run inventory -- -runs=10000
uv sync --dev
uv run maturin develop
uv run pytest
uv run ruff check .

The cross-platform wheel gate builds one CPython 3.10+ ABI3 wheel per configured OS, inspects its contents, and installs it without dependencies or an index on both Python 3.10 and 3.14 before running semantic parsing, exact-resource extraction, and project-graph smoke checks. A separate job rebuilds a Linux wheel from the source distribution and applies the same checks.

uv run --frozen maturin build --release --locked --out dist
uv run --frozen python scripts/verify_release_artifacts.py dist
uv run --frozen python scripts/smoke_wheel_artifact.py dist

To change the release version, run python scripts/bump_version.py X.Y.Z. The command updates the shared Cargo version and lockfiles; see the release guide.

License

Starting with 0.2.0, new material is source-available under PolyForm Noncommercial 1.0.0, with separate commercial licenses from UnRobotics Inc. Previously published MIT material and third-party components retain their original rights. See licensing (日本語), commercial licensing, and third-party notices. External validation inputs are excluded from distributions.

Required Notice: sldkit is licensed by UnRobotics Inc. (https://www.un-robotics.com/). Required Notice: sldkit 0.2.0 and later offer new material under PolyForm Noncommercial 1.0.0; separate commercial licenses are available.

Metadata

Release files for sldkit 0.3.1

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

Source distribution (sdist)

Source distribution for sldkit 0.3.1
File Size Uploaded Provenance Actions
sldkit-0.3.1.tar.gz 1.7 MB With provenance Details for sldkit-0.3.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for sldkit 0.3.1
File Actions
sldkit-0.3.1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for sldkit-0.3.1-cp310-abi3-win_amd64.whl
sldkit-0.3.1-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for sldkit-0.3.1-cp310-abi3-manylinux_2_28_x86_64.whl
sldkit-0.3.1-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details for sldkit-0.3.1-cp310-abi3-manylinux_2_28_aarch64.whl
sldkit-0.3.1-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for sldkit-0.3.1-cp310-abi3-macosx_11_0_arm64.whl

Total release size: 28.7 MB

Release files / sldkit-0.3.1.tar.gz

Download URL sldkit-0.3.1.tar.gz
Size 1.7 MB
Tags Source
SHA-256 checksum
How to use checksums
1577466f2e90a14aa19a292506f750b49ddfb3522e1ffbc4bc4daccf5601d412
BLAKE2b-256 checksum
How to use checksums
49a913b8d34c4d5609f111d10d1349634bb82d01563289e959598931610daedd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 23, 2026.

Transparency log

Release files / sldkit-0.3.1-cp310-abi3-win_amd64.whl

Download URL sldkit-0.3.1-cp310-abi3-win_amd64.whl
Size 6.4 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
d52cb560f2cd03bf654f2f7f838652280eb0ff938e8b79982f5165874799df6b
BLAKE2b-256 checksum
How to use checksums
e66eac1c7e9330a8da05ba1a1c49d4e1f81237758ab1778db5b72a78b70beeb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 23, 2026.

Transparency log

Release files / sldkit-0.3.1-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL sldkit-0.3.1-cp310-abi3-manylinux_2_28_x86_64.whl
Size 7.3 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
c618ab47ecbd12317751cc35f4e3f897396fd69c732ded5ecc3a5322828f0bf5
BLAKE2b-256 checksum
How to use checksums
5d68a5aca3f4d632203f482b7367520dbbf5e8b5c3a5995deba769bc368cf478
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 23, 2026.

Transparency log

Release files / sldkit-0.3.1-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL sldkit-0.3.1-cp310-abi3-manylinux_2_28_aarch64.whl
Size 7.0 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
dd933e0183d1e58e9aaddf5ea66404e3ed278a618b79f9705c47483117ca60ee
BLAKE2b-256 checksum
How to use checksums
6f39a000123bd4d61a0325591dbec7dcb2a4a7aecb8a3cf91f19996e1198a0bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 23, 2026.

Transparency log

Release files / sldkit-0.3.1-cp310-abi3-macosx_11_0_arm64.whl

Download URL sldkit-0.3.1-cp310-abi3-macosx_11_0_arm64.whl
Size 6.4 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3129e14c291f54a591a08d14746f5c34521a586719378ff10b5ed472ce296b57
BLAKE2b-256 checksum
How to use checksums
744f93e3408f9f46a1eae36a1ab77a6de4f2db0a1e9550312cc0c48c6eebb96c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 23, 2026.

Transparency log

Security for sldkit 0.3.1

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 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for sldkit-0.3.1.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 Oct 23, 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