mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-16 13:45:37 -05:00
fix(shapes): cut shape library parts in the CAD Converter's directions
The CAD Converter winds every drawing's outside clockwise and its cutouts counter-clockwise (ShapeProfile.NormalizeEntities) before building the program, but the Shape Library built its programs straight from the generated entities, which run counter-clockwise. A shape part therefore cut its outside the opposite way from an imported part, and opening it in the converter showed (and on save, wrote) the reverse of what was nested. ShapeDefinition.CreateDrawing now normalizes the entities the same way, so every shape cuts outside clockwise and cutouts counter-clockwise. Tests cover each shape type, including the pipe flange's holes, and that rebuilding a shape drawing through the converter's import path keeps its directions. Drawings already made from shapes keep their stored direction until they are recreated or saved from the converter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
618996d2e0
commit
7894b74cb7
2 files changed
+108
-1
No files matched your search
@@ -51,9 +51,13 @@ namespace OpenNest.Shapes
|
||||
|
||||
protected static string Dim(double value) => value.ToString("0.###");
|
||||
|
||||
/// <summary>
|
||||
/// Builds the shape's drawing with the CAD converter's cut directions: the outside
|
||||
/// clockwise and every cutout counter-clockwise (see <see cref="ShapeProfile.NormalizeEntities"/>).
|
||||
/// </summary>
|
||||
protected Drawing CreateDrawing(List<Entity> entities)
|
||||
{
|
||||
var pgm = ConvertGeometry.ToProgram(entities);
|
||||
var pgm = ConvertGeometry.ToProgram(ShapeProfile.NormalizeEntities(entities));
|
||||
|
||||
if (pgm == null)
|
||||
throw new InvalidOperationException(
|
||||
|
||||
Reference in new issue
Block a user