This release is a pre-release and may not be stable for production use.
solidfunc
solidfunc is a typed, functional Python library for code-based CAD, built on SolidCore, a B-rep geometry kernel written in Rust. You build solids from primitives and planar profiles, place and combine them, select faces and edges, round and chamfer edges, and export STEP files for use in other CAD tools.
Install
pip install solidfunc
Wheels are available for Linux, macOS, and Windows on Python 3.11 and later.
To try it without installing anything, open the example notebook in Colab:
A first part
A plate with a hole whose rim is rounded, exported as STEP:
import solidfunc as sf
plate = sf.box(size_x=80, size_y=50, size_z=10)
hole = sf.cylinder(diameter=20, height=10)
part = plate - hole
top = max(sf.faces(part), key=lambda face: face.centroid[2])
hole_edge = [edge for edge in sf.edges(top) if edge.kind == "circle"]
part = sf.fillet(part, hole_edge, radius=2.0)
print(f"{sf.volume(part):.3f} mm³")
sf.export_step(part, "plate.step")
Every operation returns a new value and leaves its inputs unchanged. Lengths are in millimetres and angles in degrees. Selection is plain Python over typed face and edge data. See the API reference for signatures and conventions.
Gallery
Parts from the chapters of CAD as Code, rebuilt in solidfunc.
Clutch brick: studs placed on the top face with place() |
Battery tray: cell pockets, mirrored holes, and a lead-in round selected by radius |
| Swept elbow: a hollow section swept along a cornered path | Duct: a loft from a circle to a rectangle |
Viewing parts
In Jupyter, VS Code, and other notebook frontends, a shape at the end of a cell displays itself as an interactive 3D view, with a static image where scripts can't run.
Outside notebooks, install PyVista with pip install pyvista,
then call show():
from solidfunc.view import show
show(part)
Pass screenshot="part.png" to save a PNG. In Jupyter, show() displays a
static preview by default. For an interactive view, install pyvista[jupyter]
and pass jupyter_backend="client".
About this project
Motivation
The best-known open-source code-CAD libraries for Python, CadQuery and build123d, are built on the OpenCascade Technology (OCCT) kernel. SolidCore started as a Rust port of SMLib, the NURBS B-rep kernel that NVIDIA published as part of USD BRep, and has diverged from it since. solidfunc asks how much of a parametric code-CAD API depends on its kernel, and which of its ideas are properties of OCCT rather than of code-CAD in general.
Scope
solidfunc is a small academic experiment, not a replacement for CadQuery or build123d. For real work, use one of them. My book CAD as Code uses CadQuery's functional API throughout, and the first part above comes from chapter 2. solidfunc borrows many ideas from CadQuery and build123d.
Findings
- SolidCore builds solids from geometric sketch records (segments, loops,
regions), not from OCCT's topological edges and wires. solidfunc's
Curve2D,Path2D, andProfilemirror those records, and topology (Face,Edge,Vertex) only exists inside a solid. - SolidCore stores a round on a straight edge as a cone with a zero
half-angle, and
revolveproduces B-spline surfaces even for a cone or a sphere. solidfunc reports the first as a cylinder and documents the second, so selection by surface type depends on how the kernel stores surfaces. - SolidCore's booleans consume their operands, so solidfunc copies its inputs to keep every value unchanged.
- SolidCore unites many bodies in one call, which became
union(*shapes).
Coverage
solidfunc builds single solids from primitives, extrusions, revolutions, lofts, and sweeps, with booleans, placement, fillets and chamfers, face and edge queries, and STEP import and export. Assemblies, colours, open sheets and shells, and 2D operations on profiles are outside its scope. Releases are alphas, and the API can change between them.
Development
The repository includes a dev container in
.devcontainer/ with the pinned Python and Rust toolchains, uv, and the
OCP CAD Viewer extension. Opening the repository in it builds solidfunc
and installs CadQuery for the STEP exchange tests.
To build from source without it, install uv and Rust, then run from the cloned repository:
uv sync --locked --config-setting build-args=--profile=dev
uv run --no-sync pytest
uv run --no-sync python examples/hello_world.py
examples/render_gallery.py regenerates the gallery images.
Citing
If you use solidfunc in your work, please cite it; GitHub's "Cite this repository" button gives the reference from CITATION.cff.
License
solidfunc is MIT licensed. SolidCore and the SMLib code it derives from (USD BRep) are Apache-2.0 licensed. The distribution includes the corresponding upstream notices. solidfunc is not affiliated with or endorsed by NVIDIA.
Metadata
Release files for solidfunc 0.1.0a5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| solidfunc-0.1.0a5.tar.gz | 233.0 kB | Without provenance | Details for solidfunc-0.1.0a5.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| solidfunc-0.1.0a5-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details for solidfunc-0.1.0a5-cp311-abi3-win_amd64.whl |
| solidfunc-0.1.0a5-cp311-abi3-manylinux_2_28_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.28+ x86-64 | Details for solidfunc-0.1.0a5-cp311-abi3-manylinux_2_28_x86_64.whl |
| solidfunc-0.1.0a5-cp311-abi3-manylinux_2_28_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.28+ ARM64 | Details for solidfunc-0.1.0a5-cp311-abi3-manylinux_2_28_aarch64.whl |
| solidfunc-0.1.0a5-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details for solidfunc-0.1.0a5-cp311-abi3-macosx_11_0_arm64.whl |
| solidfunc-0.1.0a5-cp311-abi3-macosx_10_12_x86_64.whl | CPython 3.11 | abi3 | macOS 10.12+ x86-64 | Details for solidfunc-0.1.0a5-cp311-abi3-macosx_10_12_x86_64.whl |
Total release size: 83.9 MB
Release files / solidfunc-0.1.0a5.tar.gz
| Download URL | solidfunc-0.1.0a5.tar.gz |
|---|---|
| Size | 233.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2d32f99af04b53e137e8332ffce1fdb4aec74d7c83651d00916cb1466b606b0a
|
|
BLAKE2b-256 checksum How to use checksums |
344a76de28071d43ec5e2410db14431a5e1f7eef420e4cf012561b9dc8884524
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / solidfunc-0.1.0a5-cp311-abi3-win_amd64.whl
| Download URL | solidfunc-0.1.0a5-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 16.7 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
3f79f3c94ff010b256ae7f97ddfd7fc5bf0ee9956cc96d8a46d5348729f89afd
|
|
BLAKE2b-256 checksum How to use checksums |
3b4e656a2f93906ebc17f7be9ced9097d9e1048e6f18b9beba96089275985318
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / solidfunc-0.1.0a5-cp311-abi3-manylinux_2_28_x86_64.whl
| Download URL | solidfunc-0.1.0a5-cp311-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 17.8 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
5849d53aad83fd9d6ee8756fddd958b529df6bd25fef43d309e0f2c9b766a4e2
|
|
BLAKE2b-256 checksum How to use checksums |
018d0e2b624176dc4b419363644c07a8ce90f844de1705b6634f14a35366eb54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / solidfunc-0.1.0a5-cp311-abi3-manylinux_2_28_aarch64.whl
| Download URL | solidfunc-0.1.0a5-cp311-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 16.2 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
1867d9e46892aa67a2516d62b8dc5faf01fad5cc5e730b3afaab4fddb1bea9f1
|
|
BLAKE2b-256 checksum How to use checksums |
dbf906d2c2a02e1959d004cc084d249b2f37612c33a807fe71a67284f188be24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / solidfunc-0.1.0a5-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | solidfunc-0.1.0a5-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 15.5 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
804f6d056d2f058b4873d1de43ea5f7ed4e2596e3ca70a0130bf6a1e4ac0b05a
|
|
BLAKE2b-256 checksum How to use checksums |
ea01c0c8fcc3c8e32a4d4b259d9e51a655e30704a1e6f59f6c5504f363cb2243
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / solidfunc-0.1.0a5-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | solidfunc-0.1.0a5-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 17.5 MB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
e9e78aba2d49b0478889efbd8f81e2e85582fa3a5e64e7d61798ec30860d80dc
|
|
BLAKE2b-256 checksum How to use checksums |
e2672dbe7ad291c1a9f7fe328598176ab2fa1d0f85c6db6f8b45ddc11e400036
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for solidfunc 0.1.0a5
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.