build123d development with live preview and interactive parameters.
Project description
bdbox
build123d development with live preview and interactive parameters
See the documentation site for full project details!
Why?
I discovered build123d after modeling with OpenSCAD. build123d has some great advantages over OpenSCAD:
- Better geometry (STEP file export) than OpenSCAD's mesh of vertexes
- Common CAD operations like
chamferandfilletare simple - build123d models are Python programs, whereas OpenSCAD uses its own modeling language
Comparatively, build123d's development experience was lacking. OpenSCAD previews a model on save or hotkey, makes exporting a model render simple, and even provides a GUI for setting toplevel variables! I started with some self-made tooling to work around these drawbacks, but having to remember how to use and maintain it resulted in me working on models less.
I built bdbox to be the missing tool I wanted: Let models just define
their geometry plus optional parameters, and let bdbox handle everything
else!
See more background info in the documentation!
Installation
Install user-wide with uv or pipx for use across all
projects:
uv tool install bdbox
pipx install bdbox
Install in any environment where pip is available:
pip install bdbox
Installation in projects
Install in a project, such as with uv or poetry:
uv add bdbox
poetry add bdbox
bdbox detects and automatically uses virtual environments also containing
bdbox.
This enables running via bdbox model.py instead of uv run bdbox model.py,
for example.
Works with any build123d model
Use bdbox with any existing build123d script:
# mymodel.py
from build123d import Box
result = Box(10, 10, 10)
Export geometry files:
bdbox mymodel.py export # Export STEP files to current directory
bdbox mymodel.py export output/ # Export STEP files to output/
bdbox mymodel.py export -f stl # Export STL files to current directory
View your model using the web UI, which includes OCP CAD Viewer and an interactive parameters panel:
bdbox mymodel.py view
Module paths work too:
bdbox mypackage.mymodule view
bdbox mypackage.mymodule export
See more about actions in the documentation!
Add parameters
Declare typed parameters with defaults and constraints:
from bdbox import Float, Int, Params, Preset, show
from build123d import Box
class P(Params):
width = Float(10.0, min=5, max=100)
length = Float(20.0, min=5, max=100)
thickness = Int(2, min=1, max=10)
presets = (
Preset("small", width=5.0, length=8.0),
Preset("large", width=80.0, length=40.0, thickness=5),
)
result = Box(P.width, P.length, P.thickness)
show(result)
Or inherit from Model for reusable, importable models:
from bdbox import Float, Int, Model, Preset
from build123d import Box
class MyModel(Model):
width = Float(10.0, min=5, max=100)
length = Float(20.0, min=5, max=100)
thickness = Int(2, min=1, max=10)
presets = (
Preset("small", width=5.0, length=8.0),
Preset("large", width=80.0, length=40.0, thickness=5),
)
def build(self):
return Box(self.width, self.length, self.thickness)
Parameters become CLI flags automatically:
python mymodel.py # Run with default values
python mymodel.py view # View with live reload and parameter panel
python mymodel.py --width 50 # Override a field value
python mymodel.py --preset large # Apply a named preset
python mymodel.py --help # Usage info with all parameters
Export geometry files using the built-in export action:
python mymodel.py export # Export STEP files to current directory
python mymodel.py export -f stl # Export STL files to current directory
See more about parameters in the documentation!
Project template
This project is generated and maintained with copier-python.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bdbox-0.18.1.tar.gz.
File metadata
- Download URL: bdbox-0.18.1.tar.gz
- Upload date:
- Size: 324.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e5b0a384350289e0a1cb10deaf72a894172d79bb9f1b37b121ed33154edd817
|
|
| MD5 |
e684fb1fe6b02473f76dd8798747a391
|
|
| BLAKE2b-256 |
603ce2b2c0a6dcb8b8f0ff4107fd20ed239f50eb8edcbcb76d551b75b4d68b6f
|
Provenance
The following attestation bundles were made for bdbox-0.18.1.tar.gz:
Publisher:
release.yaml on smkent/bdbox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bdbox-0.18.1.tar.gz -
Subject digest:
2e5b0a384350289e0a1cb10deaf72a894172d79bb9f1b37b121ed33154edd817 - Sigstore transparency entry: 1763013266
- Sigstore integration time:
-
Permalink:
smkent/bdbox@ac47d2d372c4e3207d3052c22a09a7e41f59b585 -
Branch / Tag:
refs/tags/v0.18.1 - Owner: https://github.com/smkent
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@ac47d2d372c4e3207d3052c22a09a7e41f59b585 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bdbox-0.18.1-py3-none-any.whl.
File metadata
- Download URL: bdbox-0.18.1-py3-none-any.whl
- Upload date:
- Size: 265.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f959b981ab7087b0be45c5588cc01aa65c39166b371ae23e1969ee3c9f9b9d77
|
|
| MD5 |
f685f7514e75ae7e3c8f92dd8d0691c3
|
|
| BLAKE2b-256 |
56845d6f18f32ae84a38ef9032d48ed59839dc2eb8e7d219e1c3df18f99856f0
|
Provenance
The following attestation bundles were made for bdbox-0.18.1-py3-none-any.whl:
Publisher:
release.yaml on smkent/bdbox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bdbox-0.18.1-py3-none-any.whl -
Subject digest:
f959b981ab7087b0be45c5588cc01aa65c39166b371ae23e1969ee3c9f9b9d77 - Sigstore transparency entry: 1763013406
- Sigstore integration time:
-
Permalink:
smkent/bdbox@ac47d2d372c4e3207d3052c22a09a7e41f59b585 -
Branch / Tag:
refs/tags/v0.18.1 - Owner: https://github.com/smkent
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@ac47d2d372c4e3207d3052c22a09a7e41f59b585 -
Trigger Event:
push
-
Statement type: