From b7de61e4d108226dcde6eae205c6f09bd224c850 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Wed, 18 Mar 2026 13:02:05 -0400 Subject: [PATCH] feat(engine): add RectBestFitStrategy adapter 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 --- .../Strategies/RectBestFitStrategy.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 OpenNest.Engine/Strategies/RectBestFitStrategy.cs 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 }); + } + } +}