CNC

Cutter compensation (G41/G42)

G41 or G42 for your profile or pocket, with the lead-in and a program block.

Compensation

G41: climb

Going clockwise round the outside, the tool must sit to the left of the path, looking the way it travels. With M03 and a right-hand tool that is climb milling.

Outside corners: the tool rolls round each one on a 0.25 radius, so the part keeps its sharp corners.

Cutting
Direction round it
Units

At least the tool radius

LinuxCNC: the tool number

The paths

Solid: the programmed path, lead-in to lead-out, with the arrow showing the way round. Dashed: where the tool centre runs. The circle is the tool at the end of the lead-in.

G41: the tool centre runs outside the programmed path by the tool radius

Program

Check this program
(OUTSIDE PROFILE 2. X 1., CLIMB - G41 D1)
G90 G17 G40 G54
G00 X1. Y-0.5
G00 Z0.1
G01 Z-0.25 F20.
G01 G41 D1 Y0. (COMP ON: LEAD-IN 0.5 >= R 0.25)
X0.
Y1.
X2.
Y0.
X1.
G40 G01 Y-0.5 (COMP OFF ON THE LEAD-OUT)
G00 Z0.1

What alarms, by control

  • Mach4: comp switched on in a block with an arc is an error; a lead-in or lead-out shorter than the offset is an error; any segment shorter than the offset is likely to gouge.
  • LinuxCNC: the lead-in must be at least the tool radius (a rapid will do); turning comp on when it is already on is an error; D is the tool number, not a register.
  • Haas: D picks the offset; a negative value in it swaps G41 and G42. Turn comp on after G68 rotation and off before G69.
  • Fanuc: not shown: no two published copies of its alarm text were found.

Sources: Haas Automation, mill G41/G42; LinuxCNC documentation, G41/G42 and Cutter Compensation; Mach4 Mill Programming Guide v1.1 (Artsoft), chapter 4.

What next

Will this program run clean?A searchable G and M code list, and a checker that flags common program mistakes.
What I and J for this arc?Arc centers I, J, K for G02 and G03 from a radius, and back again.
What feed rate for this end mill?End mill RPM, chip load and feed rate for your material, cutter and cut.
How the cutter compensation (G41/G42) works

Climb milling round the outside of a part runs clockwise seen from above, with the tool left of the path: G41. Inside a pocket, climb runs counterclockwise and is still G41; G42 is conventional milling either way. A 0.5" end mill rides 0.25" off the path, so the lead-in must be a straight move at least 0.25" long.

How cutter compensation works: G41, G42 and the lead-in

Maintained by John, former CNC lathe programmer

What it calculates

Cutter compensation lets you program the part’s own outline and have the control shift the tool sideways by its radius. G41 puts the tool on the left of the path, G42 on the right, judged looking the way the tool is travelling; G40 turns it off. The radius lives in an offset (D), so a resharpened or different-size tool needs no new program, and the operator can trim a size by nudging the offset.

This explainer works out which side your feature needs, whether that is climb or conventional milling, draws the programmed and tool-centre paths for a rectangle with a square lead-in and lead-out, writes the block, and flags the setups each control would alarm on or gouge.

The formulas

Which side

outside + clockwise → G41

inside + counterclockwise → G41

the other ways → G42

clockwise
as seen from above (+Z), going round the feature
G41
with M03 and a right-hand tool, climb milling

Lead-in

lead-in ≥ tool radius, on a straight (G00/G01) move

tool radius
the D offset; Mach4 wants the lead-in strictly longer than it

Worked example

A 2 × 1 rectangular boss, profiled with a 1/2" end mill, climb milling, D1.

  1. Outside and climb: clockwise round it, tool on the left: G41.
  2. Radius 0.25": the tool centre runs 0.25" outside every side and rolls round each corner on a 0.25" radius.
  3. Lead in from X1. Y-0.5 straight up to the middle of the bottom edge: 0.5" ≥ 0.25", so comp can come on.
  4. Run X0., Y1., X2., Y0., X1., then G40 on the straight move back down to Y-0.5.

G01 G41 D1 Y0. on the lead-in, G40 G01 Y-0.5 on the lead-out.

How to use it

What you enter

Outside or inside
A profile round a boss, or the wall of a pocket.
Direction
Which way round, as seen from above.
Size, tool and lead-in
The rectangle, the tool Ø, and how long the straight lead-in is.
Depth, feed and D
For the program; on LinuxCNC D is the tool number, elsewhere the offset register.

What you get

G41 or G42
With the reason, and climb or conventional.
Drawing
The programmed path, the tool-centre path and the tool, to scale.
Program and alarms
A commented block and what each control does with a bad lead-in, an arc or a narrow pocket.

Common mistakes

  • Turning comp on in an arc. Mach4 calls it an error. Use a straight lead-in, then arc in if you want a soft entry.
  • A lead-in shorter than the radius. The control has no room to step over to the offset path: an alarm or a gouge.
  • A pocket or a step smaller than the tool. The offset paths cross and the tool cuts where it shouldn’t. Mach4 warns that any segment shorter than the offset is likely to gouge.
  • Expecting sharp inside corners. Inside, the corners keep the tool’s radius. Use a smaller tool for a tighter corner.
  • Left and right from the operator’s side. Left and right are judged looking along the travel, not from where you stand.

Sources

The side rule (looking along the travel), the lead-in and lead-out rules and the gouge warnings are from each control’s maker: Haas’s G41 page, the LinuxCNC documentation and Artsoft’s Mach4 and Mach3 manuals. The paths are geometry. Fanuc’s alarm text is not shown: no two published copies were found.

How we pick and check sources