From bf36a56387da18f8f802b08c816bc7b078f6b921 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Thu, 19 Feb 2026 14:33:59 -0500 Subject: [PATCH] fix: detect bend lines from SolidWorks DXF exports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three issues prevented bend line detection after the ACadSharp migration: 1. IsBendLine required layer "BEND" but SolidWorks exports bend lines on layer "0" with CENTERX2 linetype. Added "0" as accepted layer. 2. Bend note regex used literal ° which failed when ACadSharp reads the degree symbol as multi-byte "°" due to ANSI/UTF-8 encoding mismatch. Changed to [^R\d]* to tolerate any characters between angle and R. 3. Radius filter excluded bends with null Radius (unparsed notes). Nullable comparison null <= 4.0 evaluates to false in C#, filtering out all bends. Added null check to include unparsed bends. Co-Authored-By: Claude Opus 4.6 --- EtchBendLines/BendLineExtractor.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/EtchBendLines/BendLineExtractor.cs b/EtchBendLines/BendLineExtractor.cs index bf293d6..d37c816 100644 --- a/EtchBendLines/BendLineExtractor.cs +++ b/EtchBendLines/BendLineExtractor.cs @@ -36,7 +36,7 @@ namespace EtchBendLines /// The regular expression pattern the bend note must match /// static readonly Regex bendNoteRegex = new Regex( - @"\b(?UP|DOWN|DN)\s+(?\d+(\.\d+)?)°?\s*R\s*(?\d+(\.\d+)?)\b", + @"\b(?UP|DOWN|DN)\s+(?\d+(\.\d+)?)[^R\d]*R\s*(?\d+(\.\d+)?)\b", RegexOptions.Compiled | RegexOptions.IgnoreCase ); @@ -66,7 +66,7 @@ namespace EtchBendLines AssignBendDirections(bends, bendNotes); - return bends.Where(b => b.Radius <= MaxBendRadius).ToList(); + return bends.Where(b => b.Radius == null || b.Radius <= MaxBendRadius).ToList(); } private bool IsBendLine(Line line) @@ -76,6 +76,7 @@ namespace EtchBendLines switch (line.Layer.Name.ToUpperInvariant()) { + case "0": case "BEND": case "BEND LINES": case "BENDLINES":