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
Modern .SLDPRT B-Rep and tessellation Explicit partial profile with provenance and loss records
Modern .SLDDRW source structure Exact XML record inventory plus unframed Drawing carrier candidates; no render semantics
Directory project graph Bounded and deterministic for decoded references
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
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)

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-rs drawing drawing.SLDDRW --limits service
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 migration 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

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

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.2.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 sldkit 0.2.0
File Size Uploaded
sldkit-0.2.0.tar.gz 1.6 MB Details

Built distributions (wheels)

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

Total release size: 19.7 MB

Release files / sldkit-0.2.0.tar.gz

Download URL sldkit-0.2.0.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
d661b2b391474aaa88467af23ea9adb12ceed1eaa47f09c1128a634f06841a7b
BLAKE2b-256 checksum
How to use checksums
d45cd7d79074ffb64005aea03536eaea4b63a7199cabf9671983ab5583c16908
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 Sep 16, 2026.

Transparency log

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

Download URL sldkit-0.2.0-cp310-abi3-win_amd64.whl
Size 5.7 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
03a3b31b71a54c4c2b94308b9eb73d770be45e0c15fc982cc79199bc14c383ef
BLAKE2b-256 checksum
How to use checksums
c3adcb3264de80f532495a7f3bed6dacbf341c2ef949caa0fa343711d2c015ec
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 Sep 16, 2026.

Transparency log

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

Download URL sldkit-0.2.0-cp310-abi3-manylinux_2_28_x86_64.whl
Size 6.6 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
4593bce29833b8fa87b188063885d12deb29dbe984cc165b7b0973ab0d1d555a
BLAKE2b-256 checksum
How to use checksums
b0a9492e2240e56d2e464aa265e9528fa8d54a048b8c460065a8e6b1af129b70
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 Sep 16, 2026.

Transparency log

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

Download URL sldkit-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
Size 5.8 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b45d80f092bcc41d915ec689d6f57a5ff0e137a1033e826ae29f15d3fa48fc71
BLAKE2b-256 checksum
How to use checksums
1185cf9295a51994e72bd18ce2a4e242345bdde4ec8c222598be718cc8a53b80
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 Sep 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

4 release 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