fix(engine): fix FillExtents competition and vertical gap bugs
- FillExtents.Fill reported progress internally which overwrote the UI's temporary parts even when a better result (e.g. Pairs with 70 parts) won the competition. Added final ReportProgress call in FindBestFill and Fill(groupParts) to ensure the UI always shows the actual winner. - FillExtents vertical copy distance clamp (Math.Max with pairHeight + spacing) prevented geometry-aware compaction from ever occurring, causing visible gaps between rows. Boundaries are already inflated by halfSpacing so the calculated distance is correct; only fall back to bounding-box distance on non-positive results. - PairFiller now sets RemainderPatterns on FillLinear so remainder strips get pair-based filling instead of only individual parts (+1 part in tight layouts). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -176,6 +176,13 @@ namespace OpenNest
|
||||
}
|
||||
}
|
||||
|
||||
// Always report the final winner so the UI's temporary parts
|
||||
// match the returned result.
|
||||
var winPhase = PhaseResults.Count > 0
|
||||
? PhaseResults.OrderByDescending(r => r.PartCount).First().Phase
|
||||
: NestPhase.Linear;
|
||||
ReportProgress(progress, winPhase, PlateNumber, best, workArea, BuildProgressSummary());
|
||||
|
||||
return best ?? new List<Part>();
|
||||
}
|
||||
|
||||
@@ -320,6 +327,11 @@ namespace OpenNest
|
||||
Debug.WriteLine("[FindBestFill] Cancelled, returning current best");
|
||||
}
|
||||
|
||||
// Always report the final winner so the UI's temporary parts
|
||||
// match the returned result (sub-phases may have reported their
|
||||
// own intermediate results via progress).
|
||||
ReportProgress(progress, WinnerPhase, PlateNumber, best, workArea, BuildProgressSummary());
|
||||
|
||||
return best ?? new List<Part>();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user