Actions¶
bdbox provides actions for your build123d models!
-
Easily view or export models with
bdbox! -
Regular build123d models must both build and determine how to use model geometry.
-
With
bdbox, a model only needs to build its geometry, leavingbdboxto perform actions on that geometry. -
Optionally specify model geometry, or let
bdboxlocate model geometry from a model's global variables automatically.
Available actions¶
| Action | Description |
|---|---|
export |
Export model geometry to a STEP or STL file |
view |
View model geometry with OCP CAD Viewer |
run (default) |
No geometry processing. Model is responsible for using its own geometry. |
Invocation modes¶
Actions work the same way whether models are run with bdbox or directly, with
file names or module paths.
Info
Module paths must be importable from the current working directory or Python path.
Using bdbox¶
The bdbox command works with any build123d model, including models without
any bdbox imports:
bdbox model.py # Run (default)
bdbox model.py view # View in OCP CAD Viewer
bdbox model.py export output.step # Export to STEP
or with a module:
bdbox mypackage.mymodule # Run (default)
bdbox mypackage.mymodule view # View in OCP CAD Viewer
bdbox mypackage.mymodule export output.step # Export to STEP
A specific Model subclass within a module may be
selected:
bdbox mypackage.mymodule:MyModel # Run (default)
bdbox mypackage.mymodule:MyModel view # View in OCP CAD Viewer
bdbox mypackage.mymodule:MyModel export output.step # Export to STEP
Virtual environment discovery
When bdbox is invoked with a model file in a
virtual environment also containing bdbox, the model's
virtual environment is used automatically.
Direct¶
The CLI is automatically provided on any model with a
Params or
Model subclass. Run the model file itself to use
the CLI:
python model.py # Run (default)
python model.py view # View in OCP CAD Viewer
python model.py export output.step # Export to STEP
or with a module:
python -m mypackage.mymodule # Run (default)
python -m mypackage.mymodule view # View in OCP CAD Viewer
python -m mypackage.mymodule export output.step # Export to STEP