CNC Path Analyzer

G41/G42 cutter radius compensation: telling left from right and writing the start-up and cancel blocks

Explains with a rectangular contour example how to tell G41 (left) from G42 (right) cutter radius compensation on a machining center by the direction of travel, D numbers and offset values, and the overcutting and alarms that occur in start-up and cancel blocks.

A function for programming straight from drawing dimensions

When milling a contour with an end mill, the tool center must travel offset from the machined surface by the tool radius. To mill the outside of a 60 mm wide shape with a Ø10 end mill, the center has to follow a path 5 mm outside on each side, that is, 70 mm wide. If this calculation is built into the program, every coordinate must be recalculated whenever the tool diameter changes.

Cutter radius compensation lets you write the drawing's contour coordinates directly in the program and has the controller calculate the tool-radius offset in real time. When the tool wears or is replaced with one of a different diameter, only the value on the offset screen has to change.

Left and right are relative to the direction of travel

G41 offsets the tool to stand on the left of the direction of travel, and G42 on the right. The reference is not the machine or the drawing but the direction in which the tool advances. Imagine driving a car: if the machined surface is outside the right-hand window, the tool is on the left (G41); if it is outside the left-hand window, the tool is on the right (G42).

When an end mill rotating forward (M03) goes around an outside contour clockwise, the tool is on the left of the contour, that is G41, and the cut is climb milling. Going around the same contour counterclockwise gives G42 and conventional milling. Typical CNC machining centers have little backlash, so climb milling is often used as the default.

Machining locationDirection of travelCompensationCutting mode (M03)
Outside (island)ClockwiseG41Climb milling
Outside (island)CounterclockwiseG42Conventional milling
Inside (pocket wall)CounterclockwiseG41Climb milling
Inside (pocket wall)ClockwiseG42Conventional milling

Example contour

The path below is a program going clockwise around the outside of a rectangle from (0,0) to (60,40). The drawing shows the contour coordinates exactly as written in the program; the actual tool center path, pushed outward by the D3 offset, is calculated by the machine from the offset value. A path visualization tool cannot know the values in the machine's offset table.

A contour path climb-milling the outside of a 60×40 rectangle with G41 D3

O3002
T3 M6
G21 G90 G17 G40 G94
G54
S4000 M03
G00 X-20. Y-20. Z50.
Z2.
G01 Z-3. F150
G41 D3 X0. Y-10. F400
Y40.
X60.
Y0.
X-10.
G40 X-20. Y-20.
G00 Z50.
M30
A contour path climb-milling the outside of a 60×40 rectangle with G41 D3 — XY pathXY
Dashed light blue is G00 rapid traverse; solid orange is cutting motion. Arcs are expanded into calculated static curves.

The figure above is the CNC Path Analyzer result for this program (rapid 3 segments, linear cutting 7 segments).

The start-up block needs a linear move

Compensation does not take effect the instant it is switched on: during the move of the block containing G41/G42, the tool shifts diagonally to the offset position. This block is called the start-up block and should normally be a linear G00 or G01 move. Many controllers raise an alarm if compensation starts in an arc block.

The start-up move must be longer than the offset value. The example starts compensation while moving about 22 mm from (-20,-20) to (0,-10), so that the tool settles on the extension below the contour start point (0,0) before cutting the first side with Y40.. Starting compensation right on the contour can cause overcutting into the machined surface during the offset move.

The cancel block and the last side

G40 is also written together with a move, so that compensation is released while the tool leaves the contour. The example extends the last side beyond the contour to X-10., then cancels while moving away with G40 X-20. Y-20.. Cancelling right at the end point of the contour can let the diagonal release move cut into the corner.

D numbers and offset values

D3 means use the value stored in line 3 of the tool offset screen. The same number as the tool number is usually used, but this is not required. The offset normally holds the tool radius, and measurement results are entered in the wear column to correct the size. If the outside comes out 0.02 mm larger than the drawing (0.01 mm per side), adjust the radius wear value by -0.01.

There is also a technique of deliberately entering an offset larger than the radius to leave a finishing allowance. Rough with a D value of 5.3 for a Ø10 tool, then change it to 5.0 and run the same program again to remove the 0.3 mm allowance as a finishing pass.

Where to check when a compensation alarm occurs

SymptomCommon cause
Alarm when compensation startsG41/G42 started in an arc block, or the start-up move is shorter than the offset
Overcut at inside cornersConsecutive non-moving blocks during compensation, or an inside arc radius smaller than the tool radius
Size wrong on one side onlyG41/G42 opposite to the direction of travel, or the wrong D number
Corner damaged after cancellingG40 right at the contour end point, with no extension move

Frequently asked questions

Are G41/G42 used in CAM programs too?
If the CAM system has already calculated and output the tool center path, compensation is turned off. There is, however, a method of outputting in "wear compensation mode", with G41/G42 and D values close to zero, so that only wear is compensated on the machine.
Do lathes have the same compensation?
Lathes use the same G41/G42 for tool nose radius compensation, which compensates the nose radius of the insert. It removes the dimensional error caused by the nose radius on tapers and arcs, and is set together with an imaginary tool tip direction number.

Next steps

Check the path in CNC Path Analyzer