While modern CNC lathes use conversational or CAM-generated code, understanding basic G-code allows for on-the-fly adjustments and troubleshooting.
G-code is a standardized language (with some machine-specific variations) that instructs the machine’s movements. Here are the most essential codes for turning:
- Motion Codes:
- G00: Rapid positioning (non-cutting move to a location).
- G01: Linear interpolation (cutting a straight line at a programmed feed rate,
F).
- G02/G03: Circular interpolation (cutting an arc, clockwise or counterclockwise).
- Unit & Plane Selection:
- G20/G21: Inch or millimeter mode.
- G18: Specifies the XZ plane for turning (this is usually default on a lathe).
- Spindle & Feed Control:
- G97: Constant spindle speed (RPM,
S).
- G96: Constant surface speed (CSS) – essential for maintaining a consistent cutting speed as the tool moves across a changing diameter.
- G98/G99: Feed per minute or feed per revolution.
- Tool Functions:
- T0101: Tool call (tool #1, offset #1).
- M06: Tool change command (common on machining centers with ATCs; lathes may use
Tcode only).
- Program Control:
- M03/M04/M05: Spindle on clockwise/counterclockwise/off.
- M08/M09: Coolant on/off.
- M30: Program end and rewind.
Learning to read a simple facing or turning cycle in G-code demystifies the machining process and empowers the operator.