Files
OpenNest/OpenNest.Core/CNC/CuttingStrategy/LeadIns/LineArcLeadIn.cs
T
ajandClaude Opus 5.5 98f8e98230 fix(cutting): curved leads meet the cut tangentially; arc lead-in sweep
Curved leads turned with the contour winding, which is backwards on outside
perimeters: arc lead-ins arrived against the cut, and Line + Arc / arc
lead-outs went the long way round on one winding. LeadTurn now gives the
arc's turn direction for emission, the pierce-zone check and the preview,
and the arc geometry mirrors with it.

At convex outside corners, curved lead-ins use the first-cut edge's normal
and arc lead-outs the last-cut edge's, whichever edge was picked.

ArcLeadIn gains SweepAngle (degrees, (0, 180], default 180) in the cutting
panel, settings, nest files and cut pins; older files read as 180.

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

34 lines
1.3 KiB
C#

using System.Collections.Generic;
using OpenNest.Geometry;
namespace OpenNest.CNC.CuttingStrategy
{
public class LineArcLeadIn : LeadIn
{
public double LineLength { get; set; }
public double ApproachAngle { get; set; } = 135.0;
public double ArcRadius { get; set; }
public override List<ICode> Generate(
Vector contourStartPoint,
double contourNormalAngle,
RotationType winding = RotationType.CW
) => Approach(contourStartPoint, contourNormalAngle, winding).ToCodes(contourStartPoint, winding);
public override Vector GetPiercePoint(Vector contourStartPoint, double contourNormalAngle,
RotationType winding = RotationType.CW) =>
Approach(contourStartPoint, contourNormalAngle, winding).PiercePoint;
public override LeadIn Scale(double factor) =>
new LineArcLeadIn
{
LineLength = LineLength * factor,
ArcRadius = ArcRadius * factor,
ApproachAngle = ApproachAngle,
};
private LineArcApproach Approach(Vector contourStartPoint, double contourNormalAngle, RotationType winding) =>
LineArcApproach.Create(contourStartPoint, contourNormalAngle, ArcRadius, ApproachAngle, LineLength, winding);
}
}