pyboxbuilder.compartments.element.pack_into_compartment¶
-
pyboxbuilder.compartments.element.pack_into_compartment(items: Sequence[CompartmentElement | Sequence[CompartmentElement]], compartment_size: tuple[float, float], *, spacing: float =
2.0, min_spacing: float =1.5, margin: float | None =None, allow_rotate: bool =True, distribute: bool =True) tuple[CompartmentElement, ...][source]¶ Auto-lay out elements inside a fixed-size compartment interior.
Preserves the compartment’s fixed dimensions (never altering the owning box’s size) while arranging piece slots with balanced margins, divider gaps and room for
pull_outfinger access.Each entry in
itemsmay be either a standaloneCompartmentElementor a sequence(primary, child1, ...)whose trailing child elements (e.g. floor inlays or stacked Z wells) stay centered onprimaryand rotate alongside it.