mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-20 15:47:40 -05:00
fix(io): remove zero-sweep arcs during DXF import
DXF files can contain degenerate arcs where start angle equals end angle (zero sweep), often left as construction artifacts by CAD software. These create spurious shapes in ShapeBuilder — e.g. SULLYS-033.dxf showed 5 loops instead of 4 (3 cutouts + perimeter). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
9148797897
commit
f064368008
1 file changed
+7
@@ -27,6 +27,7 @@ namespace OpenNest.IO
|
||||
var dxf = Dxf.Import(path);
|
||||
|
||||
RemoveDuplicateArcs(dxf.Entities);
|
||||
RemoveZeroSweepArcs(dxf.Entities);
|
||||
|
||||
var bends = new List<Bend>();
|
||||
if (options.DetectBends && dxf.Document != null)
|
||||
@@ -141,6 +142,12 @@ namespace OpenNest.IO
|
||||
return drawing;
|
||||
}
|
||||
|
||||
internal static void RemoveZeroSweepArcs(List<Entity> entities)
|
||||
{
|
||||
entities.RemoveAll(e =>
|
||||
e is Arc arc && arc.StartAngle.IsEqualTo(arc.EndAngle, Tolerance.ChainTolerance));
|
||||
}
|
||||
|
||||
internal static void RemoveDuplicateArcs(List<Entity> entities)
|
||||
{
|
||||
var circles = entities.OfType<Circle>().ToList();
|
||||
|
||||
Reference in new issue
Block a user