feat(common-line): place parts on common lines automatically at a chosen level

Slice 3 of common-line cutting. On costly plate (N26-295: 3/16 RA310S at about
$2,500 a sheet) pairing parts one kerf apart fits the part the spacing cannot:
the last plate's 38 parts fit on one 48x120 with Auto Nest only with pairs.

- Drawing Properties gains "Allow common line" (Drawing.AllowCommonLine, off by
  default because customer edge-quality needs vary). The nest's CommonLineUsage
  (Off / When it adds parts / Whenever available) is set in Auto Nest and seeded
  from Tools > Nest Defaults; both persist (nest.json, defaults.json).
- NestPipeline runs the ordinary solve, then, with a level on, trials where
  eligible parts are offered as kerf-gap pair compounds. Placed pairs expand into
  parts plus explicit NestJobCommonLine groups, are validated again, and
  CommonLineRanking keeps a trial only by the level: count first, then sheets;
  "when it adds parts" keeps the plain layout on a tie, "whenever" also takes a
  shorter cut or less material, never at the cost of a part. Engines, FillScore
  and their comparers are unchanged; Off asks the engine exactly what it did.
- NestLayoutCheck exempts members only through a sheet's explicit group list and
  only when the job allows common lines; materializing and committing create
  Plate.CommonLines.
- Server nesting writes common-line jobs as version 3 and replays the recorded
  trial answers, so the desktop binds the same groups.
- Fill Area honors the level through a PlateFillService overload.
- The benchmark gains --common-lines <level> --kerf <k>.

Benchmark (synthetic nests + N26-295, --parallel 1): with no flag and with
--common-lines off every engine matches the base commit; with a level on no
layout becomes invalid and three runs save a sheet at equal nested area.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ajandClaude Opus 5.5 committed 2026-11-05 19:38:00 -05:00
1 parent f9b2713420
commit b026bd19d2
61 files changed
+2155 -118

No files matched your search

+9 -4
View File
@@ -104,7 +104,9 @@ package and result on the server.
geometry fingerprint (a SHA-256 of the exact motions the freshness check compares, which a
later Open checks the nest's drawings against; workers ignore it), every stock
entry as `NestStockJson` (size, quantity, spacing, quadrant, cost, clamp zones in plate
coordinates, clamp rail, irregular outline), and the job options. A server job never sets
coordinates, clamp rail, irregular outline), and the job options, including the common-line
level and kerf. A job that uses common lines is written as version 3, so a worker without them
refuses it instead of solving it differently from the desktop's replay. A server job never sets
`SearchUntilCancelled` and never runs under a `DeadlineNestingEngine`: it has no time
limit, so a throttled worker finds the same nest a fast one does, later.
- `drawings.nest`: a throwaway nest of exactly the items' drawings, written by `NestWriter`.
@@ -115,7 +117,10 @@ package and result on the server.
**The result** is a `NestSolveTranscript`: every engine solve the pipeline made on the worker,
in order, as what was asked (part and stock ids with quantities) and the raw `NestJobResult`
returned. Poses keep their IEEE values, nonfinite ones included. No bound plates or
validation travel back.
validation travel back. A [common-line](common-line-cutting.md#automatic-placement) trial is one
more recorded solve whose answer places pair proxies; the desktop's replay expands them into the
same parts and groups the worker made, so the groups travel as those recorded answers (a sheet's
own `commonLines`, written only when an engine returns groups itself, travel too).
**Live progress** travels separately while the job runs, both as versioned JSON the server
never opens: `RemoteNestProgress` (the stage of the solve in progress: `NestJobStage`, stock,
@@ -124,14 +129,14 @@ raw placements of `NestJobStage.PlanImproved`). The desktop rebuilds the request
its own drawings (the same part ids the worker solved) and draws the plan on detached
drawings, exactly as a local run's `PlanSheets`; a bundled cutout trial's frame proxies are
bundled once on the desktop the first time a plan names one. Like a local plan it is
unvalidated and never kept.
unvalidated and never kept. A common-line trial's pair proxies are rebuilt the same way.
## Replay on the desktop
`RemoteNestSubmission.Complete` first checks that each item's drawing still has the geometry
it had when the job was sent; a changed drawing refuses the result. It then runs
`NestPipeline.Run` with a `ReplayNestingEngine` that answers each solve with the next recorded
result, after checking it is asked the same question. Cutout bundling, the ordinary-solve
result, after checking it is asked the same question. Cutout bundling, common-line trials, the ordinary-solve
comparison and clamp-removal recovery therefore happen here exactly as on the worker, and the
result is validated by `NestLayoutCheck` and bound to the caller's own drawings like a local
run. A recorded sheet that matches one of the request's stock entries uses that entry itself.