refactor: migrate Console Program to NestEngineRegistry
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -348,7 +348,7 @@ static class NestConsole
|
|||||||
if (item.Quantity <= 0 || workArea.Width <= 0 || workArea.Length <= 0)
|
if (item.Quantity <= 0 || workArea.Width <= 0 || workArea.Length <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var engine = new NestEngine(plate);
|
var engine = NestEngineRegistry.Create(plate);
|
||||||
var parts = engine.FillExact(item, workArea, null, CancellationToken.None);
|
var parts = engine.FillExact(item, workArea, null, CancellationToken.None);
|
||||||
|
|
||||||
if (parts.Count > 0)
|
if (parts.Count > 0)
|
||||||
@@ -367,17 +367,17 @@ static class NestConsole
|
|||||||
|
|
||||||
if (packItems.Count > 0 && workArea.Width > 0 && workArea.Length > 0)
|
if (packItems.Count > 0 && workArea.Width > 0 && workArea.Length > 0)
|
||||||
{
|
{
|
||||||
var engine = new NestEngine(plate);
|
var engine = NestEngineRegistry.Create(plate);
|
||||||
var before = plate.Parts.Count;
|
var packParts = engine.PackArea(workArea, packItems, null, CancellationToken.None);
|
||||||
engine.PackArea(workArea, packItems);
|
plate.Parts.AddRange(packParts);
|
||||||
|
|
||||||
if (plate.Parts.Count > before)
|
if (packParts.Count > 0)
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var engine = new NestEngine(plate);
|
var engine = NestEngineRegistry.Create(plate);
|
||||||
var item = new NestItem { Drawing = drawing, Quantity = options.Quantity };
|
var item = new NestItem { Drawing = drawing, Quantity = options.Quantity };
|
||||||
success = engine.Fill(item);
|
success = engine.Fill(item);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user