G24 CNC Code | Understanding G24 on CNC

G24 on CNC Lathes and Mills: Unraveling a Non-Standard G-Code (and What to Use Instead)

The G24 G-code is a source of confusion in CNC programming. Unlike many common G-codes with standardized meanings, G24 does not have a universally defined function across all CNC control systems. You might find online resources claiming it’s for:

  • Probing cycles.
  • Mirroring or scaling.
  • General clockwise circular interpolation.

These claims are generally incorrect for modern, mainstream CNC lathes and machining centers from Fanuc, Siemens, Haas, and others.

This article clarifies the situation surrounding G24, explains a possible (but rare and control-specific) historical use on some older Fanuc lathes, and, most importantly, directs you to the correct and standard methods for achieving the results often mistakenly attributed to G24.

Crucial Point: Before using any G-code, always consult the programming manuals for your specific CNC control system and machine tool. Never assume a G-code’s function without verification.

1. G24: A Non-Standard G-Code

The most important takeaway is this: Do not assume that G24 has any particular function on your CNC machine without explicit confirmation from your machine’s documentation. It is highly likely that:

  • G24 is Unused: It might be an unassigned G-code on your control.
  • G24 is a Custom Macro: The machine tool builder (MTB) could have assigned G24 to a custom macro function. This would be entirely machine-specific.
  • G24 Has a Very Specific, Optional Function: There’s a small chance it’s used for a niche feature on some control/machine combinations, but this is not common.

2. Possible (But Rare) Use: “End Face Turning Cycle” (Older Fanuc Lathes)

Based on further research triggered by our discussion, I’ve found limited evidence suggesting that G24 might have been used on some older Fanuc lathe controls (or in custom macros) as part of a non-standard “End Face Turning Cycle” or for automatic chamfering/corner rounding.

Important Caveats:

  • Non-Standard: This is not a standard feature on modern Fanuc controls.
  • Control-Specific: The exact syntax, parameters, and behavior would be highly dependent on the specific Fanuc control series and the MTB’s implementation.
  • Likely Used with Other G-Codes: G24 in this context would probably modify the behavior of G01 (linear interpolation) and possibly G70-series canned cycles, not act as a standalone cycle.
  • May be a purchased option.

Conceptual Example (Hypothetical - Do Not Use Without Verification): It’s possible that on some older Fanuc systems, a sequence like this might have been used:

; ... (Setup, tool selection, etc.) ...
G24 P... Q... ; *Hypothetically* enable automatic chamfering/rounding,
             ; with P and Q defining parameters (size, type, etc.)
             ; (**VERY CONTROL-SPECIFIC - CHECK YOUR MANUAL**)
G01 X... Z... ; Linear move to a corner
; ... (More linear moves, potentially a G70-series cycle) ...
G24 ; *Hypothetically* disable the automatic chamfering/rounding
; ...

This is highly speculative and should not be used without confirming its validity and syntax in your machine’s documentation.

3. The Correct Ways to Achieve Common Machining Operations

Since G24 is unreliable, let’s focus on the standard and recommended methods for the operations often (incorrectly) associated with it:

3.1 Probing

  • G31 (Skip Function): The fundamental G-code for basic probing. It’s a feed move that stops when the probe triggers.
  • Canned Cycles/Macros: Most controls have dedicated probing cycles (often G35-G37 on Fanuc, but very control-specific) or custom macros for more complex probing operations (measuring diameters, finding edges, setting work offsets automatically).

Example (G31 Skip Function):

; Find the X+ edge of a part
G91 ; Incremental mode
G31 X10.0 F50 ; Feed in X+ until probe triggers
G90 ; Absolute mode
; ... (Use machine position to calculate edge location) ...

3.2 Mirroring

  • Fanuc: G50.1 (programmable mirror image cancel), G51.1 (programmable mirror image enable). You program one side of the symmetrical part, and the control mirrors the toolpath.
  • Siemens: MIRROR and AMIRROR commands.
  • Haas: Consult the manual; likely specific G-codes.
  • Mazak: Consult the manual
  • Mitsubishi: Consult the manual.

Example (Fanuc - Mirroring):

G51.1 X0 ; Enable mirror image across the YZ plane (mirror in X)
; ... (Program toolpath for *one half* of the symmetrical part) ...
G50.1 X0 ; Cancel mirror image  <-- IMPORTANT!

3.3 Scaling

  • Fanuc: G51 (programmable scaling). You specify scaling factors for each axis. G50 cancels scaling.
  • Siemens: SCALE and ASCALE commands.
  • Haas: Consult the manual; likely specific G-codes.
  • Mazak: Consult the manual.
  • Mitsubishi: Consult the manual.

Example (Fanuc - Scaling):

G51 X2.0 Y2.0 Z2.0 ; Scale toolpath by a factor of 2 in all axes
; ... (Program toolpath for the *original* size) ...
G50 ; Cancel scaling  <-- IMPORTANT!

3.4 Chamfering and Corner Rounding (Lathe)

  • Explicit Programming: The most reliable method: program the chamfer or radius directly using G01 (linear move for a chamfer) or G02/G03 (circular interpolation for a radius).
  • Canned Cycles: Many turning canned cycles (e.g., G71, G72, G70 on Fanuc) allow you to specify chamfers and radii within the cycle parameters.
  • Tool Nose Radius Compensation (TNRC): Using G41/G42 with a tool that has a defined nose radius will automatically create a small radius at sharp corners.
  • CAM Software

Example (Explicit Chamfer):

G01 X20.0 Z0.0 ; Move to corner
G01 X22.0 Z-1.0 F0.05 ; Chamfer (45-degree chamfer, 1mm long)
G01 Z-20.0 ; Continue turning

Example (Explicit Radius):

G01 X20.0 Z0.0 ; Move to corner
G03 X22.0 Z-1.0 R1.0 F0.05 ; Radius (using G03)
G01 Z-20.0 ; Continue turning

4. Control-Specific Information

  • Fanuc: G24 is not a standard command for probing, mirroring, scaling, or general-purpose chamfering on modern Fanuc lathes or mills. Some older Fanuc lathe controls might have used it as part of a non-standard chamfering cycle, but this is not common.
  • Siemens: Siemens controls do not typically use G24 for these functions. Siemens uses different commands and cycles.
  • Haas: Haas controls do not typically use G24 for these functions.
  • Mazak: Refer to specific machine documentation. May have a custom use, but not likely to be a standard function. In Mazatrol, these functions are handled through the conversational interface.
  • Mitsubishi: Refer to specific machine documentation. May have a custom use, but not likely to be a standard function.
  • Other Controls: Always consult your documentation.

5. CAM Software

For any complex machining operation, and especially for those involving probing, mirroring, scaling, or complex curves, CAM (Computer-Aided Manufacturing) software is the strongly recommended approach. CAM software handles these complexities automatically and generates the correct G-code for your specific machine and control system.

6. Frequently Asked Questions (FAQ)

  • Q: What is G24 used for on CNC lathes and mills?
    • A: On most modern controls, G24 has no standard, documented function for general probing, mirroring, scaling, or circular interpolation. On some older Fanuc lathes, it might have been part of a non-standard chamfering or “End Face Turning Cycle,” but this is rare and unreliable.
  • Q: How do I probe on my CNC machine?
    • A: Use G31 (skip function) for basic probing, or dedicated probing cycles/macros (control-specific).
  • Q: How do I mirror or scale a toolpath?
    • A: Use the correct mirroring/scaling commands for your control system (e.g., G50.1/G51.1 and G51 on Fanuc, MIRROR/AMIRROR and SCALE/ASCALE on Siemens).
  • Q: How do I machine chamfers and radii on a lathe?
    • A: Program them explicitly using G01, G02, and G03, use canned cycles (if available), use tool nose radius compensation, or (best option) use CAM software.
  • Q: Where can I find reliable information about G-codes? * A: In the programming manual.

7. Conclusion

The G24 command is not a standard, universally defined G-code for common operations like probing, mirroring, scaling, or general circular interpolation on modern CNC lathes and mills. While it might have a specific, non-standard function on some older Fanuc lathes (related to chamfering), relying on this is not recommended. Always use the standard and documented G-codes for your control system, and leverage the power of CAM software for complex geometries. And, for the final time: Always consult your machine’s programming manuals!