From 80d4f78858c995474e96417b699aa8e984624bf5 Mon Sep 17 00:00:00 2001 From: AJ Date: Sat, 7 Sep 2019 10:14:29 -0400 Subject: [PATCH] Filter existing etch lines by layer. --- EtchBendLines/Program.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/EtchBendLines/Program.cs b/EtchBendLines/Program.cs index 868b3a0..9414214 100644 --- a/EtchBendLines/Program.cs +++ b/EtchBendLines/Program.cs @@ -101,7 +101,9 @@ namespace EtchBendLines foreach (var etchLine in etchLines) { - var existing = dxf.Lines.FirstOrDefault(l => l.StartPoint.IsEqualTo(etchLine.StartPoint) && l.EndPoint.IsEqualTo(etchLine.EndPoint)); + var existing = dxf.Lines + .Where(l => IsEtchLayer(l.Layer)) + .FirstOrDefault(l => l.StartPoint.IsEqualTo(etchLine.StartPoint) && l.EndPoint.IsEqualTo(etchLine.EndPoint)); if (existing != null) { @@ -117,6 +119,20 @@ namespace EtchBendLines dxf.Save(filePath); } + static bool IsEtchLayer(Layer layer) + { + if (layer.Name == "ETCH") + return true; + + if (layer.Name == "SCRIBE") + return true; + + if (layer.Name == "SCRIBE-TEXT") + return true; + + return false; + } + static void AssignBendDirections(IEnumerable bendlines, IEnumerable bendNotes) { foreach (var bendline in bendlines)