From 9cba3a6cd7d28391af530e17c7c966be49281928 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Mon, 6 Apr 2026 10:41:39 -0400 Subject: [PATCH] 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) --- OpenNest.Engine/PlateOptimizer.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/OpenNest.Engine/PlateOptimizer.cs b/OpenNest.Engine/PlateOptimizer.cs index 2af8553..fd7be1c 100644 --- a/OpenNest.Engine/PlateOptimizer.cs +++ b/OpenNest.Engine/PlateOptimizer.cs @@ -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; }