fix: only remove bend-generated etch entities, preserve user etch lines
UpdateEtchEntities was removing all entities on the ETCH layer, which also deleted user-added etch marks like part numbers. Now tags generated bend etch lines with a BendEtch tag and filters on that instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,7 @@ namespace OpenNest.Bending
|
||||
};
|
||||
|
||||
private const double DefaultEtchLength = 1.0;
|
||||
private const string BendEtchTag = "BendEtch";
|
||||
|
||||
public Vector StartPoint { get; set; }
|
||||
public Vector EndPoint { get; set; }
|
||||
@@ -73,7 +74,7 @@ namespace OpenNest.Bending
|
||||
/// </summary>
|
||||
public static void UpdateEtchEntities(List<Entity> entities, List<Bend> bends)
|
||||
{
|
||||
entities.RemoveAll(e => e.Layer == EtchLayer);
|
||||
entities.RemoveAll(e => e.Tag == BendEtchTag);
|
||||
if (bends == null) return;
|
||||
|
||||
foreach (var bend in bends)
|
||||
@@ -82,7 +83,7 @@ namespace OpenNest.Bending
|
||||
|
||||
private static Line CreateEtchLine(Vector start, Vector end)
|
||||
{
|
||||
return new Line(start, end) { Layer = EtchLayer, Color = Color.Green };
|
||||
return new Line(start, end) { Layer = EtchLayer, Color = Color.Green, Tag = BendEtchTag };
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
||||
@@ -29,6 +29,11 @@ namespace OpenNest.Geometry
|
||||
/// </summary>
|
||||
public bool IsVisible { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Optional tag for identifying generated entities (e.g. bend etch marks).
|
||||
/// </summary>
|
||||
public string Tag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Smallest box that contains the entity.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user