pyboxbuilder.compartments.carve.build_contents

pyboxbuilder.compartments.carve.build_contents(placements: collections.abc.Sequence[CompartmentPlacement], interior: Interior, builders: dict[str, CompartmentBuilder] | None = None, clip: bool = True, top_z: float | None = None, default_side: ScoopSide | None = None, wall_tops: dict[ScoopSide, float] | None = None, mask: Bosl2Solid | None = None, hinge_intrusion: Bosl2Solid | None = None, suppress_scoops: bool = False) → Bosl2Solid | None[source]

Union the cutouts for every placed compartment. None when there are none.

Wells and finger scoops are treated differently on purpose: a well must stay inside the walls, while a scoop only works if it cuts through one. So the wells are clipped to the interior footprint and the scoops are added after.

Parameters:
placements: collections.abc.Sequence[CompartmentPlacement]

Output of layout_compartments.

interior: Interior

The box interior the placements were laid out in.

builders: dict[str, CompartmentBuilder] | None = None

Optional {label: CompartmentBuilder} so per-compartment options (rounded corners, finger scoops) are honoured.

clip: bool = True

Trim the wells to the interior footprint so none can break through a side wall (FR-018). Each well’s own rounding comes from its depth and its builder — see tray_rounding().

top_z: float | None = None

Fallback top for a scoop’s roll when wall_tops has no entry for the side it lands on.

wall_tops: dict[ScoopSide, float] | None = None

{ScoopSide: z} giving each wall’s top. The four walls do not have to end level — a sliding box’s exit wall stops a lid thickness below the rest — so the roll aligns per side.

mask: Bosl2Solid | None = None

The volume contents may occupy, when the box type has something of its own standing in the interior. A hinge box’s barrel is the case: it sits inside the outline, so the wells are clipped clear of it rather than left to collide.

default_side: ScoopSide | None = None

The box type’s preferred scoop wall, used when the compartment names none. A sliding box insists on the wall its lid leaves by; most types have no opinion and leave it to the shape.

hinge_intrusion: Bosl2Solid | None = None

Volume containing the hinge mechanism that compartments must not intersect.

suppress_scoops: bool = False

Skip generating finger scoops (e.g. for lids/closures that conflict).