After splitting a drawing with a circular hole, CadConverterForm writes the split piece to DXF and re-imports it. The circle (decomposed into two semicircular arcs by DrawingSplitter) was being incorrectly merged back into a single zero-sweep arc by GeometryOptimizer.TryJoinArcs during reimport. Root cause: TryJoinArcs mutated input arc angles in-place and didn't guard against merging two arcs that together form a full circle. When arc2 had startAngle=π, endAngle=0 (DXF wrap-around from 360°→0°), the mutation produced startAngle=-π, and the merge created an arc with startAngle=π, endAngle=π (zero sweep), losing half the hole. Fix: use local variables instead of mutating inputs, require arcs to be adjacent (endpoints touching) rather than just overlapping, and refuse to merge when the combined sweep would be a full circle. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
6.7 KiB
6.7 KiB