pyboxbuilder.packing.spacer

Spacer tray generation — fill leftover space with minimal, hole-free, supported trays.

Four stages (FR-014, FR-014a/b/c, FR-018):

  1. Sweep the game box for empty volume using an axis-unbiased 3D histogram maximal-empty-cuboid DP ($O(N_x N_y N_z^2)$), extracting the globally largest empty cuboid at every step regardless of axis orientation.

  2. Merge adjacent cuboids whose union is itself a cuboid via indexed face matching to a deterministic fixed point.

  3. Rectilinear polygon merge of coplanar same-Z neighbors into L/T/U PathBox footprints, automatically splitting genus >= 1 ring/donut frames around interior boxes so no spacer ever swallows an enclosed box.

  4. Support & clearance filter shrinking footprints by clearance and verifying both vertical support from below and minimum printable thickness.

Classes

SpacerSpec

Configuration for a single spacer tray.

Void

An empty region: a box, or a prism over a non-rectangular footprint.

Functions

apply_clearance

Shrink a void by slack on every horizontal side so the tray lifts out freely.

generate_spacer_placements

generate_spacer_voids as Placement`s named `spacer_1..spacer_N.

generate_spacer_voids

Sweep, merge, split holes, verify support, shrink and filter — the whole spacer pass.

generate_spacers

Generate spacer tray specs for gaps left at the end of 2D rows.

merge_rectilinear

Fuse coplanar same-Z neighbours into polygon-footprint trays, splitting holes (FR-018).

merge_voids

Fuse mergeable voids deterministically using orthogonal face-bucket indexing (FR-014b).

sweep_free_space

Decompose the space no placement occupies into disjoint boxes, largest first.

union_outline

Trace the single genus-0 outline of a union of axis-aligned footprints.