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 double DefaultEtchLength = 1.0;
|
||||||
|
private const string BendEtchTag = "BendEtch";
|
||||||
|
|
||||||
public Vector StartPoint { get; set; }
|
public Vector StartPoint { get; set; }
|
||||||
public Vector EndPoint { get; set; }
|
public Vector EndPoint { get; set; }
|
||||||
@@ -73,7 +74,7 @@ namespace OpenNest.Bending
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void UpdateEtchEntities(List<Entity> entities, List<Bend> bends)
|
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;
|
if (bends == null) return;
|
||||||
|
|
||||||
foreach (var bend in bends)
|
foreach (var bend in bends)
|
||||||
@@ -82,7 +83,7 @@ namespace OpenNest.Bending
|
|||||||
|
|
||||||
private static Line CreateEtchLine(Vector start, Vector end)
|
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()
|
public override string ToString()
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ namespace OpenNest.Geometry
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsVisible { get; set; } = true;
|
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>
|
/// <summary>
|
||||||
/// Smallest box that contains the entity.
|
/// Smallest box that contains the entity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user