From 0f5aace1269349660f3a823578c0299639e1d777 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Fri, 10 Apr 2026 13:03:16 -0400 Subject: [PATCH] refactor(console): use CadImporter for DXF import Co-Authored-By: Claude Sonnet 4.6 --- OpenNest.Console/Program.cs | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/OpenNest.Console/Program.cs b/OpenNest.Console/Program.cs index c819812..3711f4b 100644 --- a/OpenNest.Console/Program.cs +++ b/OpenNest.Console/Program.cs @@ -1,5 +1,4 @@ using OpenNest; -using OpenNest.Converters; using OpenNest.Geometry; using OpenNest.IO; using System; @@ -241,25 +240,15 @@ static class NestConsole static Drawing ImportDxf(string path) { - var geometry = Dxf.GetGeometry(path); - - if (geometry.Count == 0) + try { - Console.Error.WriteLine($"Error: failed to read DXF file or no geometry found: {path}"); + return CadImporter.ImportDrawing(path); + } + catch (System.Exception ex) + { + Console.Error.WriteLine($"Error: failed to import DXF '{path}': {ex.Message}"); return null; } - - var normalized = ShapeProfile.NormalizeEntities(geometry); - var pgm = ConvertGeometry.ToProgram(normalized); - - if (pgm == null) - { - Console.Error.WriteLine($"Error: failed to convert geometry: {path}"); - return null; - } - - var name = Path.GetFileNameWithoutExtension(path); - return new Drawing(name, pgm); } static void ApplyTemplate(Plate plate, Options options)