diff --git a/OpenNest.Engine/Strategies/RectBestFitStrategy.cs b/OpenNest.Engine/Strategies/RectBestFitStrategy.cs new file mode 100644 index 0000000..81d1011 --- /dev/null +++ b/OpenNest.Engine/Strategies/RectBestFitStrategy.cs @@ -0,0 +1,23 @@ +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 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 { context.Item }); + } + } +}