Wraps FillBestFit rectangle packer in an IFillStrategy so the rect best-fit phase participates in the pluggable pipeline. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
24 lines
709 B
C#
24 lines
709 B
C#
using System.Collections.Generic;
|
|
using OpenNest.RectanglePacking;
|
|
|
|
namespace OpenNest
|
|
{
|
|
public class RectBestFitStrategy : IFillStrategy
|
|
{
|
|
public string Name => "RectBestFit";
|
|
public NestPhase Phase => NestPhase.RectBestFit;
|
|
public int Order => 200;
|
|
|
|
public List<Part> Fill(FillContext context)
|
|
{
|
|
var binItem = BinConverter.ToItem(context.Item, context.Plate.PartSpacing);
|
|
var bin = BinConverter.CreateBin(context.WorkArea, context.Plate.PartSpacing);
|
|
|
|
var engine = new FillBestFit(bin);
|
|
engine.Fill(binItem);
|
|
|
|
return BinConverter.ToParts(bin, new List<NestItem> { context.Item });
|
|
}
|
|
}
|
|
}
|