G-Code Decorator
Automatically add corner radii or chamfers to linear toolpaths. Now supports programs containing existing G02/G03 arcs.
Toolpath Visualization
Modified G-Code Output
How the G-Code Fillet & Chamfer Adder Works
The adder finds sharp corners between straight G01 moves and replaces each one with a tangent arc (a fillet) or a straight cut across the corner (a chamfer). Every other line passes through unchanged.
It reads the program line by line, keeping track of the current X and Y position, and treats each line with an X or Y word as a move from the previous point. The first move is assumed to start at X0 Y0. A corner is only changed when two G01 feed moves in X and Y follow each other directly and neither has a Z word. Rapids, existing arcs and corners separated by any other line, such as a Z move or an M code, are left as they are.
The output starts with a comment and a G90 G17 line with G20 or G21 taken from the Imperial/Metric toggle, and coordinates are written to 4 decimals in inch and 3 in metric.
How It Works
Worked Examples
G90 G54 G0 X0 Y0 G1 X2.0 Y0.0 F20. Y2.0 G3 X4.0 Y2.0 I1.0 J0 G1 X4.0 Y0.0 X0 Y0
( MODIFIED BY CORNER DECORATOR ) G90 G17 G20 G90 G54 G0 X0 Y0 G01 X1.8750 Y0.0000 F20. G03 X2.0000 Y0.1250 I0.0000 J0.1250 (Radius) Y2.0 G3 X4.0 Y2.0 I1.0 J0 G01 X4.0000 Y0.1250 G02 X3.8750 Y0.0000 I-0.1250 J-0.0000 (Radius) X0 Y0
- The corner at X2 Y0 is a left turn, so it gets G03. The move stops at X1.875 and the arc centre is X1.875 Y0.125.
- The corners next to the G3 arc are not changed, and the last corner at X0 Y0 stays sharp because no move follows it.
G0 X0 Y0 G1 X2. F20. X3. Y1.7320508
G01 X1.8557 Y0.0000 F20. G03 X2.0722 Y0.1250 I0.0000 J0.2500 (Radius) X3. Y1.7320508
- The path turns 60°, so the angle between the two moves is θ = 120°.
- t = 0.25 ÷ tan 60° = 0.1443, so the first move stops at X2 − 0.1443 = X1.8557.
- The arc ends 0.1443 along the second move at X2.0722 Y0.1250, and its centre is 0.25 straight above the start point.
J-0.0000 in the first output is how the page prints a very small negative zero. The control reads it as zero.
Tips for Using the Results
- Know whether the path is the tool centre or the part. On a tool-centre path (no G41/G42), an inside corner of the part comes out with the entered radius plus the tool radius, and an outside corner with the entered radius minus the tool radius, or sharp if that is zero or less. With cutter compensation the entered radius is the part radius, and an inside radius smaller than the tool radius will cause a compensation alarm.
- Set the unit toggle to match the program. The header line writes G20 or G21 from the toggle, so the wrong setting would rescale the whole program.
- Absolute XY programs only. The page assumes G90 and the XY plane. Incremental G91 moves give wrong corners.
- Check shortened lines. A line that ends at a modified corner is rewritten with only G01, X, Y and its F word. Any other word on that line, such as an M code or N number, and its comment are dropped.
- Backplot the output. The preview shows the new path in two dimensions. Load the program into the G-Code 3D Viewer to check it with the Z moves before cutting.
Frequently Asked Questions
Always backplot the modified program and prove it out with single block and reduced rapids. Check that the radius or chamfer suits your tool and that every line around a modified corner still does what you expect.