What are G41 and G42?
In CNC machining, G41 and G42 are G-codes used for Cutter Radius Compensation. They tell the machine controller to shift the tool path to the left or right of the programmed line by the radius of the cutting tool.
1. G41 (Left Compensation):
Compensates the tool to the left of the programmed path. This is most commonly used for Climb Milling when machining an outside profile with a right-hand tool.
2. G42 (Right Compensation):
Compensates the tool to the right of the programmed path. This is used for Conventional Milling on an outside profile.
3. G40:
Cancels any active cutter compensation.
CNC machines follow the coordinates you give them based on the centerline of the spindle. If your blueprint says a wall is at X = 50, and you tell the machine G01 X50.0, the exact center of the tool will move to that 50mm mark. Since the tool has a physical width (radius), the edge of the cutter will extend past that 50mm mark.
You have two choices when programming, first choice is to programming with G41/G42 and second choice is to programming the centerline.
1. Programming with G41/G42:
• If using a 10mm cutter, the edge of the tool is 5mm away from the center. It will cut 5mm deep into your finished part. In Manual Fix, you would have to do the math yourself. If the part is at X=50 and you have a 10mm tool, you would program the path at X=55.• You write the G-code using the exact dimensions from the blueprint. If the blueprint says a part is 100mm wide, your code says X100.0.
• If your 10mm endmill breaks and you only have a 12mm endmill left, you do not change the program. You just change the "Offset" value on the machine screen from 5.0 to 6.0, and the machine automatically shifts the path further out.
2. Programming the centerline.
• In Modern Fix, you program X=50 exactly as it appears on the blueprint, and the controller does the math for you.• You manually calculate the path so the center of the tool stays exactly one radius away from the part at all times. If the wall is at X=50 and you are using a 10mm tool (5mm radius), you program X55.0.
• If you decide to use an 8mm tool later, your X55.0 code is now wrong. You would have to go back to your computer, change the math, and re-post the entire program.
Why do we need it?
When you program a part, you usually program the actual dimensions of the finished workpiece i.e. blueprint line. However, the CNC machine moves the center of the spindle. Without compensation, if you drive the center of a 10mm endmill directly along a wall, you will over-cut the part by 5mm i.e. the tool's radius.Compensation allows you to program the part's exact dimensions rather than calculating tool center coordinates manually.
As a tool wears down and becomes slightly smaller, you don't need to change the program. You simply update the tool radius value in the machine’s offset table, and the controller adjusts the path automatically.
You can use a different size tool (e.g., switching from a 12mm to a 10mm endmill) for the same program just by changing the offset value.
How to use it?
To use compensation safely, You must activate G41/G42 on a "lead-in" move. This is a linear move that is larger than the tool's radius. This gives the controller room to ramp the tool over to the compensated. The machine looks at the "D" word (e.g., G41 D1) to know which tool's radius to pull from the offset library. You must cancel the compensation using G40 during a "lead-out" move away from the part.e.g.
G01 G41 D1 X20.0 Y10.0 F150 (Move to start, compensating to the left using Tool 1's radius)
G01 Y50.0 (Machine the wall)
G01 X50.0 (Machine the next wall)
G40 G01 X70.0 (Move away and cancel compensation)
How the Controller Offsets the Tool?
When you activate G41 (Left) or G42 (Right), the controller looks at the Radius Value stored in your machine's Offset Table usually under the "D" column. The controller looks at the next line of code to see which direction the tool is turning. It calculates a perpendicular vector equal to the tool radius. It shifts the entire tool path by that radius. If you change your tool to an 8mm endmill, you only change the "D" value in the machine settings; you don't have to change a single line of your G-code.How to determine whether to use G41 or G42?
If the part is on Left side of your tool, use G41. This is the standard for Climb Milling, where the tool walks along the material.If the part is on Right side of your tool, use G42. This is the standard for Conventional Milling.
You cannot turn on compensation while the tool is already touching the part. Because the machine has to shift the tool by the radius, it needs a start-up move to transition from the centerline to the compensated path.
If you activate G41 while the tool is at the final part dimension, the machine will "kick" over by the radius amount while inside the material, likely breaking the tool or gouging the part.
When you write G41 D1, the machine looks at the D-offset row for Tool 1. D tells the machine: "Go look at the offset table for Tool #1." If that table says 5.000, the machine shifts exactly 5mm. If the table is 0, the machine moves exactly on the centerline and you will over-cut the part.
Most modern Fanuc controllers have a Geometry column and a Wear column. You put the actual tool radius (e.g., 5.0) in Geometry. If the part comes off the machine 0.02mm too big, you put -0.01 in the Wear column to "nudge" the tool closer.
e.g.
T01 M06 (Load Tool 1)
G00 G90 G54 X0 Y-20.0 S1200 M03 (Rapid to start position, Start Spindle)
G43 H01 Z5.0 M08 (Activate Height compensation for Tool 1, move to 5mm above part)
G01 Z-10.0 F100 (Feed to depth)
G41 D01 X20.0 (Activate Radius compensation while moving to the part wall)
G43: Height Compensation (Tool Length Compensation):
We are going to explain the concept of G43 (Tool Length Compensation) in a different way, focusing on the machine's zero and how the tool length offsets are stored and used. Imagine you have multiple tools in your CNC machine's carousel like a drill, an end mill, a chamfer tool. Each has a different physical length. If you programmed all tools to move to Z0 i.e. the top of your part, the longer tools would crash into the part or the shorter tools wouldn't touch it. To solve this, we measure and store the length of each tool in a table i.e. the Tool Length Offset Table, often using H-codes. G43 activates this compensation.In simple terms, G43 is a CNC machining command that tells the machine, "Use the stored length of this specific tool when calculating Z-axis movements." It's like telling the machine how much taller or shorter your current tool is compared to a reference tool. G43 Height Compensation is the mechanism that allows a CNC machine to use tools of different physical lengths accurately and safely within the same program by applying a stored length correction value (H-offset). It is absolutely fundamental to multi-tool CNC machining. This is done by measuring the length of each tool i.e. the distance from the spindle nose to the tool tip and storing that value in an offset register like H1, H2 etc. Then, when we use G43 with an H code, the CNC control adjusts the Z-axis movement by adding the tool length offset value to the commanded Z position.
The tool length offset value is typically a negative number because the tool tip is below the spindle nose. So, if the tool is 200 mm long, the offset might be -200.0 mm.
The H-value isn't the tool's physical length in millimeters that you'd measure with a ruler. It's how much compensation needs to be applied relative to either: A reference tool (common in manual setups), or the spindle face (common with automatic tool presetters)
1. Reference Tool Method:
When you measure one tool say, a 100mm drill as your reference. You set this as your Z-zero on the workpiece. Then, when you measure a shorter tool say, 90mm, the machine calculates: Current tool tip position minus reference tool position = -10mm. This -10mm gets stored in H2, not the full 90mm. A longer tool (110mm) would get +10mm stored.2. Spindle Face Method:
The machine knows where its spindle face is. When you touch off a tool to a known surface like a 100mm block on the table, it calculates: Distance from spindle face to tool tip = Tool Length. This length is stored as a negative value say, -200mm for a 200mm long tool. So in H1, you'd have -200.0.How it works in the control:
Let's say we have machine coordinate system whose machine zero is at spindle nose. We set the workpiece Z zero at the top of the part. We want to move the tool tip to Z0 on the part.Without compensation, Commanded Z0 would move the spindle nose to Z0, so the tool tip would be below the part by the
tool length and would crash.
With compensation (G43 Hxx):
The control calculates:
Actual spindle position = Commanded Z position- Tool length offset
e.g.
For a tool with length offset HO1 = -200.0:
Command: G43 H01 ZO
Calculation: Spindle Z = 0-(-200.0) = 200.0
So the spindle moves to Z200.0 in machine
coordinates, which puts the tool tip at Z0, because the tool is 200 mm long.
In the example above, the machine zero is at the spindle nose, and the part ZO is at the top of the part. So when the spindle is at Z200.0 (machine coordinate), the tool tip, which is 200 mm below is at machine Z0. However, wait, that would put the tool tip at the machine's zero point i.e. spindle nose level and not at the part. This is where the workpiece coordinate system (G54, etc.) comes in. The part Z zero is set at the top of the part, which is at some distance from the machine zero.
Visual Example:
Spindle Face (Machine Zero)|
| 200mm gap
|
[Drill Tip 1] - This tool's offset: H1 = -200.0
Spindle Face (Machine Zero)
|
| 180mm gap
|
[Drill Tip 2] - This tool's offset: H2 = -180.0
Spindle Face (Machine Zero)
|
| 220mm gap
|
[Drill Tip 3] - This tool's offset: H3 = -220.0
When you program G43 H1 Z0, the machine thinks: The programmer wants the tool tip at Z0. But H1 says this tool's tip is 200mm below the spindle. So I need to move the spindle down by 200mm to put the tip at Z0.
Actual calculation:
Spindle position = Commanded Z position - H value
Z0 - (-200) = +200mm movement
So yes, H1, H2, H3 are memory locations that store how much each tool hangs down from the spindle face. The values are typically negative because the tools extend downward.
e.g.
Think of it as a library of tool lengths:
1. Tool #1 (End Mill): Length offset = H01 = -200.0 mm (It's 200mm long from the spindle face to its tip).
2. Tool #2 (Drill): Length offset = H02 = -180.0 mm (It's 20mm shorter).
Without G43: You command Z0, the spindle moves its physical zero point to the part's Z-zero. Disaster.
With G43: You command:
T01 M06 (Load Tool #1 - the long end mill)
G43 H01 (Activate compensation using offset #1)
Z0 (The machine calculates: Spindle Position = 0 + (-200.0) = -200.0 mm. It moves the spindle lower so the tool tip is at Z0.)
T02 M06 (Load Tool #2 - the shorter drill)
G43 H02 (Activate offset #2)
Z0 (Machine calculates: 0 + (-180.0) = -180.0 mm. It moves the spindle less far down so this shorter tool's tip is at Z0.)
The tip of every tool now reaches the programmed Z position correctly.
G43 command activate tool length compensation i.e. positive direction. It's modal, it stays on until canceled. While G49 command to cancel tool length compensation. H-code is a address that calls the specific offset value from the table like H01, H02. The H number usually matches the tool number like T01 uses H01, but it doesn't have to. Tool length offset value is the measured length difference, stored in the machine's control. It's typically a negative number i.e. distance from spindle gauge line to tool tip.
Precautions to take when using height compensation:
• G43 is used for the positive direction. G44 is for negative compensation and is rarely used. • G43 must be called before any Z-axis movement to the workpiece. It's often done in the rapid move to the initial safe height.
• Forgetting G49 or G43/H for a new tool is a common cause of crashes. The machine will use the previous tool's offset.
• G43 compensates based on the workpiece's Z-zero (G54, G55, etc.). If Z-zero is wrong, all compensated tools will be wrong.
• You can also have a small wear value in the offset table to adjust for tool regrinding or minor sizing, added to the main length offset.
Methods for setting tool length offsets:
1. Automatic Tool Presetter: A device outside the machine measures each tool precisely. The offset values are manually entered or sent to the CNC control.2. Probe in the Machine (Automatic): The machine uses a touch probe (like a Renishaw probe) to automatically touch each tool and calculate its length.
3. Manual Setting (Touching Off): Place a known height (e.g., a 1-2-3 block, gauge block, or the part itself) on the workpiece Z-zero. Jog the tool down until it just touches the top of the block. In the offset table, for that H-number, you set the value to the height of the block. Many controls have a measure or set tool length function that does this calculation automatically.
0 Comments