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, plus the FaceTessellations sections and occurrence list of SOLIDWORKS 2023 and later Assemblies, 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.3

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

Built distributions (wheels)

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

Total release size: 28.8 MB

Release files / sldkit-0.3.3.tar.gz

Download URL sldkit-0.3.3.tar.gz
Size 1.7 MB
Tags Source
SHA-256 checksum
How to use checksums
ae5e5ded1aacb5769f3bde4c8b870340d850e289a7dec90838582cfca4d2d129
BLAKE2b-256 checksum
How to use checksums
a1f92f4e7adcdd0fd2b7023b7d1b374d8fa185a08b7516f905fc431d8e24a108
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 Nov 8, 2026.

Transparency log

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

Download URL sldkit-0.3.3-cp310-abi3-win_amd64.whl
Size 6.4 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
ce76259930fcef7b596794362b789ce3abb0e770a47f82f789cc36e2028de956
BLAKE2b-256 checksum
How to use checksums
827f86c42eba70cd8c1481edef4c71220b79193572d3281216196a1148862882
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 Nov 8, 2026.

Transparency log

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

Download URL sldkit-0.3.3-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
ed7ebe0ca2c8d0cc024222ac1995b38f2d7406c4bf110ddce91abc7a3392c7ea
BLAKE2b-256 checksum
How to use checksums
00f87780a8c3a6f3eeafc753c9cf8ab9d46c401fa22f38ae3ef64ab0e7c09e62
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 Nov 8, 2026.

Transparency log

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

Download URL sldkit-0.3.3-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
ee18772d259742e862dfb8f399e8b97e28038eedaedb5ff29ce619925e0dc05e
BLAKE2b-256 checksum
How to use checksums
aab63dd8e6cc66cec9b756b98ca33d9398663ffb19c5c25e42e1dd41a97e99f8
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 Nov 8, 2026.

Transparency log

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

Download URL sldkit-0.3.3-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
054cba61079212ac5253b30f722a2126488b738e4c20ee6bde962ef1401373d9
BLAKE2b-256 checksum
How to use checksums
38a62199b9c6f88b9e82a439108b3b52d36185b2d12f9bcf7d4a39a83bd08fce
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 Nov 8, 2026.

Transparency log

Security for sldkit 0.3.3

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.3.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 Nov 8, 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