fix: small parts use FindScrapZones not FindAllRemnants
Small parts must only go into scrap zones (both dims < minRemnantSize) to preserve viable remnants. The implementer had inverted this, giving small parts access to all remnants. Also fixed the test to verify remnant preservation behavior and removed unused FindAllRemnants helper. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -262,9 +262,9 @@ namespace OpenNest
|
||||
if (classification == PartClass.Large)
|
||||
continue; // Large parts don't go on existing plates — they create new ones.
|
||||
|
||||
// Get all remnants and try to place in them.
|
||||
// Small parts only go into scrap zones; medium parts into viable remnants.
|
||||
var remnants = classification == PartClass.Small
|
||||
? FindAllRemnants(pr.Plate)
|
||||
? FindScrapZones(pr.Plate, minRemnantSize)
|
||||
: FindViableRemnants(pr.Plate, minRemnantSize);
|
||||
|
||||
foreach (var zone in remnants)
|
||||
@@ -435,12 +435,6 @@ namespace OpenNest
|
||||
return false;
|
||||
}
|
||||
|
||||
private static List<Box> FindAllRemnants(Plate plate)
|
||||
{
|
||||
var finder = RemnantFinder.FromPlate(plate);
|
||||
return finder.FindRemnants();
|
||||
}
|
||||
|
||||
private static NestItem CloneItem(NestItem item)
|
||||
{
|
||||
return new NestItem
|
||||
|
||||
Reference in New Issue
Block a user