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

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.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.3.0
File Size Uploaded Provenance Actions
sldkit-0.3.0.tar.gz 1.7 MB With provenance Details for sldkit-0.3.0.tar.gz

Built distributions (wheels)

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

Total release size: 21.7 MB

Release files / sldkit-0.3.0.tar.gz

Download URL sldkit-0.3.0.tar.gz
Size 1.7 MB
Tags Source
SHA-256 checksum
How to use checksums
9751dde60a733bd0a51624a5ae5a74158bbf1978bfb5fb44452bd51808b23f5a
BLAKE2b-256 checksum
How to use checksums
565404c0398c0a7e82d4f0639f79c6a9e688e5e463edffdbba63518942cd0f67
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.0-cp310-abi3-win_amd64.whl

Download URL sldkit-0.3.0-cp310-abi3-win_amd64.whl
Size 6.4 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
f2d1b653350987daa370157c12c5e721f250abab7f3bd4125a4773cb75157b96
BLAKE2b-256 checksum
How to use checksums
3c8a00ede758181c38783270f9a5560c650c54a7ff498b5154fbac187b46bc08
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.0-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL sldkit-0.3.0-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
406f2a2ceac934d5e96fbe5d2a22f3efea84462035b995448f0b7722d615a288
BLAKE2b-256 checksum
How to use checksums
1d8f290c0ba1fd16ab0f747faedcfd01192734d8665b43f034b7d6981b911094
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.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL sldkit-0.3.0-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
9bf70abf2cad3684a448e3c3ca50dbe8f78019525f1da47853d881a7115ff691
BLAKE2b-256 checksum
How to use checksums
511b658e62fecb51ebfdb99b0fff692e8309aeb4dac5b53402ec2743e1d14f02
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.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 sldkit-0.3.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 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