Files
OpenNest/OpenNest.Engine/Jobs/PlateNesterFactory.cs
T
ajandClaude Opus 5.5 5611d9a663 refactor(engine): one PlateNester and one strategy name table
DefaultPlateNester, StripPlateNester and RemnantPlateNester differed only
in the filler they built. They are replaced by one internal PlateNester
over a Func<Plate, PlateFiller>, which keeps the old Place exactly:
restricted rotation goes to OrderedPlateNester, and each trial gets a fresh
private plate and filler.

PlacementStrategies maps Fill (and its legacy "Default" alias), Strip and
both Remnants to a filler policy and layout. PlateNesterFactory reads it
case-sensitively and PlateFillService ignores case, as before; each keeps
its own error type and message. Nothing outside the Engine and its tests
used the three public nester types, so they are removed.

No layout changes: all 29 fill-stack pins pass with the pin file untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:44:51 -04:00

23 lines
887 B
C#

using System;
using OpenNest.Engine.Jobs.Placement;
namespace OpenNest.Engine.Jobs;
/// <summary>
/// Instance-scoped strategy resolution for the whole-job runner. All four built-in strategies
/// resolve to a filler-backed plate nester from <see cref="PlacementStrategies"/>. Selection is
/// explicit per job; no shared mutable strategy setting is read or modified. Names match
/// case-sensitively ("Default" is Fill's name in earlier releases); unknown keys reject.
/// </summary>
public static class PlateNesterFactory
{
public static IPlateNester Create(string strategy)
{
ArgumentNullException.ThrowIfNull(strategy);
var entry =
PlacementStrategies.Find(strategy, StringComparison.Ordinal)
?? throw new NotSupportedException($"Unknown placement strategy: {strategy}.");
return new PlateNester(entry.CreateFiller);
}
}