fix: support A (radius) parameter for Excellon G02/G03 arcs#345
Open
rampageservices wants to merge 1 commit intogerbv:developfrom
Open
fix: support A (radius) parameter for Excellon G02/G03 arcs#345rampageservices wants to merge 1 commit intogerbv:developfrom
rampageservices wants to merge 1 commit intogerbv:developfrom
Conversation
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.
This was referenced Mar 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for the
A(radius) parameter in Excellon G02/G03 arc routing commands. PR #298 added G02/G03 support but only for I/J center-offset arcs. TheAradius format is used by some CAM tools (e.g. the file in #297's latest comment) and was completely unhandled — when the parser encounteredA, it broke out of the coordinate loop and ignored the arc radius.Format:
Changes
Parsing —
drill_parse_coordinate()now recognizes theAparameter alongside X/Y/I/J and stores it in newarc_radius/found_arc_radiusfields ondrill_state_t.Geometry —
drill_add_arc_segment()converts radius to center offsets (delta_cp) whenfound_arc_radiusis set, using chord geometry:h = sqrt(r² - (d/2)²)After conversion, the existing cirseg calculation works unchanged — it receives center offsets regardless of whether they came from I/J or were derived from A.
Edge cases:
State reset —
found_arc_radiusis cleared alongsidedelta_cp_x/yafter tool-up repositions and after arc segment creation.Test
New from-scratch test file
test-drill-arc-radius.excwith:AparameterAparameterTest suite: 96 passed (was 95), 0 skipped (was 1), 10 pre-existing failures unchanged.
Fixes the rendering bug reported by FrankOnGit in #297.