Filter existing etch lines by layer.

This commit is contained in:
AJ
2019-09-07 10:14:29 -04:00
parent cc83752b0c
commit 80d4f78858

View File

@@ -101,7 +101,9 @@ namespace EtchBendLines
foreach (var etchLine in etchLines) 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) if (existing != null)
{ {
@@ -117,6 +119,20 @@ namespace EtchBendLines
dxf.Save(filePath); 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<Bend> bendlines, IEnumerable<MText> bendNotes) static void AssignBendDirections(IEnumerable<Bend> bendlines, IEnumerable<MText> bendNotes)
{ {
foreach (var bendline in bendlines) foreach (var bendline in bendlines)