From b0e48442ca58dbbece069f8146a48a674a4ee5b6 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Thu, 19 Feb 2026 12:37:22 -0500 Subject: [PATCH] fix: return etch lines and support additional bend layer names - Fix GetEtchLines() using yield break instead of return lines, which caused all etch lines to be silently discarded - Support BEND LINES and BENDLINES layer names in addition to BEND - Move all bend lines to BEND layer before processing - Migrate csproj from .NET Framework 4.8 to SDK-style net8.0-windows Co-Authored-By: Claude Opus 4.6 --- EtchBendLines/BendLineExtractor.cs | 13 +++++- EtchBendLines/EtchBendLines.csproj | 74 ++++++------------------------ EtchBendLines/Etcher.cs | 20 +++++--- 3 files changed, 38 insertions(+), 69 deletions(-) diff --git a/EtchBendLines/BendLineExtractor.cs b/EtchBendLines/BendLineExtractor.cs index fc62ee3..f79119c 100644 --- a/EtchBendLines/BendLineExtractor.cs +++ b/EtchBendLines/BendLineExtractor.cs @@ -68,7 +68,18 @@ namespace EtchBendLines private bool IsBendLine(Line line) { - return line.Linetype.Name == "CENTERX2" && line.Layer.Name == "BEND"; + if (line.Linetype.Name != "CENTERX2") + return false; + + switch (line.Layer.Name.ToUpperInvariant()) + { + case "BEND": + case "BEND LINES": + case "BENDLINES": + return true; + default: + return false; + } } private List GetBendNotes() diff --git a/EtchBendLines/EtchBendLines.csproj b/EtchBendLines/EtchBendLines.csproj index d85932b..7864aa4 100644 --- a/EtchBendLines/EtchBendLines.csproj +++ b/EtchBendLines/EtchBendLines.csproj @@ -1,69 +1,21 @@ - - - + + - Debug - AnyCPU - {229C2FB9-6AD6-4A5D-B83A-D1146573D6F9} - Exe + net8.0-windows + Library + disable + disable EtchBendLines EtchBendLines - v4.8 - 512 - true - - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true + false + - - - - - - - - - + + - - - - - - - - + - - - - - - {785380e0-ceb9-4c34-82e5-60d0e33e848e} - netDxf - - - - \ No newline at end of file + + diff --git a/EtchBendLines/Etcher.cs b/EtchBendLines/Etcher.cs index 9a9f6ff..5b9ea95 100644 --- a/EtchBendLines/Etcher.cs +++ b/EtchBendLines/Etcher.cs @@ -40,12 +40,10 @@ namespace EtchBendLines } } - private IEnumerable ExtractUpBends(DxfDocument doc) + private List ExtractBends(DxfDocument doc) { - // your existing BendLineExtractor logic var extractor = new BendLineExtractor(doc); - return extractor.GetBendLines() - .Where(b => b.Direction == BendDirection.Up); + return extractor.GetBendLines(); } private HashSet BuildExistingKeySet(DxfDocument doc) @@ -93,7 +91,15 @@ namespace EtchBendLines Console.WriteLine(filePath); var doc = LoadDocument(filePath); - var upBends = ExtractUpBends(doc); + var bends = ExtractBends(doc); + + // Ensure all bend lines are on the BEND layer + foreach (var bend in bends) + { + bend.Line.Layer = BendLayer; + } + + var upBends = bends.Where(b => b.Direction == BendDirection.Up); var existing = BuildExistingKeySet(doc); InsertEtchLines(doc, upBends, existing, etchLength); @@ -119,7 +125,7 @@ namespace EtchBendLines } } - private IEnumerable GetEtchLines(Line bendLine, double etchLength) + private List GetEtchLines(Line bendLine, double etchLength) { var lines = new List(); @@ -176,7 +182,7 @@ namespace EtchBendLines line.Layer = EtchLayer; } - yield break; + return lines; } } }