feat: improve DXF export and cross-platform file handling

- PepSettings: add DrawingsDirectory property for DXF endpoint config
- DrawingDxfExporter: support subprogram calls, skip non-cut linear moves,
  remove spurious radians-to-degrees conversion on arc angles, set AC1018 DXF version
- DrawingReader: handle .loop-info/.cadsnapshot entries gracefully, derive
  DrawingInfo from loop names when .info entry is absent, use FileShare.Read
- DrawingInfoReader: use TryParse instead of Parse for material number
- Drawing: make GetLoopName public (used by DrawingDxfExporter)
- ZipHelper: use FileShare.Read to allow concurrent readers on Windows/Linux
- NestFilterData: skip status filter when value is "All"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
aj
2026-06-27 07:23:12 -04:00
co-authored by Claude Sonnet 4.6
parent 5e0856b5d1
commit 85f6a50f1a
7 changed files with 139 additions and 82 deletions
+23 -9
View File
@@ -1,5 +1,4 @@
using PepLib.Models;
using System.Diagnostics;
using System.IO.Compression;
using System.Text.RegularExpressions;
@@ -38,6 +37,11 @@ namespace PepLib.IO
LoadInfo(memstream);
memstream.Close();
continue;
case ".loop-info":
case ".cadsnapshot":
memstream.Close();
continue;
}
if (Regex.IsMatch(extension, "loop-\\d\\d\\d"))
@@ -47,6 +51,9 @@ namespace PepLib.IO
}
}
if (Drawing.Info == null)
Drawing.Info = DeriveInfoFromLoops();
Drawing.ResolveLoops();
}
@@ -62,7 +69,7 @@ namespace PepLib.IO
try
{
stream = new FileStream(nestFile, FileMode.Open);
stream = new FileStream(nestFile, FileMode.Open, FileAccess.Read, FileShare.Read);
Read(stream);
}
finally
@@ -74,15 +81,22 @@ namespace PepLib.IO
private void LoadInfo(Stream stream)
{
try
Drawing.Info = DrawingInfo.Load(stream);
}
private DrawingInfo DeriveInfoFromLoops()
{
var info = new DrawingInfo();
if (Drawing.Loops.Count > 0)
{
Drawing.Info = DrawingInfo.Load(stream);
}
catch (Exception exception)
{
Debug.WriteLine(exception.Message);
Debug.WriteLine(exception.StackTrace);
// Loop names follow the pattern "{DrawingName}.loop-XXX"
var loopName = Drawing.Loops[0].Name;
var suffix = loopName.LastIndexOf(".loop-", StringComparison.OrdinalIgnoreCase);
info.Name = suffix >= 0 ? loopName.Substring(0, suffix) : loopName;
}
return info;
}
private Loop ReadLoop(string name, Stream stream)