fix: update PlateView fill path and sync stats with preview

- Route best-result updates to progress form preview in
  PlateView.FillWithProgress (Ctrl+F path) — was still using
  the old SetStationaryParts approach
- Only update results stats (parts, density, area) when
  IsOverallBest so they match the preview display

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 20:56:41 -04:00
parent 21a5d3b026
commit 036f723876
2 changed files with 23 additions and 11 deletions

View File

@@ -1243,15 +1243,24 @@ namespace OpenNest.Controls
var cts = new CancellationTokenSource();
var progressForm = new NestProgressForm(cts, showPlateRow: false);
var previewPlate = new Plate(Plate.Size)
{
Quadrant = Plate.Quadrant,
PartSpacing = Plate.PartSpacing,
Thickness = Plate.Thickness,
Material = Plate.Material,
};
previewPlate.EdgeSpacing = Plate.EdgeSpacing;
progressForm.PreviewPlate = previewPlate;
var progress = new Progress<NestProgress>(p =>
{
progressForm.UpdateProgress(p);
if (p.IsOverallBest)
SetStationaryParts(p.BestParts);
else
SetActiveParts(p.BestParts);
progressForm.UpdatePreview(p.BestParts);
SetActiveParts(p.BestParts);
ActiveWorkArea = p.ActiveWorkArea;
});

View File

@@ -71,17 +71,20 @@ namespace OpenNest.Forms
}
phaseStepper.ActivePhase = progress.Phase;
SetValueWithFlash(plateValue, progress.PlateNumber.ToString());
SetValueWithFlash(partsValue, progress.BestPartCount.ToString());
var densityText = progress.BestDensity.ToString("P1");
var densityFlashColor = GetDensityColor(progress.BestDensity);
SetValueWithFlash(densityValue, densityText, densityFlashColor);
densityBar.Value = progress.BestDensity;
if (progress.IsOverallBest)
{
SetValueWithFlash(partsValue, progress.BestPartCount.ToString());
SetValueWithFlash(nestedAreaValue,
$"{progress.NestedWidth:F1} x {progress.NestedLength:F1} ({progress.NestedArea:F1} sq in)");
var densityText = progress.BestDensity.ToString("P1");
var densityFlashColor = GetDensityColor(progress.BestDensity);
SetValueWithFlash(densityValue, densityText, densityFlashColor);
densityBar.Value = progress.BestDensity;
SetValueWithFlash(nestedAreaValue,
$"{progress.NestedWidth:F1} x {progress.NestedLength:F1} ({progress.NestedArea:F1} sq in)");
}
descriptionValue.Text = !string.IsNullOrEmpty(progress.Description)
? progress.Description