Skip to main content

Python bindings for the IronStream CAD geometry kernel

Project description

ironstream (Python bindings)

PyO3 bindings for the IronStream CAD geometry kernel — a from-scratch, zero-dependency Rust port of OpenCascade.

This is one of three consumption paths off the IronStream kernel (the other two — native Rust and a WASM/TypeScript export — live elsewhere). It mirrors the kernel's OCCT-shaped prelude, in the spirit of pyOCCT: symbols are available both flat and under OCCT-style submodules.

import ironstream as ist

box = ist.make_box(ist.Pnt(0, 0, 0), 20, 20, 20)
hole = ist.make_cylinder(5, 20)
part = ist.cut(box, hole)
print(part.volume())

with open("part.stl", "wb") as f:
    f.write(ist.write_binary_stl(part.mesh()))

pyOCCT-style namespaces are also available:

from ironstream.gp import Pnt
from ironstream.prim import make_box
from ironstream.algo import cut

Layout

Namespace Contents
ironstream.gp Pnt (Vec3, Point3), Ax1, Trsf
ironstream.topods Vertex, Wire, Face, Solid, Compound
ironstream.mesh TriMesh, BBox
ironstream.prim make_box/cylinder/cone/sphere/torus/prism/revol, MeshParams
ironstream.builder make_polygon, make_face, make_face_with_holes, transform
ironstream.algo fuse, cut, common, fuse_all
ironstream.io write_binary_stl, write_ascii_stl, write_step

Development

Requires a Rust toolchain and maturin. The kernel is pulled in as a local path dependency (../ironstream), so clone both repos as siblings.

uv venv
maturin develop            # builds the kernel + binding, installs into the venv
python -c "import ironstream; print(ironstream.make_box(ironstream.Pnt(0,0,0),1,1,1).volume())"

Build a distributable wheel with maturin build --release.

Pyodide / WebAssembly

The binding also builds as a Pyodide wheel (~140 KB) that runs the whole kernel in the browser — this powers the live demo on the IronStream project page:

chmod +x scripts/build_pyodide_wheel.sh
./scripts/build_pyodide_wheel.sh    # -> dist/cadbuildr_ironstream-*-emscripten_*_wasm32.whl

The script pins the full toolchain (pyodide xbuildenv 0.29.4, emscripten 4.0.9, rust nightly-2025-02-01 + pyodide's wasm-eh sysroot) and documents why each pin exists. Load it in a page with:

const { loadPyodide } = await import("https://cdn.jsdelivr.net/pyodide/v0.29.4/full/pyodide.mjs");
const py = await loadPyodide({ indexURL: "https://cdn.jsdelivr.net/pyodide/v0.29.4/full/" });
await py.loadPackage("<url of the .whl>");
py.runPython(`import ironstream as ist; print(ist.make_sphere(10).volume())`);

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cadbuildr_ironstream-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (441.0 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

cadbuildr_ironstream-0.1.0-cp39-abi3-macosx_11_0_arm64.whl (346.6 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file cadbuildr_ironstream-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cadbuildr_ironstream-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 91508cf03081def5388dc2e5e2e5cb593f292f15d6d85b7ab284c50a52f2b0b8
MD5 41c2e4c07400dab3271f4ad6542a57c4
BLAKE2b-256 71542c1408d90341a3373de1890e9b2c7d0cd104539299c2037d30ddd058081e

See more details on using hashes here.

Provenance

The following attestation bundles were made for cadbuildr_ironstream-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-pypi.yml on cadbuildr/ironstream-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cadbuildr_ironstream-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cadbuildr_ironstream-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 734ad3ff4b2a97cdfd1f0f4342bd3e515cc5a91f58b44d7cbe5a8f314e65d026
MD5 6ab1d291d1bd337f93eb4c4206f73b5c
BLAKE2b-256 ac032e8ffabd5821ed55c21d09418f49d410c8c599460c918910d5e79f9c4b01

See more details on using hashes here.

Provenance

The following attestation bundles were made for cadbuildr_ironstream-0.1.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on cadbuildr/ironstream-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page