From 1c4015ac621d442227adc8d2d918a88172ea7e53 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Fri, 6 Mar 2026 19:41:42 -0500 Subject: [PATCH] fix: CadConverter SetRotation ignored rotation parameter SetRotation always forced CW regardless of the requested rotation, so cutouts (which should be CCW for kerf-left) were also set to CW. Now uses the rotation parameter to set the correct winding direction. Also reverts the Shape.OffsetEntity cutout side inversion since the correct fix is proper winding from the converter. Co-Authored-By: Claude Opus 4.6 --- OpenNest.Core/Geometry/Shape.cs | 4 +--- OpenNest/Forms/CadConverterForm.cs | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/OpenNest.Core/Geometry/Shape.cs b/OpenNest.Core/Geometry/Shape.cs index cb03c34..843485d 100644 --- a/OpenNest.Core/Geometry/Shape.cs +++ b/OpenNest.Core/Geometry/Shape.cs @@ -459,10 +459,8 @@ namespace OpenNest.Geometry lastEntity = entity; } - var cutoutSide = side == OffsetSide.Left ? OffsetSide.Right : OffsetSide.Left; - foreach (var cutout in definedShape.Cutouts) - offsetShape.Entities.AddRange(((Shape)cutout.OffsetEntity(distance, cutoutSide)).Entities); + offsetShape.Entities.AddRange(((Shape)cutout.OffsetEntity(distance, side)).Entities); return offsetShape; } diff --git a/OpenNest/Forms/CadConverterForm.cs b/OpenNest/Forms/CadConverterForm.cs index 53797bb..6621504 100644 --- a/OpenNest/Forms/CadConverterForm.cs +++ b/OpenNest/Forms/CadConverterForm.cs @@ -34,7 +34,7 @@ namespace OpenNest.Forms { var dir = shape.ToPolygon(3).RotationDirection(); - if (dir != RotationType.CW) + if (dir != rotation) shape.Reverse(); } catch { }