Skip to content

Geometry

Show dataclass

Show(func: ShowCallable)

Extensions for show.

__add__

__add__(geometry: GeometryT) -> GeometryT

Highlight the specified geometry.

Source code in bdbox/geometry/show.py
60
61
62
63
64
65
66
67
68
def __add__(self, geometry: GeometryT) -> GeometryT:
    """Highlight the specified geometry."""
    if geo := run_state.geometry.filter_geometry(geometry):
        from build123d import Color  # noqa: PLC0415

        geo.label = "bdbox highlight"
        geo.color = Color(0xFF2351, 0x66)
        self.func(geo)
    return geometry

__floordiv__

__floordiv__(geometry: GeometryT) -> GeometryT

Show only the specified geometry, and stop model execution.

Source code in bdbox/geometry/show.py
55
56
57
58
def __floordiv__(self, geometry: GeometryT) -> GeometryT:
    """Show only the specified geometry, and stop model execution."""
    run_state.geometry.__init__()
    return self.__truediv__(geometry)

__truediv__

__truediv__(geometry: GeometryT) -> GeometryT

Show the specified geometry, and stop model execution.

Source code in bdbox/geometry/show.py
48
49
50
51
52
53
def __truediv__(self, geometry: GeometryT) -> GeometryT:
    """Show the specified geometry, and stop model execution."""
    if geo := run_state.geometry.filter_geometry(geometry):
        geo.label = "bdbox selection"
        self.func(geo)
    raise ModelExit

show

show(
    *geometry: Compound
    | Shape
    | Builder
    | Sequence[Compound | Shape | Builder | None]
    | Mapping[str, Compound | Shape | Builder | None]
    | None,
) -> None

Provide built model geometry for display or use.

Info

With a Params subclass, call show with your built model geometry. Multiple show calls accumulate geometry in order.

With a Model subclass, return geometry from the build method instead of calling show.

Note

If show() is never called, bdbox falls back to scanning the script's globals for build123d.Shape instances, but calling show() manually is recommended.

Source code in bdbox/geometry/show.py
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
@Show
def show(
    *geometry: Compound
    | Shape
    | Builder
    | Sequence[Compound | Shape | Builder | None]
    | Mapping[str, Compound | Shape | Builder | None]
    | None,
) -> None:
    """Provide built model geometry for display or use.

    Info:
        With a [``Params``][bdbox.model.parameters.Params] subclass,
        call `show` with your built model geometry. Multiple `show` calls
        accumulate geometry in order.

        With a [``Model``][bdbox.model.model.Model] subclass, return geometry
        from the [``build``][bdbox.model.model.Model.build] method instead of
        calling `show`.

    Note:
        If ``show()`` is never called, bdbox falls back to scanning the
        script's globals for [``build123d.Shape``][topology.Shape] instances,
        but calling ``show()`` manually is recommended.
    """
    return run_state.geometry.accumulate_geometry(*geometry)