Guide to G40 Tool Nose & Cutter Radius Compensation Cancel
Learn how to program G40 tool nose and cutter radius compensation cancel on Fanuc, Siemens, and Mitsubishi CNC controls to prevent spindle and turret collisions.
Introduction
An operator initiating a rapid retraction sequence at the end of a critical turning pass watches in horror as the machine turret does not clear the workpiece. Instead, the toolholder slams directly into the rotating spindle chuck, shattering the carbide insert, bending the spindle axis, and halting the machine with a severe servo overload alarm. This catastrophic hard collision, which leaves the raw stock as a ruined scrap part, is the classic consequence of failing to cancel tool nose radius compensation (G40) before executing subsequent rapid coordinates or zero-return cycles. When cutter compensation (G41 or G42) is active, the CNC motion kernel continuously calculates an offset path perpendicular to the programmed contour. Without an explicit G40 cancellation command, the tool center point remains shifted by the offset vector. Any subsequent movement, including machine zero returns, can translate this offset path into an unpredictable trajectory that forces the cutting tool directly into workholding fixtures, rotating chucks, or the workpiece itself.
Technical Summary
| Field | Details |
|---|---|
| Command Code | G40 |
| Modal Group | Group 07 (Modal preparatory G-code, cancels G41 and G42) |
| Supported Brands | Fanuc, Siemens, Mitsubishi |
| Critical Parameters | Parameter No. 3402 Bit 6 (Fanuc CLR reset), MD 10760 (Siemens G53 tool correction suppression), Parameter No. 1210 (Mitsubishi RstGmd) |
| Main Constraint | Must be programmed in positioning (G00) or linear interpolation (G01) mode; clearance must exceed double tool nose radius; plane changes (G17/G18/G19) are prohibited while active. |
Quick Read
- Program G40 with Motion: Always command G40 in a block with physical coordinates using G00 or G01 to ensure the compensation vector collapses safely during travel.
- Verify Clearance Envelopes: Ensure the retract clearance is larger than double the tool nose radius (or four times the radius in diameter programming) to prevent interference halts.
- Execute Cancel Before Plane Changes: Deactivate active compensation with G40 before executing plane selection commands (G17/G18/G19) to avoid coordinate failures.
- Do Not Assume Zero Returns Cancel Offset: Never assume G28 or G30 reference returns cancel radius offset; the vector remains active in memory until explicitly canceled by G40.
- Avoid Circular Moves in G40 Block: Refrain from programming G02 or G03 circular interpolation in the G40 cancel block to prevent immediate program alarms.
- Limit Non-Movement Blocks: Keep consecutive non-motion blocks (such as dwells or auxiliary M-codes) below N − 2 to avoid look-ahead pre-read calculation overruns.
- Coordinate Tool Register Changes: Complete the G40 cancel cycle before switching tool offset numbers (H-code/D-code) or commanding G49 length cancellation.
Basic Concepts
Deactivating tool radius or nose radius compensation using G40 is a critical phase of the machining cycle, transitioning the CNC from a dynamically calculated offset path back to its absolute programmed coordinates. When a tool moves around a workpiece contour under active compensation (G41 or G42), the control's motion kernel continuously calculates an equidistant path offset by the cutter or tool nose radius. Upon parsing a G40 command, the active compensation vector is reduced to zero, and the tool center point translates from the compensated offset trajectory back to the uncompensated target coordinate over the duration of the cancel block.
Programmers must ensure that the retraction movement is programmed in a safe direction and with sufficient clearance. If the clearance distance is too small (e.g., less than twice the tool nose radius), the tool cannot fit into the provided workspace, triggering a cutter radius interference alarm and halting the machine. In close proximity to machine boundaries, path deviations caused by insufficient clearance can cause the toolholder or turret to strike fixtures, vise jaws, or the rotating spindle chuck, resulting in a severe physical crash.
Additionally, tool offset number changes (T-code or D-code) and tool length cancellations (G49) must never be commanded while cutter compensation is active. Doing so interrupts the look-ahead pre-read buffer, resulting in sudden deceleration to a stop and potential overcutting or undercutting, which ruins the workpiece. To avoid collisions, a dedicated safety line should always cancel radius compensation (G40) and tool length offsets in absolute positioning mode (G90) with ample clearance before a tool change or zero return is initiated.
Command Structure
The command structure for deactivating tool radius or nose radius compensation revolves around G40, which is modal and remains active until G41 or G42 is called. Depending on the CNC control system and whether the operation is turning or milling, the G40 command is typically combined with a physical motion command (G00 or G01) and target coordinates. In turning applications, G40 can also be programmed with vector modifiers (I and K) to specify a custom retraction angle at the final contour endpoint.
On Fanuc and Mitsubishi controls running in lathe mode, absolute coordinates (X, Z) or incremental movements (U, W) define the physical target for the retraction move. Siemens controls, while supporting similar syntax, handle the retraction path globally using modal commands like NORM or KONT to determine whether the retraction path is perpendicular to the contour or follows an arc during G40 execution. Additionally, active tool compensation offsets can be suppressed without coordinate motion by assigning a register of zero (D00 or T00) in the G40 block.
Fanuc and Mitsubishi Syntax: G40 G00 X(U)__ Z(W)__ I__ K__ ;Siemens Native Mode Syntax: G40 NORM G00 X_ Z_ ; G40 KONT G00 X_ Z_ ;
Register Deactivation Syntax: G40 D00 ; G40 T0000 ;
| Brand | Parameter | Description | Valid Range |
|---|---|---|---|
| Fanuc | Parameter No. 3402 Bit 6 (CLR) | Configures reset modal behavior. 0 = retain compensation mode upon reset; 1 = revert Group 07 to default G40. | 0 or 1 |
| Fanuc | Parameter No. 5000 Bit 3 (GNI) | Determines path vector deletion behavior in G40 block with vector modifiers and no motion. | 0 or 1 |
| Fanuc | Parameter No. 5003 Bit 0 (SUP) | Startup and cancel movement type. 0 = Type A (no intersection calculations); 1 = Type B (calculates path intersection points). | 0 or 1 |
| Fanuc | Parameter No. 19625 | LOOK-AHEAD buffer pre-read limit (N). Stacking more than N − 2 consecutive non-movement blocks in offset mode causes calculation failure. | Positive integer |
| Siemens | MD 10760 $MN_G53_TOOLCORR | Channel-specific tool correction suppression parameter. If 1, active length and radius compensations are suppressed during G53. | Byte, default 2 |
| Siemens | MD 20250 | Look-ahead buffer consecutive block interruption limit (default 3 blocks). If exceeded without motion, calculations fail. | Positive integer |
| Siemens | DISC | Transition circle overshoot at outer corners. Modal parameter used with G450. | 0 to 100 |
| Siemens | OFFN | Allowance on programmed contour (normal contour offset), shifts equidistant tool path. | Linear measurement |
| Siemens | $MM_ACTIVATE_SEL_USER_DATA | Specifies if tool offset changes take effect immediately in program stop mode. | Boolean |
| Mitsubishi | Parameter No. 8157 | Configures deactivation transition type. 0 = Type A, 1 = Type B. | 0 or 1 |
| Mitsubishi | Parameter No. 1381 Bit 0 (TolOfsCmdCheck_M) | Tool offset command check. When 1, calling offset register with 0 compensation triggers a program error. | 0 or 1 |
| Mitsubishi | Parameter No. 8106 | G46 direction identification reversal check. If 1, allows tool to proceed without reverse-error halts. | 0 or 1 |
| Mitsubishi | Parameter No. 1210 Bit 18 / Bit 7 (RstGmd) | Configures reset modal behavior for retaining the compensation state upon NC reset. | 0 or 1 |
Brand Applications
Fanuc
Fanuc CNC systems execute G40 under cutter or tool nose radius compensation (G41/G42) to deactivate the active offset vector. Programmers configure the default cancel mode type using Parameter No. 5003 Bit 0 and reset behaviors via Parameter No. 3402 Bit 6.
The command is programmed as G40, either in a standalone block (which delays physical transition until the next motion block) or in combination with axis coordinates like G40 G00 X100.0 Z50.0; to immediately retract the tool.
| Category | Details |
|---|---|
| Parameters | Parameter No. 3402 Bit 6 (CLR reset), Parameter No. 5000 Bit 3 (GNI vector modifiers), Parameter No. 5003 Bit 0 (SUP cancel Type A/B), Parameter No. 19625 (buffer size). |
| Alarms | Alarm PS0034 (circular interpolation in cancel block), Alarm PS0325 (G40 inside canned cycles G71-G73), Alarm PS0538 (missing G40 in G70.7 final block), Alarm PS0041 (cutter radius interference). |
| Versions | Series 30i/31i/32i-B Plus vs. Series 16i/18i/21i: handles G40 vector deletion differently when Parameter No. 5000 Bit 3 is 0. Reference returns (G28/G30) cancel length offsets but do not cancel radius compensation. |
Warning: Stacking more than N − 2 non-movement blocks (Parameter No. 19625) in offset mode causes look-ahead buffer failure, resulting in unpredictable retraction paths and tool gouging.
Siemens
Siemens controls execute G40 to deactivate tool radius compensation (TRC) modally. Retraction path movements can be automated using Group 17 commands NORM or KONT, which are evaluated by the preprocessor.
In native mode, G40 is executed as G40 G01 X100 Z100; specifying at least one coordinate axis in the active working plane. Active compensation can also be canceled using the D0 command.
| Category | Details |
|---|---|
| Parameters | MD 10760 $MN_G53_TOOLCORR (suppression during G53), MD 20250 (look-ahead buffer interrupt limit), DISC (transition overshoot 0-100), OFFN (allowance on programmed contour). |
| Alarms | Alarm 10751 (no intersection possible during G40 retract), Alarm 61800 (G40 executed under ISO mode G291 without machine data option), Alarm 61000 (standard cycle called with no active D-code). |
| Versions | SINUMERIK 840D sl supports advanced multi-edge turning (G50.2/G51.2) and high-level collision avoidance software options, which are completely omitted on the compact 802D sl series. |
Warning: Programming more than 3 consecutive non-motion blocks (such as dwells or auxiliary PLC functions) violates look-ahead limit MD 20250, aborting calculation and causing surface defects.
Mitsubishi
Mitsubishi controls execute G40 to cancel tool nose radius compensation. The deactivation transition type is configured using Parameter No. 8157, while reset behavior is managed by Parameter No. 1210.
On lathes, the command is programmed as G40 G01 X200.0 Z50.0 T0100; where T0100 cancels the active offset vector, whereas machining centers separate offsets using H-codes and D-codes.
| Category | Details |
|---|---|
| Parameters | Parameter No. 8157 (Type A/B cancel), Parameter No. 1381 Bit 0 (zero compensation error check), Parameter No. 8106 (G46 direction identified reversal), Parameter No. 1210 (reset behavior). |
| Alarms | Program Error (P151) (circular interpolation in G40 block), Program Error (P29) (coordinate preset during compensation), Program Error (P128) (machining condition active during compensation). |
| Versions | M800V/M80V series temporarily suspends look-ahead parsing during G40 compensation retraction blocks when high-speed high-accuracy control modes (G05 P10000) are active. |
Warning: Issuing tool length offset cancellation or coordinate presets while tool nose compensation is active will trigger a Program Error (P29), stopping the spindle immediately.
Brand Comparison
| Feature / Topic | Feature / Topic | Fanuc | Siemens | Mitsubishi |
|---|---|---|---|---|
| Motion Constraints | Requires physical motion (G00/G01) with axis coordinates in the cancel block. Standalone G40 delays the physical transition. | Requires a travel command (G0/G1) specifying at least one coordinate axis in the active working plane. | Requires G00/G01 linear motion command. Circular arcs (G02/G03) are strictly blocked in the cancel block. | |
| Retraction Strategy | Managed manually in the cancel block or via perpendicular vectors governed by Type A/B parameters. | Automated via Group 17 commands (NORM, KONT) and Group 48 collision avoidance (G460, G461, G462). | Standard retraction moves; integrates absolute/incremental dimensioning (X/Z or U/W) under System A. | |
| Look-ahead Interruptions | Limit is N − 2 consecutive non-movement blocks (Parameter No. 19625) before calculation failure. | Limit is 3 consecutive non-movement blocks (Parameter MD 20250) before intersection calculation fails. | Limit is N − 2 consecutive non-movement blocks (Parameter No. 19625) before buffer overrun. | |
| Reset Behavior | Reverts Group 07 to G40 upon control reset if Parameter No. 3402 Bit 6 is set to 1. | Active tool length and radius compensation are suppressed during G53 if MD 10760 is set to 1. | Retains or cancels compensation upon NC reset based on Parameter No. 1210 Bit 18/Bit 7. |
Technical Analysis
Analyzing the motion kernel execution patterns of Fanuc, Siemens, and Mitsubishi controls highlights how each manufacturer prioritizes either operator flexibility or strict syntax validation. Fanuc uses a coordinate-dependent G40 retraction scheme. If a programmer calls G40 without specifying axis coordinates, Fanuc does not execute a physical move immediately; instead, it zeroes the offset vector in memory and postpones the physical axis displacement until the next motion block. This deferred transition can lead to scrap parts if the next block moves in an unexpected direction relative to the raw stock. In contrast, Siemens SINUMERIK controls automate this transition globally through Group 17 commands. By using NORM, the control drives the tool center point along a straight line perpendicular to the active contour, while KONT generates a tangential transition arc around the contour corners. This eliminates the need for manual axis travel calculation within the G40 block.
In addition, Siemens features advanced path-protection algorithms via Group 48 commands. If the look-ahead buffer detects that no physical intersection is geometrically possible during G40 retraction, G461 automatically inserts a transition circle and G462 inserts a tangent line to establish a safe boundary intersection. This prevents the sudden preprocessor halts and overcutting that occur on Fanuc and Mitsubishi systems. Mitsubishi controls differentiate themselves by linking lathe coordinate dimensioning directly to G-code System A. This allows the programmer to specify absolute (X, Z) or incremental (U, W) retract coordinates directly in the G40 block without changing the global coordinate mode. Additionally, Mitsubishi lathe systems link the compensation cancellation directly to the tool selection register (T00 or T0000), whereas machining centers separate length and radius offsets into separate registers (H-codes and D-codes), requiring careful programming during system format switches.
Program Examples
Fanuc Example
N100 G18 G90 G00 G41 X40.0 Z2.0 T0101 M03 ;
N110 G01 X50.0 Z-25.0 F0.2 ;
N120 G40 G00 X100.0 Z50.0 T0100 M09 ;
dry run:
- Block N100: Selects the ZX plane (G18), absolute positioning (G90), rapid traverses to starting coordinates, activates tool nose radius compensation Left (G41) using offset register 1, and starts spindle (M03).
- Block N110: Executes a linear interpolation cut to X50.0 Z-25.0 at a feedrate of 0.2 mm/rev. The tool center path is offset to the left of the programmed contour.
- Block N120: Commands G40 to cancel tool nose radius compensation, rapid positioning to safe retraction coordinates X100.0 Z50.0, deselects the tool offset register (T0100), and turns off coolant (M09). The active compensation vector is reduced to zero over the course of the retraction movement, returning the tool to uncompensated coordinates.
Siemens Example
N10 G17 T1 D1 G94 G01 X50 Y50 F500 ;
N20 G40 NORM G00 X100 Y100 M05 ;
dry run:
- Block N10: Activates XY plane (G17), selects tool 1 with active offset D1, sets feedrate mode to mm/min (G94), and linear interpolates to X50 Y50 at 500 mm/min. Cutter radius compensation (activated by a prior G41/G42) is active, offset to the side of the programmed path.
- Block N20: Deactivates cutter radius compensation (G40) using the NORM retraction strategy, which drives the tool directly in a straight line perpendicular to the last contour block. The tool rapid traverses (G00) to safe coordinates X100 Y100, and the spindle stops (M05). The tool center point transitions from the compensated offset path back to the absolute coordinate path during the move.
Mitsubishi Example
N201 G91 G01 G42 X30.0 Z-20.0 D01 F150 ;
N202 G01 Z-40.0 ;
N203 G40 G01 X50.0 Z10.0 D00 ;
dry run:
- Block N201: Activates incremental positioning (G91), linear interpolates to X30.0 Z-20.0, activates tool radius compensation Right (G42) using offset register D01 at a feedrate of 150 mm/min.
- Block N202: Commands a linear cut incrementally along the Z-axis by -40.0. The tool path remains offset to the right of the contour.
- Block N203: Executes G40 tool radius compensation cancel while moving incrementally X50.0 Z10.0. The active offset register is cleared (D00). Over the course of this linear move, the compensation vector collapses to zero, ensuring the tool ends exactly at the programmed coordinate offset.
Error Analysis
| Alarm Code | Trigger Condition | Operator Symptom | Root Cause / Fix |
|---|---|---|---|
| Fanuc PS0034 | Circular interpolation (G02 or G03) programmed in the same block as a G40 cancellation. | The machine halts immediately during execution, displaying the PS0034 alarm and stopping all axis motion. | Fanuc: Change the G40 cancel block to use linear motion (G00 or G01) instead of circular interpolation. |
| Fanuc PS0325 | G40 programmed directly inside a turning repetitive canned cycle (G71, G72, or G73) shape definition. | The preprocessor rejects the program at startup, displaying the PS0325 alarm and refusing to execute. | Fanuc: Program G40 and cutter compensation codes outside the P and Q block definitions of the canned cycle. |
| Siemens 10751 | Look-ahead preprocessor determines that no intersection point is geometrically possible during G40 retraction. | The CNC halts mid-contour, displaying Alarm 10751 and preventing further movement. | Siemens: Modify the retraction coordinate or direction, or use KONT/G461 to allow the control to generate a transition path. |
| Siemens 61000 | A standard pocket or turning cycle (such as CYCLE951) is executed with no active tool compensation offset (D-code). | The machining cycle fails to execute, and the screen displays Alarm 61000. | Siemens: Program an active tool offset number (D-code) before calling the standard cycles. |
| Mitsubishi Program Error (P151) | Circular interpolation (G02/G03) specified in the G40 cancellation block of tool nose radius compensation. | The machine halts instantly with a Program Error (P151) on the control screen. | Mitsubishi: Modify the G40 cancel block to execute G00 or G01 linear motion. |
| Mitsubishi Program Error (P29) | Workpiece coordinate preset (G92.1) commanded during compensation, or format switch (G188/G189) executed before compensation is canceled. | Program execution is immediately blocked, and the screen displays Program Error (P29). | Mitsubishi: Complete the G40 cancel command before executing coordinate presets or switching G-code formats. |
Application Note
A damaged spindle assembly, shattered carbide insert, and deformed workholding fixture are the direct results of assuming that machine zero return commands (G28 or G30) automatically cancel tool nose radius compensation. While executing a reference return automatically cancels tool length offsets (H-codes), the control retains active cutter or tool nose radius compensation (Group 07 modal state) in its active memory. If the operator fails to program an explicit G40 cancel block before moving the tool, the compensation vector remains active. Any subsequent rapid positioning command will apply the radius offset to the path. In close proximity to the spindle, this active offset will drive the toolholder or turret directly into the rotating chuck jaws, tailstock clamps, or table-mounted vise jaws. This high-speed impact causes a severe axis-overload alarm, damages the spindle, and ruins the raw material. Programmers must enforce a strict policy of executing G40 absolute coordinate retraction blocks prior to commanding reference returns or zero-point resets.
Related Command Network
G41/G42: Activates tool radius / tool nose radius compensation Left or Right, establishing the offset vectors that G40 cancels.G49: Cancels active tool length compensation offsets (H-codes) and should be programmed in conjunction with G40 to fully reset tool offsets.NORM/KONT(Siemens): Modal Group 17 commands that define whether the tool retracts perpendicular to the contour or follows an arc during G40 execution.G46(Mitsubishi): Automatically identifies the correct tool nose radius compensation direction (left or right) before G40 is called.- G39: Non-modal corner rounding command that inserts a transition arc at convex outer corners under active tool radius compensation.
Additionally, other Group 00 unmodal commands like G37 automatic tool length measurement manage axis calibration, while commands such as G34 variable-lead threading and G35 thread cutting with decreasing lead manage custom helical paths.
Conclusion
Preventing high-impact collisions and protecting spindle alignment requires the systematic programming of G40 cancel blocks before the tool leaves the workpiece clearance envelope. Establishing a standardized safety line at the end of every profile cut, maintaining retraction clearance distances larger than double the tool nose radius, and never assuming that machine reference returns automatically cancel radius compensation ensures consistent part quality and maximum machine uptime on the production floor.
Frequently Asked Questions
Why does my CNC machine halt with Alarm PS0041 during a G40 retract?
Alarm PS0041 (cutter radius interference) is triggered because the retraction clearance programmed in the G40 block is smaller than the tool nose radius or cutter radius. The control's preprocessor cannot construct a valid retraction vector when the tool is confined to a space smaller than its physical dimensions. To resolve this, increase the retraction distance in the G40 block to at least twice the tool nose radius value, or use a smaller tool size.
Does commanding a G28 or G30 reference return automatically cancel cutter compensation?
No. While G28 and G30 reference returns automatically cancel tool length offsets (H-codes) on most controls, they do not deactivate cutter radius compensation or tool nose radius compensation (Group 07 remains modal). The active compensation vector is retained in memory, and subsequent rapid movements can deviate from the programmed coordinates. To avoid a collision, always program an explicit G40 cancel command in absolute coordinate mode before executing a reference return.
Why does my Siemens control throw Alarm 10751 during a G40 deactivation?
Alarm 10751 indicates that the look-ahead preprocessor cannot find a geometrically valid intersection point between the final compensated contour path and the G40 retraction block. This typically happens when the retraction move is programmed in an acute direction relative to the contour. To fix this, change the retraction angle to be more perpendicular to the profile, or use the modal KONT command to let the control wrap the tool around the contour corner on a circular arc.
Still not resolved?
Ask our AI assistant about this topic in natural language. Grounded in verified sources, no hallucinations.

- CNC CARE Co-Founder (May 2025 - Present)
- Mitsubishi Electric NC Sales & Service Section Manager (2008 - 2025)
- Reis CNC Service Engineer (2003 - 2008)
- Ören Kalıp CNC Mold Line Team Leader (1999 - 2002)
With over 25 years of experience working in all areas of the CNC machine industry, I continue my activities as a co-founder of CNC CARE, where we offer brand-independent consulting, engineering, and original spare parts services.
Related Articles
Other articles on this topic
G71 Metric Dimensioning Guide for Siemens SINUMERIK Controls
Learn how to program G71 and G710 metric dimensioning on Siemens SINUMERIK controls, including parameter MD 10240, alarm codes, and G-code syntax errors.
G69 Balance Cut Cancel: Coordinate Recovery & Crash Prevention
Learn how to program the G69 balance cut cancel command for Fanuc, Siemens, and Mitsubishi turning centers. Cancel dual slide synchronization and prevent crashes.
G70 CNC Finishing Cycle Guide for Fanuc, Siemens, and Mitsubishi
Learn the G70 finishing cycle for CNC turning. Master syntax, parameters, and alarm codes for Fanuc, Siemens CYCLE95, and Mitsubishi controls to avoid crashes.
G69 Coordinate System Rotation Cancel: Modals, Alarms, and Setup
Learn to cancel G68 facing turret mirrors and coordinate rotations using G69 on Fanuc, Siemens, and Mitsubishi CNCs to prevent turret crashes.