feat(engine): rebind live fill previews to the drawing's original frame

DefaultPlateFiller runs its search in a canonical (MBR-axis-aligned)
copy of the drawing. Intermediate progress reports — the Nesting
Progress dialog, PlateView's active-parts overlay — were showing that
transient canonical orientation instead of the drawing's real one.

FillContext.OriginalDrawing carries the pre-canonicalization drawing
through the pipeline; ReportProgress rebinds reported parts to it via
CanonicalFrame.RebindToOriginal before they reach the UI. Uses a
shallow list copy rather than per-part Part.Clone() — Clone() re-derives
its target rotation from BaseDrawing.Program.Rotation + Rotation, which
would double-count the canonical drawing's baked source angle.
This commit is contained in:
aj
2026-09-22 09:51:11 -04:00
parent 86f6c9efa1
commit 56f39556d1
2 changed files with 36 additions and 4 deletions
@@ -112,7 +112,7 @@ internal class DefaultPlateFiller : PlateFillerBase
);
}
var best = RunFillPipeline(canonicalItem, effectiveWorkArea, progress, token);
var best = RunFillPipeline(canonicalItem, originalDrawing, effectiveWorkArea, progress, token);
if (
canonicalItem.Quantity > 0
@@ -125,7 +125,7 @@ internal class DefaultPlateFiller : PlateFillerBase
);
PhaseResults.Clear();
AngleResults.Clear();
best = RunFillPipeline(canonicalItem, workArea, progress, token);
best = RunFillPipeline(canonicalItem, originalDrawing, workArea, progress, token);
}
if (canonicalItem.Quantity > 0 && best.Count > canonicalItem.Quantity)
@@ -333,6 +333,7 @@ internal class DefaultPlateFiller : PlateFillerBase
private List<Part> RunFillPipeline(
NestItem item,
Drawing originalDrawing,
Box workArea,
IProgress<NestProgress> progress,
CancellationToken token
@@ -341,6 +342,7 @@ internal class DefaultPlateFiller : PlateFillerBase
var context = new FillContext
{
Item = item,
OriginalDrawing = originalDrawing,
WorkArea = workArea,
Plate = Plate,
PlateNumber = PlateNumber,
@@ -474,7 +476,7 @@ internal class DefaultPlateFiller : PlateFillerBase
{
Phase = context.WinnerPhase,
PlateNumber = PlateNumber,
Parts = context.CurrentBest,
Parts = context.ToOriginalFrame(context.CurrentBest),
WorkArea = context.WorkArea,
Description = BuildProgressSummary(),
IsOverallBest = true,