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>
28 lines
605 B
C#
28 lines
605 B
C#
using OpenNest.Geometry;
|
|
using System.Collections.Generic;
|
|
|
|
namespace OpenNest.Shapes
|
|
{
|
|
public class CircleShape : ShapeDefinition
|
|
{
|
|
public double Diameter { get; set; }
|
|
|
|
public override string GenerateName() => $"Circle {Dim(Diameter)} Dia";
|
|
|
|
public override void SetPreviewDefaults()
|
|
{
|
|
Diameter = 8;
|
|
}
|
|
|
|
public override Drawing GetDrawing()
|
|
{
|
|
var entities = new List<Entity>
|
|
{
|
|
new Circle(0, 0, Diameter / 2.0)
|
|
};
|
|
|
|
return CreateDrawing(entities);
|
|
}
|
|
}
|
|
}
|