pyboxbuilder.compartments.element.CompartmentElement¶
-
class pyboxbuilder.compartments.element.CompartmentElement(shape_file: str | None =
None, offset: tuple[float, float] =(0.0, 0.0), rotation: float =0.0, size: tuple[float, float] | None =None, shape: ElementShape =ElementShape.SVG, depth: float | None =None, z_offset: float | None =None, corner_radius: float =2.0, corner_rounding: float =0.5, bottom_rounding: float =0.0, label: str | None =None, pull_out: bool =True, pull_out_depth: float | None =None, pull_out_width: float | None =None, color: str | None =None, count: int | None =None, component: str | None =None)[source]¶ Bases:
objectA physical game component nested inside a compartment’s bounding box.
- bounds() tuple[float, float, float, float][source]¶
Axis-aligned bounds (min_x, min_y, max_x, max_y) in the pack frame.
- translated(dx: float, dy: float) CompartmentElement[source]¶
Return a copy shifted by (dx, dy) in the pack frame.
- property base_footprint : tuple[float, float]¶
Axis-aligned (width, length) of the silhouette before rotation.
For most shapes this is just size. A hexagon is the exception: size[0] is its flat-to-flat width, exactly as RegularPolygon(width=…) reads it in the original toolkit, so it measures width / cos(30°) point-to-point across the other axis.
-
color : str | None =
None¶ When set, this element is a positive coloured insert — a thin icon pressed into the bottom of its well — instead of a cutout. The value is a web colour name, applied as the insert’s own material in mmu mode.
-
component : str | None =
None¶ Optional declared inventory component name allocated by this element well.
-
corner_rounding : float =
0.5¶ Corner rounding radius for ElementShape.RECT (default 0.5mm, 0 for sharp).
-
count : int | None =
None¶ Optional explicit count of game pieces stored in this element well.
Nonecounts as1for piece wells (and0for helper finger-bite / grab-shelf cutouts).
-
offset : tuple[float, float] =
(0.0, 0.0)¶ 2D offset (x, y) in mm of the element’s lower-left corner, relative to the compartment’s bottom-left origin.
-
pull_out : bool =
True¶ Cut a finger pull-out over this slot so the piece can be lifted out.
A silhouette slot holds its piece snugly by design — that is the point of cutting to the outline — which also means there is nowhere to get a fingertip. The pull-out is a dish across the slot, curved in from the surrounding floor so a finger slides down it and under the piece.
-
pull_out_depth : float | None =
None¶ How deep the pull-out dish goes below the slot’s own floor.
Nonetakes half the piece’s depth, which is enough to get under a piece without letting it drop into the dish and sit crooked.
-
pull_out_width : float | None =
None¶ Width of the pull-out across the slot.
Noneuses a fingertip width.
-
shape : ElementShape =
'svg'¶ Silhouette kind. Defaults to SVG, which requires shape_file.
-
shape_file : str | None =
None¶ Path to the SVG outline representing the component (ElementShape.SVG only).