feat(engine): expose NestPlateStock.WorkArea, Area and Fits
Every plugin engine re-derived the quadrant/edge-spacing work area by hand (Gpt6Astra, Opus55 and Qwen each had a copy, as did the placement validator). One definition on the stock removes that duplication and the chance of an engine disagreeing with the validator's bounds. Co-Authored-By: Codex <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -271,7 +271,7 @@ internal static class NestJobPlacementValidator
|
||||
|
||||
private static bool FitsWorkArea(ShapeTopology shape, NestPlateStock stock)
|
||||
{
|
||||
var workArea = WorkArea(stock);
|
||||
var workArea = stock.WorkArea;
|
||||
if (!FitsWorkArea(shape.Perimeter, workArea))
|
||||
return false;
|
||||
foreach (var cutout in shape.Cutouts)
|
||||
@@ -280,18 +280,6 @@ internal static class NestJobPlacementValidator
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Box WorkArea(NestPlateStock stock)
|
||||
{
|
||||
var left = stock.Quadrant is 1 or 4 ? 0 : -stock.Size.Length;
|
||||
var bottom = stock.Quadrant is 1 or 2 ? 0 : -stock.Size.Width;
|
||||
return new Box(
|
||||
left + stock.EdgeSpacing.Left,
|
||||
bottom + stock.EdgeSpacing.Bottom,
|
||||
stock.Size.Length - stock.EdgeSpacing.Left - stock.EdgeSpacing.Right,
|
||||
stock.Size.Width - stock.EdgeSpacing.Bottom - stock.EdgeSpacing.Top
|
||||
);
|
||||
}
|
||||
|
||||
private static bool FitsWorkArea(Shape contour, Box workArea)
|
||||
{
|
||||
var bounds = contour.BoundingBox;
|
||||
|
||||
Reference in New Issue
Block a user