Files
OpenNest/OpenNest.Core/Shapes/RingShape.cs
AJ Isaacs 28653e3a9f feat(shapes): generate unique drawing names from parameters and add toolbar button
Shape library drawings now get descriptive names based on their
parameters (e.g. "Rectangle 12x6", "Circle 8 Dia") instead of generic
type names, preventing silent duplicates in the DrawingCollection
HashSet. Added a Shape Library button to the Drawings tab toolbar
and removed separators between toolbar buttons for a cleaner look.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 15:48:45 -04:00

31 lines
775 B
C#

using OpenNest.Geometry;
using System.Collections.Generic;
namespace OpenNest.Shapes
{
public class RingShape : ShapeDefinition
{
public double OuterDiameter { get; set; }
public double InnerDiameter { get; set; }
public override string GenerateName() => $"Ring {Dim(OuterDiameter)}x{Dim(InnerDiameter)}";
public override void SetPreviewDefaults()
{
OuterDiameter = 10;
InnerDiameter = 6;
}
public override Drawing GetDrawing()
{
var entities = new List<Entity>
{
new Circle(0, 0, OuterDiameter / 2.0),
new Circle(0, 0, InnerDiameter / 2.0)
};
return CreateDrawing(entities);
}
}
}