fix: support Excellon G02/G03 arc routing with I/J center offsets#298
Conversation
Add circular arc routing to the Excellon drill parser. G02 (clockwise) and G03 (counter-clockwise) arc commands with I/J center offsets are now parsed and rendered, using the same multi-quadrant arc algorithm as the Gerber circular interpolation code.
|
Addresses the highest-priority item in #297 (G02/G03 arc routing). |
|
Upstream dependencies:
|
|
Yes, I will probably need information in what order you have thought all your PRs should be merged? I will check all your PRs in the coming days and drop comments. |
|
Comments for future updates 1. Code duplication —
|
PR gerbv#298 added G02/G03 support but only for I/J center-offset arcs. The A radius format (e.g. G02X194478Y14182A2542) is used by some CAM tools and was completely unhandled — the parser broke out of the coordinate loop on encountering A, ignoring the arc radius. Parse the A parameter in drill_parse_coordinate(), store it in new arc_radius/found_arc_radius fields on drill_state_t, and convert radius to center offsets in drill_add_arc_segment() using chord geometry before the existing cirseg calculation. Fixes the rendering bug reported in gerbv#297.
Summary
Add circular arc routing support to the Excellon drill parser:
calc_cirseg_mqfromgerber.c) for consistent arc geometryWhy
Modern CAD tools (KiCad, Altium, etc.) emit G02/G03 arc routing commands for arc-routed slots, rounded board edges, and curved milling paths. Previously these commands were silently ignored, causing incomplete rendering of routed features.
How
drill_add_arc_segment()function insrc/drill.cthat constructs agerbv_cirseg_tfrom the start point, end point, and I/J center offsets, computing arc angles via the same quadrant logic as Gerber circular interpolationIandJoffset tokens and store them indrill_state_tdrill_add_arc_segment()instead of being ignoredTest
New test file
test/inputs/test-drill-arc-routing.exccovering:Golden reference image at
test/golden/test-drill-arc-routing.png. Test registered intest/tests.list. All pre-existing tests continue to pass (95/105 pass; 10 pre-existing failures unrelated to this change).