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:
@@ -1243,15 +1243,24 @@ namespace OpenNest.Controls
|
|||||||
var cts = new CancellationTokenSource();
|
var cts = new CancellationTokenSource();
|
||||||
var progressForm = new NestProgressForm(cts, showPlateRow: false);
|
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 =>
|
var progress = new Progress<NestProgress>(p =>
|
||||||
{
|
{
|
||||||
progressForm.UpdateProgress(p);
|
progressForm.UpdateProgress(p);
|
||||||
|
|
||||||
if (p.IsOverallBest)
|
if (p.IsOverallBest)
|
||||||
SetStationaryParts(p.BestParts);
|
progressForm.UpdatePreview(p.BestParts);
|
||||||
else
|
|
||||||
SetActiveParts(p.BestParts);
|
|
||||||
|
|
||||||
|
SetActiveParts(p.BestParts);
|
||||||
ActiveWorkArea = p.ActiveWorkArea;
|
ActiveWorkArea = p.ActiveWorkArea;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -71,17 +71,20 @@ namespace OpenNest.Forms
|
|||||||
}
|
}
|
||||||
|
|
||||||
phaseStepper.ActivePhase = progress.Phase;
|
phaseStepper.ActivePhase = progress.Phase;
|
||||||
|
|
||||||
SetValueWithFlash(plateValue, progress.PlateNumber.ToString());
|
SetValueWithFlash(plateValue, progress.PlateNumber.ToString());
|
||||||
SetValueWithFlash(partsValue, progress.BestPartCount.ToString());
|
|
||||||
|
|
||||||
var densityText = progress.BestDensity.ToString("P1");
|
if (progress.IsOverallBest)
|
||||||
var densityFlashColor = GetDensityColor(progress.BestDensity);
|
{
|
||||||
SetValueWithFlash(densityValue, densityText, densityFlashColor);
|
SetValueWithFlash(partsValue, progress.BestPartCount.ToString());
|
||||||
densityBar.Value = progress.BestDensity;
|
|
||||||
|
|
||||||
SetValueWithFlash(nestedAreaValue,
|
var densityText = progress.BestDensity.ToString("P1");
|
||||||
$"{progress.NestedWidth:F1} x {progress.NestedLength:F1} ({progress.NestedArea:F1} sq in)");
|
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)
|
descriptionValue.Text = !string.IsNullOrEmpty(progress.Description)
|
||||||
? progress.Description
|
? progress.Description
|
||||||
|
|||||||
Reference in New Issue
Block a user