Skip to main content

build123d development with live preview and interactive parameters.

Project description

bdbox

build123d development with live preview and interactive parameters

License PyPI Python CI Coverage Renovate GitHub stars

Screenshot

See the documentation site for full project details!

Why?

I discovered build123d after modeling with OpenSCAD. build123d has some great advantages over OpenSCAD:

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 — no imports required:

# mymodel.py
from build123d import Box

result = Box(10, 10, 10)

Export to STEP or STL:

bdbox mymodel.py export out.step  # Export to STEP
bdbox mymodel.py export out.stl   # Export to STL

View your model in the browser with OCP CAD Viewer, started automatically:

bdbox mymodel.py view

Module paths work too:

bdbox mypackage.mymodule view
bdbox mypackage.mymodule export out.step

See more about actions in the documentation!

Interactive parameters panel

Add parameters to your model and run with view to open an interactive parameter panel in your browser. Adjust sliders, enter values, and select presets — the model re-renders automatically on every change.

See more about the parameter panel 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 to STEP or STL files using the built-in export action:

python mymodel.py export output.step  # Export to STEP
python mymodel.py export output.stl   # Export to STL

See more about parameters in the documentation!

Project template

This project is generated and maintained with copier-python.

Project details


Download files

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

Source Distribution

bdbox-0.10.0.tar.gz (180.2 kB view details)

Uploaded Source

Built Distribution

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

bdbox-0.10.0-py3-none-any.whl (135.0 kB view details)

Uploaded Python 3

File details

Details for the file bdbox-0.10.0.tar.gz.

File metadata

  • Download URL: bdbox-0.10.0.tar.gz
  • Upload date:
  • Size: 180.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bdbox-0.10.0.tar.gz
Algorithm Hash digest
SHA256 fecf2ec5d4de27250911d4fd7f6e8af6f8d7734c57d89fd442686ac4cb804ad5
MD5 029ecb539db79767133ed894b2f9c246
BLAKE2b-256 8eebeea9af41883f38c2153272aa759365774b00128d508908d58f4d8f6a2755

See more details on using hashes here.

Provenance

The following attestation bundles were made for bdbox-0.10.0.tar.gz:

Publisher: release.yaml on smkent/bdbox

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

File details

Details for the file bdbox-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: bdbox-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 135.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bdbox-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf0db5a6e5b5c9a394ec1eb2325d5f6339e2a24523517ccc325c799becc29267
MD5 54ba6b76da1ed8dbe778f13e0a195a98
BLAKE2b-256 b31fb3bde37fb2b381dab25af2b057192dfa89308a275e71b817937f8d2e9573

See more details on using hashes here.

Provenance

The following attestation bundles were made for bdbox-0.10.0-py3-none-any.whl:

Publisher: release.yaml on smkent/bdbox

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