mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-11 17:54:40 -04:00
The multi-phase lattice fill (linear, pairs, rectangle best-fit, remainder) is no longer meant to be the engine used by default, so it gets a name for what it does. The registry lists it as Fill and maps the old name Default to it; PlateFillService, PlateNesterFactory and NestJobOptions use Fill, and every fill-strategy caller still accepts Default. Console --autonest now validates engine names through NestingEngineRegistry.ResolveName so renamed names work. Layouts are unchanged: Default and Fill resolve to the same fillers and the golden layouts pass under the new name.
40 lines
1.5 KiB
C#
40 lines
1.5 KiB
C#
using System;
|
|
|
|
namespace OpenNest.Engine.Jobs;
|
|
|
|
/// <summary>Immutable per-job options; selection never changes the legacy global registry.</summary>
|
|
public sealed class NestJobOptions
|
|
{
|
|
public NestJobOptions(
|
|
string placementStrategy = "Fill",
|
|
int? maxPlates = null,
|
|
double salvageRate = 0,
|
|
double minimumSalvageDimension = 0
|
|
)
|
|
{
|
|
ArgumentException.ThrowIfNullOrWhiteSpace(placementStrategy);
|
|
if (maxPlates <= 0)
|
|
throw new ArgumentOutOfRangeException(nameof(maxPlates));
|
|
if (!double.IsFinite(salvageRate) || salvageRate < 0 || salvageRate > 1)
|
|
throw new ArgumentOutOfRangeException(nameof(salvageRate));
|
|
if (!double.IsFinite(minimumSalvageDimension) || minimumSalvageDimension < 0)
|
|
throw new ArgumentOutOfRangeException(nameof(minimumSalvageDimension));
|
|
PlacementStrategy = placementStrategy;
|
|
MaxPlates = maxPlates;
|
|
SalvageRate = salvageRate;
|
|
MinimumSalvageDimension = minimumSalvageDimension;
|
|
}
|
|
|
|
/// <summary>Fraction of eligible edge-offcut area credited by StockLadder (0..1).</summary>
|
|
public double SalvageRate { get; }
|
|
|
|
/// <summary>Both offcut dimensions must meet this caller-supplied minimum in job units.
|
|
/// Zero disables credit; scraps and holes are never credited.</summary>
|
|
public double MinimumSalvageDimension { get; }
|
|
|
|
public string PlacementStrategy { get; }
|
|
|
|
/// <summary>Maximum physical sheets to commit, or null for no explicit cap.</summary>
|
|
public int? MaxPlates { get; }
|
|
}
|