pyboxbuilder.project.compiler.LayoutCompiler¶
- class pyboxbuilder.project.compiler.LayoutCompiler[source]¶
Bases:
objectEvaluates relative layout combinators, ratios, and 3D bin packing (FR-093).
-
classmethod arrange(manifest: ProjectManifest, layout: Node, origin: tuple[float, float, float] | None =
None) Arrangement[source]¶ Position boxes from a declarative layout tree.
- classmethod candidate_sizes(manifest: ProjectManifest, builder: BoxBuilder) list[tuple[float, float, float]][source]¶
Return Pareto-optimal
(W, L, H)envelopes for an unsized compartment box.
- classmethod min_size(manifest: ProjectManifest, builder: BoxBuilder) tuple[float, float, float][source]¶
Return the smallest compact envelope this box may take.
- classmethod resolve_final_layout(manifest: ProjectManifest) BoxPacking[source]¶
Resolve each box’s final size and packed position inside the game box.
Partition each shared compartment group across its boxes (FR-008a).
- classmethod spacer_placements(manifest: ProjectManifest, packing: BoxPacking) list[Placement][source]¶
Find leftover space in the packed layout and return spacer placements.
- classmethod standalone_size(manifest: ProjectManifest, builder: BoxBuilder) tuple[float, float, float][source]¶
Resolve a standalone box’s size and record it as its final_size.
- static check_ratios(builder: BoxBuilder) None[source]¶
Reject ratio allocations that cannot fit in the box.
Supports 1D width-ratio rows, 1D length-ratio stacks, and 2D
(width_ratio, length_ratio)grids (such astoken_tray()), where cell area shares sum to <= 1.0.
-
classmethod arrange(manifest: ProjectManifest, layout: Node, origin: tuple[float, float, float] | None =