Files
OpenNest/docs/irregular-stock.md
T
ajandClaude Fable 5.2 f5fae5c9e1 fix(plate): pushes stop at an outlined sheet's edge; outline import keeps straight edges exact
A plate with a custom outline was pushed against its bounding box only, so
a part pushed toward a missing corner ran through it to the box edge and
ended off the sheet. Compactor's plate pushes (Push, PushBoundingBox,
SettlePlacement, Settle) now also stop at the walls of the outline: the
part of the work area that is not usable material (a missing corner, an
obstacle, each grown by the largest edge spacing). A mover is measured as
the edge review measures it, by the circumscribed perimeter of its clean
material without leads, so it rests where that review still passes. A box
push stops 0.0012 short of a wall so the geometry push after it starts
clear. A rectangular sheet has no walls and pushes exactly as before.

SheetOutline.FromGeometry eroded the whole imported outline by the chord
tolerance, so a sheet drawn 60 x 27 was stored as 59.998 x 26.998 with a
chamfer at every inside corner. Each arc is now chorded on the side that
takes material away (ClipperBridge.FlattenOneSided) and straight edges are
kept exactly. The plate header, the plate list and Edit Plate's outline
size show the size rounded to four decimals instead of the raw double.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-20 07:49:11 -05:00

7.0 KiB

Irregular stock sheets

A sheet need not be a rectangle: a remnant or drop, a sheet with a burned or damaged area, or one already cut into can be nested on as it is. Such a sheet carries a SheetOutline (OpenNest.Core/SheetOutline.cs): a closed polygon in plate coordinates (the sheet's lower-left frame, as clamp zones) with optional obstacle polygons for areas inside it that must stay empty. The plate's Size stays the outline's bounding box, so every rectangular code path keeps working on the box; the outline narrows what may hold parts.

Defining an outline

  • Import a CAD file. SheetOutline.FromGeometry takes the file's entities: the largest closed contour (by bounding box) is the sheet and every other closed contour an obstacle; marks and open contours are ignored. Arcs are chorded at 0.001 model units on the side that takes material away (inside the outline, outside an obstacle), so the stored polygons never reach past the true edges; straight edges are kept exactly, so a sheet drawn 60 x 27 is 60 x 27. The file's units are taken as the nest's, exactly as drawing import does.
    • Desktop: Plate > Edit Plate > Outline... reads a DXF/DWG; Clear makes the sheet a rectangle of its current size again. The size box is read-only while there is an outline.
    • Console: --outline <dxf> with --autonest makes the target plate that sheet.
  • The constructor normalizes any polygon: counterclockwise, starting at its lowest-left vertex, translated so the bounds start at the origin. It refuses fewer than three distinct vertices, nonfinite coordinates, zero area and self-crossing polygons, and drops an obstacle wholly outside the outline.

Drawing an outline in the plate view and taking the leftover of a cut plate are not implemented.

What honors it

Area Behavior
Irregular engine (and Default through it) Fills the outline: the stock's usable material (outline less obstacles, eroded by the outline inset below) is the FrontierPacker's PackBoundary, the same boundary the cutout packer uses, so every orientation's free region starts inside it
Rectangles, Circles, FlatBar, the fill strategies (Lattice, Strip, remnants) Place nothing on an outlined sheet; Default then keeps Irregular's layout. PlateFillService throws PlateFillService.Refusal(plate) for an outlined plate; every caller checks it first: the desktop's Fill (Ctrl+F on a picked-up part) and Fill Area put the message in the status bar and add nothing, Pattern Tile offers a new plate only, the MCP fill/pack tools return it as an Error: result, and the console exits 2 with it unless --autonest is given
Layout check and the runner's candidate validation A part's circumscribed material must lie inside the usable area, within the shared work-area slack; a part in a missing corner or over an obstacle is a violation ("falls outside the outline ... or over one of its obstacles"). The area budget is the usable area
Edge spacing The outline is eroded by the largest of the four edge spacings (NestPlateStock.OutlineInset), so no outline edge is closer to a part than the rectangle's own sides would be. The rectangular work area still applies and is never larger than that erosion
Push, clone push placement, settling A pushed part stops at the edge of the usable area as it stops at the work-area edge: the unusable part of the work area (a missing corner, an obstacle, each grown by the outline inset) is a wall for Compactor's plate pushes (InteractiveOutline). The part is measured as the edge review measures it, by the circumscribed perimeter of its clean material (no leads), so it rests where that review still passes. A bounding-box push (Ctrl-click clone placement, the coarse pass of a settle) stops the box 0.0012 short of a wall, because that perimeter reaches past the box by up to the chord tolerance. A part already lying in a wall, deeper than the review's slack, is not held by it and can be pushed back out; with uneven edge spacing the walls join into one, so such a part is held by none of them
Nudge, drag, Expand Spacing, Fix Spacing Do not stop at the outline: the layout check reports a part they leave outside it
Clamps Unchanged: the rail is resolved for the bounding box, zones are keep-outs as before
Support bed Unchanged: it is fixed to the machine and reports contacts under material
Area, utilization, cost Plate.Area and NestPlateStock.Area are the material area (outline less obstacles); area-based cost prices that area and utilization divides by it
Salvage and remnants No salvage credit and no expectedRemnant: no rectangular edge strip is guaranteed inside an outline
Manual cut-offs A line is cut only where it crosses material: each crossing is a segment of its own, started at the material's edge and overtraveled past the far one, within the user's limits and the usual part clearance. The head-locked overcut applies only to a span that reaches the bounding box's far edge
Automatic cut-offs Refused: AutomaticCutOffPlanner rejects an outlined plate ("Automatic cut-offs need a rectangular sheet")
AutoSize (Resize Plate to Fit Parts) Leaves an outlined plate unchanged: the outline is a particular piece of material
Rotate 90/180 Turn the outline with the sheet
Repeated layouts, clamp-removal recovery, stock matching An outlined stock is never the same stock as its rectangle

Setting Plate.Outline sets the plate's size to the outline's bounds; setting any other size drops the outline. The Edit Plate dialog therefore applies the outline instead of a parsed size.

File format and undo

The outline is saved per plate under an optional outline key (see nest file format); files without it load rectangles as before, and a malformed value loads the saved size as a rectangle with a reader warning. Undo snapshots go through the same writer and reader, so a restore rebuilds the outline.

Limits

  • Only the Irregular engine nests on an outlined sheet. A job offering an outlined sheet and a rectangle to Default may well land on the rectangle: Default keeps the cheaper valid layout.
  • Auto Nest's stock-options grid offers rectangles only; an outlined sheet is nested through the target plate (no options), or through NestPlateStock directly: the console's --outline, or API callers that set NestPlateStock.Outline. MCP has no outline input.
  • The stored polygon is inside the true material by up to the chord tolerance (0.001) on imported arcs and exactly on straight edges. Outlines imported before straight edges were kept exactly sit 0.001 inside every edge (a 60 x 27 sheet reads 59.998 x 26.998); import the outline again to get the drawn size.
  • The edge review circumscribes arcs, so a round part pushed against the sheet's own box edge (held by the bounding-box work area, measured on the part's true bounds) can read up to the chord tolerance inside the outline's edge spacing. Against an outline wall it stops clear.