- Skip ExtentsFillStrategy for rectangle/circle parts - Skip PairsFillStrategy for circle parts - PackBottomLeft now tries rotated orientation when items don't fit - PackBottomLeft tries both area-descending and length-descending sort orders, keeping whichever places more parts (tighter bbox on tie) - Add user constraint override tests for AngleCandidateBuilder Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
using OpenNest.Engine.Fill;
|
|
using OpenNest.Math;
|
|
using System.Collections.Generic;
|
|
|
|
namespace OpenNest.Engine.Strategies
|
|
{
|
|
public class ExtentsFillStrategy : IFillStrategy
|
|
{
|
|
public string Name => "Extents";
|
|
public NestPhase Phase => NestPhase.Extents;
|
|
public int Order => 300;
|
|
|
|
public List<Part> Fill(FillContext context)
|
|
{
|
|
if (context.PartType == PartType.Rectangle || context.PartType == PartType.Circle)
|
|
return null;
|
|
var filler = new FillExtents(context.WorkArea, context.Plate.PartSpacing);
|
|
|
|
var bestRotation = context.SharedState.TryGetValue("BestRotation", out var rot)
|
|
? (double)rot
|
|
: RotationAnalysis.FindBestRotation(context.Item);
|
|
|
|
var angles = new[] { bestRotation, bestRotation + Angle.HalfPI };
|
|
|
|
return FillHelpers.BestOverAngles(context, angles,
|
|
angle => filler.Fill(context.Item.Drawing, angle,
|
|
context.PlateNumber, context.Token, context.Progress),
|
|
NestPhase.Extents, "Extents");
|
|
}
|
|
}
|
|
}
|