fix: recalculate remnants after each fill to prevent overlaps

The consolidation pass was iterating stale remnant lists after placing
parts, causing overlapping placements. Now recalculates remnants from
the plate after each fill operation. Also added plate options to the
real nest file integration test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-06 15:55:48 -04:00
parent 0697bebbc2
commit 1f88453d4c
2 changed files with 50 additions and 29 deletions

View File

@@ -386,11 +386,26 @@ public class MultiPlateNesterTests
_output.WriteLine("---");
_output.WriteLine($"Total: {items.Count} drawings, {items.Sum(i => i.Quantity)} parts");
var plateOptions = new List<PlateOption>
{
new() { Width = 48, Length = 96, Cost = 0 },
new() { Width = 48, Length = 120, Cost = 0 },
new() { Width = 48, Length = 144, Cost = 0 },
new() { Width = 60, Length = 96, Cost = 0 },
new() { Width = 60, Length = 120, Cost = 0 },
new() { Width = 60, Length = 144, Cost = 0 },
new() { Width = 72, Length = 96, Cost = 0 },
new() { Width = 72, Length = 120, Cost = 0 },
new() { Width = 72, Length = 144, Cost = 0 },
};
_output.WriteLine($"Plate options: {string.Join(", ", plateOptions.Select(o => $"{o.Width}x{o.Length}"))}");
_output.WriteLine("");
var result = MultiPlateNester.Nest(
items, template,
plateOptions: null,
plateOptions: plateOptions,
salvageRate: 0.5,
sortOrder: PartSortOrder.BoundingBoxArea,
minRemnantSize: 12.0,