fix: plate optimizer skips oversized items instead of rejecting all plate options
When an item was too large for every plate option, its dimensions dominated the global min-dimension filter, causing all candidate plates to be rejected. This made auto-nesting exit immediately with no results even when the other items could fit. Oversized items are now excluded from the filter so the remaining items nest normally. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,7 +23,8 @@ namespace OpenNest
|
||||
if (items == null || items.Count == 0 || plateOptions == null || plateOptions.Count == 0)
|
||||
return null;
|
||||
|
||||
// Find the minimum dimension needed to fit the largest part.
|
||||
// Find the minimum dimension needed to fit the largest part,
|
||||
// skipping items that are too large for every plate option.
|
||||
var minPartWidth = 0.0;
|
||||
var minPartLength = 0.0;
|
||||
foreach (var item in items)
|
||||
@@ -32,6 +33,14 @@ namespace OpenNest
|
||||
var bb = item.Drawing.Program.BoundingBox();
|
||||
var shortSide = System.Math.Min(bb.Width, bb.Length);
|
||||
var longSide = System.Math.Max(bb.Width, bb.Length);
|
||||
|
||||
if (!plateOptions.Any(o => FitsPart(o, shortSide, longSide, templatePlate.EdgeSpacing)))
|
||||
{
|
||||
Debug.WriteLine($"[PlateOptimizer] Skipping oversized item '{item.Drawing.Name}' " +
|
||||
$"({shortSide:F1}x{longSide:F1}) — does not fit any plate option");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (shortSide > minPartWidth) minPartWidth = shortSide;
|
||||
if (longSide > minPartLength) minPartLength = longSide;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user