Via built-ins
max_via_array
max_via_array(size: Float, space: Float, bot_enc: (Float, Float), top_enc: (Float, Float), bot: Rect, top: Rect, bot_ext_dir: Int, top_ext_dir: Int, longer: Bool, later_wins_ties: Bool) -> (Int, Int, Float, Float, Float, Float, Int, Float)
Chooses the via array with the most cuts that fits where two shapes overlap.
| Argument | Type | Requirement | Description |
|---|---|---|---|
size | Float | Required, positional | Width of a square cut. |
space | Float | Required, positional | Spacing between cuts. |
bot_enc | (Float, Float) | Required, positional | Enclosure of the cuts by the bottom shape, as (short side, long side). |
top_enc | (Float, Float) | Required, positional | Enclosure of the cuts by the top shape, as (short side, long side). |
bot | Rect | Required, positional | The bottom shape. |
top | Rect | Required, positional | The top shape. |
bot_ext_dir | Int | Required, positional | Direction of the bottom enclosure's long side: 0 for either, 1 for horizontal, 2 for vertical. |
top_ext_dir | Int | Required, positional | Direction of the top enclosure's long side, as for bot_ext_dir. |
longer | Bool | Required, positional | When a shape is too narrow for a cut, still place a row of cuts along its length rather than a single cut. |
later_wins_ties | Bool | Required, positional | Prefer the later enclosure orientation when two leave the same area outside the shapes. |
Returns (Int, Int, Float, Float, Float, Float, Int, Float). Cuts in x and y; the bottom enclosure in x and y; the top enclosure in x and y; the total number of cuts; and the enclosure area that falls outside the shapes.
It tries the four orientations of the two enclosures and keeps the one with the most cuts, then the least enclosure area outside the shapes. The array is centered on the shapes' overlap, or on bot if they do not overlap. Like a comparison, it waits until the solver has fixed both shapes and compares values snapped to the manufacturing grid.
let choice = max_via_array(170., 170., (0., 80.,), (30., 60.,), active, li, 0, 0, false, false);
let cuts = choice.6;