diff --git a/OpenNest.IO/DxfImportResult.cs b/OpenNest.IO/DxfImportResult.cs new file mode 100644 index 0000000..d329cef --- /dev/null +++ b/OpenNest.IO/DxfImportResult.cs @@ -0,0 +1,12 @@ +using ACadSharp; +using OpenNest.Geometry; +using System.Collections.Generic; + +namespace OpenNest.IO +{ + public class DxfImportResult + { + public List Entities { get; set; } = new(); + public CadDocument Document { get; set; } + } +} diff --git a/OpenNest.IO/DxfImporter.cs b/OpenNest.IO/DxfImporter.cs index 3aca509..96bdb7c 100644 --- a/OpenNest.IO/DxfImporter.cs +++ b/OpenNest.IO/DxfImporter.cs @@ -65,6 +65,24 @@ namespace OpenNest.IO return entities; } + /// + /// Imports a DXF file, returning both converted entities and the raw CadDocument + /// for bend detection. The CadDocument is NOT disposed — caller can use it for + /// additional analysis (e.g., MText extraction for bend notes). + /// + public DxfImportResult Import(string path) + { + using var reader = new DxfReader(path); + var doc = reader.Read(); + var entities = GetGeometry(doc); + + return new DxfImportResult + { + Entities = entities, + Document = doc + }; + } + public bool GetGeometry(Stream stream, out List geometry) { var success = false;