fix: resolve rendering issues when applying lead-ins to parts

Three issues caused incorrect rendering after lead-in application:
- Rapid move entities from ToGeometry() were included in ShapeProfile
  contour detection, turning traversal paths into cutting moves
- Program created with Mode.Incremental default made the absolute-to-
  incremental conversion a no-op, leaving coordinates unconverted
- AddProgramSplit didn't call StartFigure() at rapid moves, causing
  GraphicsPath to draw implicit connecting lines between contours
- Part.Rotation returned 0 from the new program instead of the actual
  rotation, displacing the sequence label on rotated parts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-30 19:35:29 -04:00
parent d16ef36d34
commit a399c89f58
3 changed files with 59 additions and 16 deletions

View File

@@ -11,6 +11,7 @@ namespace OpenNest.CNC.CuttingStrategy
{
var exitPoint = approachPoint;
var entities = partProgram.ToGeometry();
entities.RemoveAll(e => e.Layer == SpecialLayers.Rapid);
var profile = new ShapeProfile(entities);
// Find closest point on perimeter from exit point
@@ -22,7 +23,7 @@ namespace OpenNest.CNC.CuttingStrategy
orderedCutouts.Reverse();
// Build output program: cutouts first (farthest to nearest), perimeter last
var result = new Program();
var result = new Program(Mode.Absolute);
var currentPoint = exitPoint;
foreach (var cutout in orderedCutouts)