refactor: merge DxfImporter and DxfExporter into single static Dxf class

Consolidated two stateless classes into one unified API: Dxf.Import(),
Dxf.GetGeometry(), Dxf.ExportPlate(), Dxf.ExportProgram(). Export
state moved into a private ExportContext. Removed bool+out pattern
from GetGeometry in favor of returning empty list on failure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-06 08:17:49 -04:00
parent e92208b8c0
commit 250fdefaea
20 changed files with 405 additions and 505 deletions

View File

@@ -96,13 +96,10 @@ namespace OpenNest.Mcp.Tools
if (!File.Exists(path))
return $"Error: file not found: {path}";
var importer = new DxfImporter();
if (!importer.GetGeometry(path, out var geometry))
return "Error: failed to read DXF file";
var geometry = Dxf.GetGeometry(path);
if (geometry.Count == 0)
return "Error: no geometry found in DXF file";
return "Error: failed to read DXF file or no geometry found";
var normalized = ShapeProfile.NormalizeEntities(geometry);
var pgm = ConvertGeometry.ToProgram(normalized);