mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-07 13:05:52 -05:00
fix(engine): use smallest remaining part as minimum remnant size
Skip remnants that are too small to fit any remaining part, avoiding wasted fill attempts. Recalculated each iteration as quantities deplete. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
00ccf82196
commit
0b9a42e84c
1 file changed
+17
-1
@@ -270,7 +270,23 @@ namespace OpenNest
|
||||
while (madeProgress && !token.IsCancellationRequested)
|
||||
{
|
||||
madeProgress = false;
|
||||
var freeBoxes = finder.FindRemnants(spacing);
|
||||
|
||||
// Minimum remnant size = smallest remaining part dimension
|
||||
var minRemnantDim = double.MaxValue;
|
||||
foreach (var item in effectiveRemainder)
|
||||
{
|
||||
if (localQty[item.Drawing.Name] <= 0)
|
||||
continue;
|
||||
var bb = item.Drawing.Program.BoundingBox();
|
||||
var dim = System.Math.Min(bb.Width, bb.Length);
|
||||
if (dim < minRemnantDim)
|
||||
minRemnantDim = dim;
|
||||
}
|
||||
|
||||
if (minRemnantDim == double.MaxValue)
|
||||
break; // No items with remaining quantity
|
||||
|
||||
var freeBoxes = finder.FindRemnants(minRemnantDim);
|
||||
|
||||
if (freeBoxes.Count == 0)
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user