pyboxbuilder.compartments.layout.layout_compartments

pyboxbuilder.compartments.layout.layout_compartments(interior: Interior, compartments: Sequence[Sequence[Any]], wall_spacing: float = 2.0, no_rotate_labels: set[str] | None = None, preserve_order: bool = False, center: bool = True) → CompartmentLayout[source]

2D layout of compartments inside the box interior with obstacle and rotation support.

Uses aligned shelf rows when compartments fit cleanly without manual obstacles, and automatically falls back to obstacle-aware 2D MaxRects Best-Short-Side-Fit when manual compartments are present or when 1D shelves fragment the space.