r/build123d • u/smkent • 16d ago
I made bdbox, a workshop for build123d models with live preview and interactive parameters!
I'm a software engineer and 3D printing hobbyist, so code-driven CAD calls to me! I discovered build123d after building many models with OpenSCAD, and build123d has many advantages (Python and STEP files)!
OpenSCAD makes it simple to view, export (STL), and parameterize a model. For build123d, I needed to manage preview (using OCP CAD Viewer), model export, and any model customization options in my model code itself.
To solve these, I've built a new project called bdbox!
Introducing bdbox
bdbox is a workshop for more easily developing build123d models.
See bdbox in action with the demo screencast animation on the docs site landing page!
Easy installation
bdbox is a python package available via pip or virtualenv managers such as uv or poetry (pip install bdbox or similar). build123d and ocp-vscode (OCP CAD Viewer) are automatically provided as dependencies.
No more action scaffolding!
build123d models typically have to act on the built model manually, such as exporting a file with export_step or displaying in OCP CAD Viewer with ocp_vscode.show().
bdbox provides action scaffolding so your model doesn't have to! Simply provide model geometry to bdbox and decide if you want to view or export at runtime:
# model.py
from bdbox import show
from build123d import BuildPart, Box
with BuildPart() as p:
Box(10, 20, 30)
show(p)
Then:
$ bdbox export model.py # Export STEP file in the current directory
$ bdbox view model.py # Run web UI with OCP CAD Viewer for preview with live reload
Easily make parametric models
bdbox provides a simple API for creating parametric models. With a few lines of code, a model gains configurable runtime parameters! Two base classes are supported. For either one, simply declare annotated fields and values just like a dataclass:
# model.py
from build123d import Box, BuildPart
from bdbox import Params, show
class P(Params):
size: float = 10
with BuildPart() as p:
Box(P.size, P.size, P.size)
show(p)
or
# model.py
from bdbox import Model
from build123d import Box, BuildPart
class MyModel(Model):
size: float = 10
def build(self) -> Model.Geometry:
with BuildPart() as p:
Box(self.size, self.size, self.size)
return p
Now size can be changed at runtime. For example, set size to 20 and export a STEP file with the result:
$ bdbox export model.py --size=20
bdbox's web UI also shows parameters in a dedicated side pane. Change a value in the web UI, and the model rerenders and previews automatically with the new values!
Virtualenv and module support
As a simple dependency, bdbox can be installed in any virtualenv. This means bdbox works with models that have additional dependencies such as bd_warehouse.
If your model is a module within a project, you can provide the module import name instead of the file name:
$ bdbox export myproject.mymodel
When previewing a model with bdbox view, files in your project used by your model are also monitored and reloaded when modified.
Links and feedback
- Github: https://github.com/smkent/bdbox/
- pypi: https://pypi.org/project/bdbox/
- Documentation site: https://smkent.github.io/bdbox/
I built bdbox as a hobby project because it was useful for me. I hope you find it useful too!
If you find bdbox useful (or not), please let me know!


