In CNC machining, G-codes and M-codes are two fundamental programming commands used to control the movement and functionality of machine tools.
G-code, also known as “geometric code” or “preparatory code,” is primarily used to define the motion and positioning of the cutting tool. These codes instruct the machine on how to move, such as rapid motion (G00), linear interpolation (G01), and circular interpolation (G02 and G03), among others.
On the other hand, M-code, also known as “miscellaneous code,” controls various functions of the machine tool, such as spindle rotation, coolant flow adjustment, and tool change. Each G and M code is usually followed by a number representing a specific function or command.
The existence of G-codes and M-codes enables CNC machine tools to perform complex machining tasks. By precise programming instructions, they control the actions of the machine tool, resulting in high precision and high-quality machining effects.
Different combinations of G and M codes can complete various machining operations, including but not limited to drilling, milling, and turning. However, it’s important to note that different manufacturers’ CNC systems may have variations in the specific meanings and applications of these codes. Therefore, reference to the specific machine tool’s operating manual or consultation with the manufacturer is necessary to ensure correct application.
In summary, G-codes and M-codes are indispensable parts of CNC machining. Together, they form the programming language of CNC machine tools, making the mechanical machining process more flexible and efficient. Mastery of these codes’ meanings and applications is crucial for CNC programmers.
What is G-code?
G-code (also known as RS-274) is the most widely used numerical control (NC) programming language in computer-aided manufacturing (CAM). It serves as a standardized set of instructions for controlling automated machine tools, including CNC mills, lathes, 3D printers, and other computer-controlled manufacturing equipment.
Developed in the 1950s by the Electronic Industries Alliance (EIA), G-code has evolved through various versions and implementations. Despite its name, G-code encompasses not only “G” commands (preparatory functions) but also “M” codes (miscellaneous functions), coordinate values, and other parameters that collectively form a comprehensive machine control language.
Key features and applications of G-code include:
- Motion control: Rapid positioning, linear and circular interpolation, and complex path generation.
- Tool management: Selecting tools, controlling spindle speeds, and managing coolant systems.
- Coordinate systems: Defining work coordinates and performing coordinate transformations.
- Program flow: Implementing loops, subroutines, and conditional statements.
- Machine-specific functions: Controlling unique features of different machine tools.
G-code instructions typically follow a structured format, with each line representing a single command or set of parameters. For example:
G01 X100 Y50 F500
This instruction directs the machine to move linearly (G01) to the X-coordinate of 100mm and Y-coordinate of 50mm at a feed rate of 500mm/minute.
While G-code remains the industry standard, modern CAM software often generates G-code automatically from 3D models and toolpath strategies, simplifying the programming process for complex parts. However, understanding G-code fundamentals remains crucial for optimizing machining processes, troubleshooting, and fine-tuning automated manufacturing operations.
What is M-code?
M-code, short for Miscellaneous code, is a crucial component of CNC (Computer Numerical Control) programming, specifically defined as an auxiliary function code in FANUC and other control systems. These codes play a vital role in controlling various non-axis movement functions of the machine tool, complementing G-codes which primarily handle motion and cutting operations.
M-codes are used to command auxiliary operations that are essential for the overall machining process but do not directly involve the movement of cutting tools or workpiece positioning. These functions can include:
- Coolant control (e.g., M08 for coolant on, M09 for coolant off)
- Spindle operations (e.g., M03 for spindle clockwise, M04 for counterclockwise, M05 for spindle stop)
- Tool changes (e.g., M06 for automatic tool change)
- Program flow control (e.g., M00 for program stop, M01 for optional stop)
- Pallet changes (e.g., M60 in some systems)
- Special machine functions (e.g., M21, M22 for custom operations specific to a particular machine)
The implementation and specific functions of M-codes can vary slightly between different machine manufacturers and control systems, although many standard codes are widely recognized across platforms. Proper use of M-codes is essential for efficient and safe operation of CNC machines, allowing for precise control over various machine functions throughout the manufacturing process.
G and M Codes List
1. FANUC lathe G-code
G-code | Explain |
G00 | Positioning (fast moving) |
G01 | Linear cutting |
G02 | Clockwise arc cutting (CW, clockwise) |
G03 | Counterclockwise tangential positioning (fast moving) arc (CCW, counter clock) |
G04 | Pause (dwel1) |
G09 | Stop at the exact position |
G20 | Imperial input |
G21 | Metric input |
G22 | Internal travel effective limit |
G23 | Invalid internal travel limit |
G27 | Check reference point return |
G28 | Reference point return |
G29 | Return from reference point |
G30 | Return to the second reference point |
G32 | Thread cutting |
G40 | Cancel tool tip radius offset |
G41 | Nose radius offset (left) |
G42 | Nose radius offset (right) |
G50 | Modify workpiece coordinates; Sets the maximum rpm of the spindle |
G52 | Set local coordinate system |
G53 | Select machine coordinate system |
G70 | Finishing cycle |
G71 | Internal and external diameter rough cutting cycle |
G72 | Step rough cutting cycle |
G73 | Forming repeat cycle |
G74 | Z-step drilling |
G75 | X-direction grooving |
G76 | Thread cutting cycle |
G80 | Cancel fixed cycle |
G83 | Drilling cycle |
G84 | Tapping cycle |
G85 | Front boring cycle |
G87 | Side drilling cycle |
G88 | Side tapping cycle |
G89 | Side boring cycle |
G90 | (inside and outside diameter) cutting cycle |
G92 | Thread cutting cycle |
G94 | (step) cutting cycle |
G96 | Constant linear speed control |
G97 | Constant linear speed control cancelled |
G98 | Feed rate per minute |
G99 | Feed rate per revolution |
2. FANUC milling machine G code
Gcode | Explain |
G00 | Top position (rapid movement) positioning (rapid movement) |
G01 | Linear cutting |
G02 | Clockwise circular arc |
G03 | Counterclockwise tangent arc |
G04 | Suspend |
G15/G16 | Polar command |
G17 | XY face assignment |
G18 | XZ face assignment |
G19 | YZ face assignment |
G28 | Machine return to origin |
G30 | The machine returns to the 2nd and 3rd origin |
*G40 | Cancel tool diameter offset |
G41 | Tool diameter left offset |
G42 | Tool diameter right offset |
*G43 | Tool length + direction offset |
*G44 | Tool length offset in one direction |
G49 | Cancel tool length offset |
*G53 | Machine coordinate system selection |
G54 | Workpiece coordinate system 1 Selection |
G55 | Workpiece coordinate system 2 selection |
G56 | Workpiece coordinate system 3 selection |
G57 | Workpiece coordinate system 4 selection |
G58 | Workpiece coordinate system 5 Selection |
G59 | Workpiece coordinate system 6 selection |
G73 | High speed deep hole drilling cycle |
G74 | Left spiral cutting cycle |
G76 | Fine boring cycle |
*G80 | Cancel fixed cycle |
G81 | Center drilling cycle reverse boring cycle |
G82 | Reverse boring cycle |
G83 | Deep hole drilling cycle |
G84 | Right spiral cutting cycle |
G85 | Boring cycle |
G86 | Boring cycle |
G87 | Reverse boring cycle |
G88 | Boring cycle |
G89 | Boring cycle |
*G90 | Use absolute value command |
G91 | Use incremental value command |
G92 | Set workpiece coordinate system |
*G98 | Fixed cycle return to starting point |
3. FANUC M code
M-code | Explain |
M00 | Program stop |
M01 | Select Stop |
M02 | Program end (reset) |
M03 | Spindle forward rotation (CW) |
M04 | Spindle reversal (CCW) |
M05 | Spindle stop |
M06 | Change knife |
M08 | Cutting fluid on |
M09 | Cutting fluid off |
M30 | Return to the beginning of the program (reset) and end |
M48 | Cancel spindle overload does not work |
M49 | Spindle overload cancellation function |
M94 | Image cancellation |
M95 | X-coordinate mirror image |
M96 | Y-coordinate mirror image |
M98 | Subroutine call |
M99 | End of subroutine |
4. Siemens milling machine G code
Address | Explain |
D | Tool complement number |
F | Feed rate (dwell time can be programmed with G4) |
G | G function (prepare function word) |
GO | Fast move |
G1 | Linear interpolation |
G2 | Clockwise circular interpolation |
G3 | Counterclockwise circular interpolation |
CIP | Middle point arc interpolation |
G33 | Thread cutting with constant pitch |
G331 | Cutting internal thread without compensation fixture |
G332 | Cutting internal thread without compensation fixture. Retract knife |
CT | Transition arc interpolation with tangent |
G4 | Fast move |
G63 | Fast move |
G74 | Back to the reference point |
G75 | Fixed point |
G25 | Lower limit of spindle speed |
G26 | Upper limit of spindle speed |
G110 | Pole size, relative to the last programmed set position |
G110 | Pole size, relative to the zero point of the current workpiece coordinate system |
G120 | Pole size, relative to the last valid pole |
G17* | X / Y plane |
G18 | Z / X plane |
G19 | Y / Z plane |
G40 | Cancellation of tool tip radius compensation |
G41 | The tool tip radius compensation is called, and the tool moves on the left side of the contour |
G42 | The tool tip radius compensation is called, and the tool moves on the right side of the contour |
G500 | Cancel settable zero offset |
G54 | First settable zero offset |
G55 | Second, the zero offset can be set |
G56 | Third, the zero offset can be set |
G57 | Fourth, the zero offset can be set |
G58 | Fifth, the zero offset can be set |
G59 | Sixth, the zero offset can be set |
G53 | Cancel by program segment to set zero offset |
G60* | Accurate positioning |
G70 | Inch size |
G71* | Metric size |
G700 | Inch size, also used for feed rate F |
G710 | Metric size, also used for feed rate F |
G90* | Absolute size |
G91 | Incremental size |
G94* | Feed rate F in mm / min |
G95 | Spindle feed rate F, in mm / revolution |
G901 | Feed compensation “on” in arc segment |
G900 | Feed compensation “off” |
G450 | Arc transition |
G451 | Intersection of equidistant lines |
I | Interpolation parameters |
J | Interpolation parameters |
K | Interpolation parameters |
I1 | Middle point of circular interpolation |
J1 | Middle point of circular interpolation |
K1 | Middle point of circular interpolation |
L | Subroutine name and subroutine call |
M | Auxiliary function |
MO | Program stop |
M1 | The program stops conditionally |
M2 | Program end |
M3 | The spindle rotates clockwise |
M4 | The spindle rotates counterclockwise |
M5 | Spindle stop |
M6 | Tool change |
N | Subroutine segment |
: | Main program segment |
P | Number of subroutine calls |
RET | End of subroutine |
S | Spindle speed, which indicates pause time in G4 |
T | Tool number |
X | Coordinate axis |
Y | Coordinate axis |
Z | Coordinate axis |
CALL | Loop call |
CHF | Chamfer, general use |
CHR | Chamfer contour line |
CR | Circular interpolation radius |
GOTOB | Backward jump instruction |
GOTOF | Forward jump command |
RND | Fillet |
5. Siemens 802S / CMfixed cycle
Circulate | Explain |
LCYC82 | Drilling and counterbore processing |
LCYC83 | Deep hole drilling |
LCYC840 | Thread cutting with compensation fixture |
LCYC84 | Thread cutting without compensation fixture |
LCYC85 | Boring |
LCYC60 | Linear hole arrangement |
LCYC61 | Circular hole arrangement |
LCYC75 | Rectangular groove, keyway, circular groove milling |
6. Siemens 802DM/ 810 / 840DMfixed cycle
Circulate | Explain |
CYCLE82 | Central drilling |
CYCLE83 | Deep hole drilling |
CYCLE84 | Sexual tapping |
CYCLE85 | Reaming |
CYCLE86 | Boring |
CYCLE88 | Boring with stop |
CYCLE71 | End milling |
LONG HOLE | A rectangular hole in an arc |
POCKE T4 | Annular groove milling |
POCKE T3 | Rectangular groove milling |
SLOT1 | Keyway on an arc |
SLOT2 | Circular groove |
7. Siemens lathe G code
Address | Explain |
D | Tool complement number |
F | |
F | Feed rate (dwell time can be programmed with G4) |
G | G function (prepare function word) |
GO | Fast move |
G1 | Linear interpolation |
G2 | Clockwise circular interpolation |
G3 | Counterclockwise circular interpolation |
G33 | Thread cutting with constant pitch |
G4 | Fast move |
G63 | Fast move |
G74 | Back to the reference point |
G75 | Fixed point |
G17 | (required when machining center hole) |
G18* | Z / X plane |
G40 | Cancellation of tool tip radius compensation |
G41 | The tool tip radius compensation is called, and the tool moves on the left side of the contour |
G42 | The tool tip radius compensation is called, and the tool moves on the right side of the contour |
G500 | Cancel settable zero offset |
G54 | First settable zero offset |
G55 | Second, the zero offset can be set |
G56 | Third, the zero offset can be set |
G57 | Fourth, the zero offset can be set |
G58 | Fifth, the zero offset can be set |
G59 | Sixth, the zero offset can be set |
G53 | Cancel by program segment to set zero offset |
G70 | Inch size |
G71* | metric size |
G90* | Absolute size |
G91 | Incremental size |
G94* | Feed rate f in mm / min |
G95 | Spindle feed rate F, in mm / revolution |
I | Interpolation parameters |
I1 | Middle point of circular interpolation |
K1 | Middle point of circular interpolation |
L | Subroutine name and subroutine call |
M | Auxiliary function |
MO | Program stop |
M1 | The program stops conditionally |
M2 | Program end |
M30 | |
M17 | |
M3 | The spindle rotates clockwise |
M4 | The spindle rotates counterclockwise |
M5 | Spindle stop |
M6 | Tool change |
N | Subroutine segment |
: | Main program segment |
P | Number of subroutine calls |
RET | End of subroutine |
S | Spindle speed, which indicates pause time in G4 |
T | Tool number |
X | Coordinate axis |
Y | Coordinate axis |
Z | Coordinate axis |
AR | Circular interpolation angle |
CALL | Loop call |
CHF | Chamfer, general use |
CHR | Chamfer contour line |
CR | Circular interpolation radius |
GOTOB | Backward jump instruction |
GOTOF | Forward jump command |
RND | Fillet |
8. SIEMENS 801, 802S/CT,802SeTfixed cycle
Circulate | Explain |
LCYC82 | Drilling and counterbore processing |
LCYC83 | Deep hole drilling |
LCYC840 | Thread cutting with compensation fixture |
LCYC84 | Thread cutting without compensation fixture |
LCYC85 | Boring |
LCYC93 | Grooving cycle |
LCYC95 | Blank cutting cycle |
LCYC97 | Thread cutting |
9. SIEMENS 802D, 810D/840D fixed cycle
Circulate | Explain |
CYCLE71 | Plane milling |
CYCLE82 | Central drilling |
YCLE83 | Deep hole drilling |
CYCLE84 | Rigid tapping |
CYCLE85 | Reaming |
CYCLE86 | Boring |
CYCLE88 | Boring with stop |
CYCLE93 | Grooving |
CYCLE94 | Undercut shape E.F |
CYCLE95 | Blank cutting |
CYCLE97 | Thread cutting |
10. HNC lathe G code
G-code | Explain |
G00 | Positioning (fast moving) |
G01 | Linear cutting |
G02 | Clockwise arc cutting (CW, clockwise) |
G03 | Counter clockwise arc cutting (CCW, counter clock) |
G04 | Pause (dwel1) |
G09 | Stop at the exact position |
G20 | Imperial input |
G21 | Metric input |
G22 | The internal travel limit is valid |
G23 | Invalid internal travel limit |
G27 | Check reference point return |
G28 | Reference point return |
G29 | Return from reference point |
G30 | Return to the second reference point |
G32 | Thread cutting |
G36 | Diameter programming |
G37 | Radius programming |
G40 | Cancel tool tip radius offset |
G41> | Nose radius offset (left) |
G42 | Nose radius offset (right) |
G53 | Direct machine coordinate system programming |
G54-G59 | Coordinate system selection |
G71 | Internal and external diameter rough cutting cycle |
G72 | Step rough cutting cycle |
G73 | Closed loop turning compound cycle |
G76 | Thread cutting cycle |
G80 | Internal and external diameter cutting cycle |
G81 | Fixed cycle of face turning |
G82 | Thread cutting fixed cycle |
G90 | Absolute value programming |
G91 | Incremental value programming |
G92 | Workpiece coordinate system setting |
G96 | Constant linear speed control |
G97 | Constant linear speed control cancelled |
G94 | Feed rate per minute |
G95 | Feed rate per revolution |
11. HNC lathe machine G code
G Code | Explain |
G00 | Positioning (fast moving) |
G01 | Linear cutting |
G02 | Clockwise arc cutting (CW, clockwise) |
G03 | Counter clockwise arc cutting (CCW, counter clock) |
G04 | Pause (dwell) |
G09 | Stop at the exact position |
G20 | Imperial input |
G21 | Metric input |
G22 | The internal travel limit is valid |
G23 | Invalid internal travel limit |
G27 | Check reference point return |
G28 | Reference point return |
G29 | Return from reference point |
G30 | Return to the second reference point |
G32 | Thread cutting |
G36 | Diameter programming |
G37 | Radius programming |
G40 | Cancel tool tip radius offset |
G41> | Nose radius offset (left) |
G42 | Nose radius offset (right) |
G53 | Direct machine coordinate system programming |
G54—G59 | Coordinate system selection |
G71 | Internal and external diameter rough cutting cycle |
G72 | Step rough cutting cycle |
G73 | Closed loop turning compound cycle |
G76 | Thread cutting cycle |
G80 | Internal and external diameter cutting cycle |
G81 | Fixed cycle of face turning |
G82 | Thread cutting fixed cycle |
G90 | Absolute value programming |
G91 | Incremental value programming |
G92 | Workpiece coordinate system setting |
G96 | Constant linear speed control |
G97 | Constant linear speed control cancelled |
G94 | Feed rate per minute |
G95 | Feed rate per revolution |
12. HNC milling machine G code
G-code | Explain |
G00 | Positioning (fast moving) |
G01 | Linear cutting |
G02 | Clockwise circular arc |
G03 | Counterclockwise tangent arc |
G04 | suspend |
G07 | Virtual axis assignment |
G09 | Quasi stop verification |
*G17 | XY face assignment |
G18 | XZ face assignment |
G19 | YZ face assignment |
G20 | Inch input |
*G21 | Mm input |
G22 | Pulse equivalent |
G24 | Mirror on |
*G25 | Mirror off |
G28 | Return to reference point |
G29 | Return from reference point |
*G40 | Cancel tool diameter offset |
G41 | Tool diameter left offset |
G42 | Tool length + direction offset |
G43 | Tool length + direction offset |
G44 | Tool length offset in one direction |
*G49 | Cancel tool length offset |
*G50 | Zoom off |
G51 | Retract and release |
G52 | Local coordinate system setting |
G53 | Direct machine coordinate system programming |
*G54 | Workpiece coordinate system 1 Selection |
G55 | Workpiece coordinate system 2 selection |
G56 | Workpiece coordinate system 3 selection |
G57 | Workpiece coordinate system 4 selection |
G58 | Workpiece coordinate system 5 Selection |
G59 | Workpiece coordinate system 6 selection |
G60 | Unidirectional positioning |
*G61 | Precise stop verification method |
G64 | Continuous mode |
G68 | Rotation transformation |
*G69 | Rotation cancel |
G73 | High speed deep hole drilling cycle |
G74 | Left spiral cutting cycle |
G76 | Fine boring cycle |
*G80 | Cancel fixed cycle |
G81 | Central drilling cycle |
G82 | Reverse boring cycle |
G83 | Deep hole drilling cycle |
G84 | Right spiral cutting cycle |
G85 | Boring cycle |
G86 | Boring cycle |
G87 | Reverse boring cycle |
G88 | Boring cycle |
G89 | Boring cycle |
*G90 | Use absolute value command |
G91 | Using the increment command |
G92 | Set workpiece coordinate system |
*G94 | Feed per minute |
G95 | Feed per revolution |
*G98 | Fixed cycle return to starting point |
G99 | Return to fixed cycle R point |
13. HNC M code
M-code | Explain |
M00 | Program stop |
M01 | Select Stop |
M02 | Program end (reset) |
M03 | Spindle forward rotation (CW) |
M04 | Spindle reversal (CCW) |
M05 | Spindle stop |
M06 | Change knife |
M07 | Cutting fluid on |
M09 | Cutting fluid off |
M98 | Subroutine call |
M99 | End of subroutine |
14. KND 100 milling machine G code
G-code | Group | Explain |
G00 | 1 | Positioning (fast moving) |
G01 | Linear cutting | |
G02 | Clockwise circular arc | |
G03 | Counterclockwise tangent arc | |
G04 | 0 | Suspend |
G17 | 2 | XY face assignment |
G18 | XZ face assignment | |
G19 | YZ face assignment | |
G28 | 0 | Machine return to origin |
G29 | Return from reference point | |
*G40 | 7 | Cancel tool diameter offset |
G41 | Tool diameter left offset | |
G42 | Tool diameter right offset | |
*G43 | 8 | Tool length + direction offset |
*G44 | Tool length offset in one direction cancels the tool length offset | |
G49 | Cancel tool length offset | |
*G53 | 14 | machine tool coordinate system selection |
G54 | workpiece coordinate system 1 Selection | |
G55 | workpiece coordinate system 2 selection | |
G56 | workpiece coordinate system 3 selection | |
G57 | workpiece coordinate system 4 selection | |
G58 | workpiece coordinate system 5 Selection | |
G59 | workpiece coordinate system 6 selection | |
G73 | 9 | high speed deep hole drilling cycle |
G74 | left spiral cutting cycle | |
G76 | fine boring cycle | |
*G80 | cancel fixed cycle | |
G81 | drilling cycle (spot drilling) | |
G82 | drilling cycle (boring stepped holes) | |
G83 | deep hole drilling cycle | |
G84 | tapping cycle | |
G85 | boring cycle | |
G86 | borehole circulation | |
G87 | reverse boring cycle | |
G88 | boring cycle | |
G89 | boring cycle | |
*G90 | 3 | use absolute value command |
G91 | use incremental value command | |
G92 | 0 | set workpiece coordinate system |
*G98 | 10 | fixed cycle return to starting point |
*G99 | return to fixed cycle r point |
15. KND 100 lathe G code
G-code | Group | Explain |
G00 | 1 | Positioning (fast moving) |
G01 | Linear cutting | |
G02 | Clockwise arc cutting (CW, clockwise) | |
G03 | Counter clockwise arc cutting (CCW, counter clock) | |
G04 | 0 | Pause (dwe11) |
G10 | Offset value setting | |
G20 | 6 | Imperial input |
G21 | Metric input | |
G27 | 0 | Check reference point return |
G28 | Reference point return | |
G29 | Return from reference point | |
G31 | Jumping function | |
G32 | 1 | Thread cutting |
G36 | X-axis automatic tool deviation setting | |
G37 | Z-axis automatic tool deviation setting | |
G40 | 7 | Cancel tool tip radius offset |
G41 | Nose radius offset (left) | |
G42 | Nose radius offset (right) | |
G50 | 0 | Coordinate system setting |
G54 | Workpiece coordinate system | |
G55—G59 | Workpiece coordinate system | |
G70 | 0 | Finishing cycle |
G71 | Internal and external diameter rough cutting cycle | |
G72 | Step rough cutting cycle | |
G73 | Forming repeat cycle | |
G74 | End face deep hole machining cycle | |
G75 | Outer circle and inner circle cutting cycle | |
G76 | Thread cutting cycle | |
G90 | 1 | (inside and outside diameter) cutting cycle |
G92 | Thread cutting cycle | |
G94 | (step) cutting cycle | |
G96 | 12 | Constant linear speed control |
G97 | Constant linear speed control cancelled | |
G98 | 5 | Feed rate per minute |
G99 | Feed rate per revolution |
16. KND 100 M code
M-code | Instruction |
M00 | Program stop |
M01 | Select Stop |
M02 | Program end (reset) |
M03 | Spindle forward rotation (CW) |
M04 | Spindle reversal (CCW) |
M05 | Spindle stop |
M06 | Change knife |
M08 | Cutting fluid on |
M09 | Cutting fluid off |
M10 | Clamping |
M11 | Release |
M32 | Lubrication on |
M33 | Lubrication off |
M99 | End of subroutine |
17. GSK980 lathe G code
G-code | Group | Function |
G00 | 1 | Positioning (fast moving) |
*G01 | Linear interpolation (cutting feed) | |
G02 | Arc interpolation CW (clockwise) | |
G03 | Circular interpolation CCW (counterclockwise) | |
G04 | 0 | Pause, quasi stop |
G28 | Return to reference point | |
G32 | 1 | Thread cutting |
G50 | 0 | Coordinate system setting |
G65 | Macro program command | |
G70 | 0 | Finishing cycle |
G71 | Outer circle rough turning cycle | |
G72 | End rough turning cycle | |
G73 | Closed cutting cycle | |
G74 | End face deep hole machining cycle | |
G75 | Outer circle, inner circle, grooving cycle | |
1 | Outer circle, inner circle, turning cycle | |
G92 | Thread cutting cycle | |
End cutting cycle | ||
G96 | 2 | Constant linear speed on |
G97 | Constant linear speed off | |
*G98 | 3 | Feed per minute |
G99 | Feed per revolution |
18. GSK980T Minstruction
M-code | Instruction |
M03 | Spindle forward rotation |
M04 | Spindle reversal |
M05 | Spindle stop |
M08 | Coolant on |
M09 | Coolant off (no output signal) |
M32 | Lubrication on |
M33 | Lubrication off (no output signal) |
M10 | Spare |
M11 | Spare tip (no signal output) |
M00 | The program is suspended. Press the ‘cycle start’ program to continue |
M30 | The program ends and returns to the beginning |
19. GSK928 TC / TE G code
G-code | Function |
G00 | Positioning (fast moving) |
*G01 | Linear interpolation (cutting feed) |
G02 | Arc interpolation CW (clockwise) |
G03 | Circular interpolation CCW (counterclockwise) |
G32 | Tapping circulation |
G33 | Thread cutting |
G71 | Outer circle rough turning cycle |
G72 | End rough turning cycle |
G74 | End face deep hole machining cycle |
G75 | Outer circle, inner circle, grooving cycle |
G90 | Outer circle, inner circle, turning cycle |
G92 | Thread cutting cycle |
G94 | Outer circle inner conical surface circulation |
G22 | Local cycle start |
G80 | End of local cycle |
*G98 | Feed per minute |
G99 | Feed per revolution |
G50 | Set workpiece absolute coordinate system |
G26 | 10. Z-axis back reference |
G27 | X-axis back to reference point |
G29 | Z axis back to reference point |
20. GSK928 TC / TEM code
M-code | Instruction |
M03 | Spindle forward rotation |
M04 | Spindle reversal |
M05 | Spindle stop |
M08 | Coolant on |
M09 | Coolant off (no output signal) |
M32 | Lubrication on |
M33 | Lubrication off (no output signal) |
M10 | Spare |
M11 | Spare tip (no signal output) |
MOO | Program pause, press’ cycle start ‘program to continue |
M30 | The program ends and returns to the beginning |
21. GSK990M GCode
G-code | Group | Explain |
G00 | 1 | Positioning (fast moving) |
G01 | Linear cutting | |
G02 | Clockwise circular arc | |
G03 | Counterclockwise tangent arc | |
G04 | 0 | suspend |
G17 | 2 | XY face assignment |
G18 | XZ face assignment | |
G19 | YZ face assignment | |
G28 | 0 | Machine return to origin |
G29 | Return from reference point | |
*G40 | 7 | Cancel tool diameter offset |
G41 | Tool diameter left offset | |
G42 | Tool diameter right offset | |
*G43 | 8 | Tool length + direction offset |
*G44 | Tool length minus direction offset | |
G49 | Cancel tool length offset | |
*G53 | 14 | machine tool coordinate system selection |
G54 | workpiece coordinate system 1 Selection | |
G55 | workpiece coordinate system 2 selection | |
G56 | workpiece coordinate system 3 selection | |
G57 | workpiece coordinate system 4 selection | |
G58 | workpiece coordinate system 5 Selection | |
G59 | workpiece coordinate system 6 selection | |
G73 | 9 | high speed deep hole drilling cycle |
G74 | left spiral cutting cycle | |
G76 | fine boring cycle | |
*G80 | cancel fixed cycle | |
G81 | drilling cycle (spot drilling) | |
G82 | drilling cycle (boring stepped holes) | |
G83 | deep hole drilling cycle | |
G84 | tapping cycle | |
G85 | boring cycle | |
G86 | borehole circulation | |
G87 | reverse boring cycle | |
G88 | boring cycle | |
G89 | boring cycle | |
*G90 | 3 | use absolute value command |
G91 | use incremental value command | |
G92 | 0 | set workpiece coordinate system |
*G98 | 10 | fixed cycle return to starting point |
*G99 | return to fixed cycle r point |
22. GSK990M Mcode
M-code | Instruction |
M00 | Program stop |
M01 | Select Stop |
M02 | Program end (reset) |
M03 | Spindle forward rotation (CW) |
M04 | Spindle reversal (CCW) |
M05 | Spindle stop |
M06 | Change knife |
M08 | Cutting fluid on |
M09 | Cutting fluid off |
M10 | Clamping |
M11 | Release |
M32 | Lubrication on |
M33 | Lubrication off |
M98 | Subroutine call |
M99 | End of subroutine |
23. GSK928MA G-code
G-code | Explain |
G00 | Positioning (fast moving) |
G1 | Linear cutting |
G02 | Clockwise circular arc |
G03 | Counterclockwise tangent arc |
G04 | Delay waiting |
G17 | XY face assignment |
G18 | XZ face assignment |
G19 | YZ face assignment |
G28 | Machine return to origin |
G29 | Return from reference point |
*G40 | Cancel tool diameter offset |
G41 | Tool diameter left offset |
G42 | Tool diameter right offset |
*G43 | Tool length + direction offset |
*G44 | Tool length offset in one direction |
G49 | Cancel tool length offset |
*G53 | Machine coordinate system selection |
G54 | Workpiece coordinate system 1 Selection |
G55 | Workpiece coordinate system 2 selection |
G56 | Workpiece coordinate system 3 selection |
G57 | Workpiece coordinate system 4 selection |
G58 | Workpiece coordinate system 5 Selection |
G59 | Workpiece coordinate system 6 selection |
G73 | High speed deep hole drilling cycle |
G74 | Left spiral cutting cycle |
G80 | Cancel fixed cycle |
G81 | Drilling cycle (spot drilling) |
G82 | Drilling cycle (boring stepped holes) |
G83 | Deep hole drilling cycle |
G84 | Right tapping circulation |
G85 | Boring cycle |
G86 | Drilling cycle |
G89 | Boring cycle |
*G90 | Use absolute value command |
G91 | Use incremental value command |
G92 | Set floating coordinate system |
*G98 | Fixed cycle return to starting point |
*G99 | Return to fixed cycle r point |
G10G11 | Rough milling in circular groove |
G12G13 | Full circle internal finish milling |
G14G15 | Cylindrical finish milling |
G22 | System parameter operation (mode) |
G23 | Parameter value jump |
G27 | Mechanical zero point detection |
G28 | Quickly locate the program through the middle point |
G31 | Quick return to R datum |
G34G35 | Finish milling in rectangular groove |
G38G39 | Rectangular external finish milling |
24. GSK928MAMcode
M2 | The program ends and stops. Stop the spindle, turn off the coolant, eliminate the G93 coordinate offset and tool offset, and return to the starting program section (not running). After executing M2, the system will switch to the reference workpiece coordinate system. |
M3 | Spindle forward rotation |
M4 | Spindle reversal |
M5 | Stop spindle |
M8 | Turn on the cooling pump |
M9 | Turn off the cooling pump |
M12 | Pause: wait for the “run” key to continue running (press the emergency stop key to stop) |
M30 | At the end of the program, eliminate the tool offset and return to the starting program segment (not running). After executing M30, the system will switch to the reference workpiece coordinate system. |
M32 | Lubrication on; |
M33 | Lubrication off; |
M98 | Call subroutine |
M99 | Subroutine end return |
25. Mitsubishi E60 milling machine G code
G-code | Group | Explain |
※G00 | 1 | Position positioning (rapid feed) |
*G01 | Straight line repair | |
G02 | Clockwise arc cutting (CW) | |
G03 | Counterclockwise arc cutting (CCW) | |
G04 | 0 | suspend |
G05 | High speed machining mode | |
G09 | Stop the check correctly | |
G10 | Program parameter input / correction input | |
G11 | Program parameter input cancel | |
G12 | Circular cutting CW | |
G13 | Circular cutting CCW | |
*G17 | 2 | Plane selection X-Y |
※G18 | Plane selection z-x | |
G19 | Plane selection Y-Z | |
※G20 | 6 | Imperial directive |
G21 | Metric instruction | |
G27 | 0 | Reference origin check |
G28 | Reference origin reset | |
G29 | Start point reset | |
G30 | The 2nd ~ 4th reference origin reset | |
G31 | Jumping function | |
G33 | 1 | Thread cutting |
G37 | 0 | Automatic tool length measurement |
G38 | Tool diameter correction vector assignment | |
G39 | Angle arc correction tool | |
*G40 | 7 | Tool diameter correction cancellation |
G41 | Tool diameter correction left | |
G42 | Tool diameter correction right | |
G43 | 8 | Tool length correction (+) |
G44 | Tool length correction (I) | |
*G49 | Tool length correction quantity cancellation | |
G52 | 0 | Local coordinate system setting |
G53 | Selection of mechanical coordinate system | |
*G54 | 12 | Workpiece coordinate system 1 Selection |
G55 | 12 | Workpiece coordinate system 2 selection |
G56 | Workpiece coordinate system 3 selection | |
G57 | Workpiece coordinate system 4 selection | |
G58 | Workpiece coordinate system 5 Selection | |
G59 | Workpiece coordinate system 6 selection | |
G60 | 0 | Unidirectional position positioning |
G61 | 13 | Make sure to stop the inspection mode |
G62 | Automatic angle feed rate adjustment | |
G63 | Tapping mode | |
*G64 | Cutting mode | |
G73 | 9 | Fixed cycle (step cycle) |
G74 | Fixed circulation (reverse tapping) | |
G76 | Fixed cycle (fine boring) | |
*G80 | Fixed cycle cancellation | |
G81 | Fixed circulation (drilling / lead hole) | |
G82 | Fixed cycle (drilling / counter boring) | |
G83 | Fixed circulation (deep drilling) | |
G84 | Fixed circulation (tapping) | |
G85 | Fixed cycle (boring) | |
G86 | Fixed cycle (boring) | |
G87 | Fixed cycle (reverse boring) | |
G88 | Fixed cycle (boring) | |
G89 | Fixed cycle (boring) | |
*G90 | 3 | Absolute value instruction |
*G91 | Incremental value instruction | |
G92 | 0 | Mechanical coordinate system setting |
G93 | 5 | Counterclockwise feed |
*G94 | Asynchronous cutting (feed per minute) | |
*G95 | Simultaneous cutting (feed for each drilling) | |
*G96 | 17 | The cycle speed must be controlled effectively |
*G97 | The cycle speed control must be invalid | |
*G98 | 10 | Fixed cycle starting point reset |
G99 | Fixed cycle r-point reset |
26. DASEN3I milling machine G code
G-code | Group | Explain |
※G00 | 1 | Position positioning (rapid feed) |
*G01 | Straight line repair | |
G02 | Clockwise arc cutting (CW) | |
G03 | Counterclockwise arc cutting (CCW) | |
G04 | 0 | suspend |
G05 | High speed machining mode | |
G09 | Stop the check correctly | |
G10 | Program parameter input / correction input | |
G11 | Program parameter input cancel | |
G12 | Circular cutting CW | |
G13 | Circular cutting CCW | |
*G17 | 2 | Plane selection X-Y |
※G18 | Plane selection z-x | |
G19 | Plane selection Y-Z | |
※G20 | 6 | Imperial directive |
G21 | Metric instruction | |
G27 | 0 | Reference origin check |
G28 | Reference origin reset | |
G29 | Start point reset | |
G30 | The 2nd ~ 4th reference origin reset | |
G31 | Jumping function | |
G33 | 1 | Thread cutting |
G37 | 0 | Automatic tool length measurement |
G38 | Tool diameter correction vector assignment | |
G39 | Angle arc correction tool | |
*G40 | 7 | Tool diameter correction cancellation |
G41 | Tool diameter correction left | |
G42 | Tool diameter correction right | |
G43 | 8 | Tool length correction (+) |
G44 | Tool length correction (I) | |
*G49 | Tool length correction quantity cancellation | |
G52 | 0 | Local coordinate system setting |
G53 | Selection of mechanical coordinate system | |
*G54 | 12 | Workpiece coordinate system 1 Selection |
G55 | 12 | Workpiece coordinate system 2 selection |
G56 | Workpiece coordinate system 3 selection | |
G57 | Workpiece coordinate system 4 selection | |
G58 | Workpiece coordinate system 5 Selection | |
G59 | Workpiece coordinate system 6 selection | |
G60 | 0 | Unidirectional position positioning |
G61 | 13 | Make sure to stop the inspection mode |
G62 | Automatic angle feed rate adjustment | |
G63 | Tapping mode | |
*G64 | Cutting mode | |
G73 | 9 | Fixed cycle (step cycle) |
G74 | Fixed circulation (reverse tapping) | |
G76 | Fixed cycle (fine boring) | |
*G80 | Fixed cycle cancellation | |
G81 | Fixed circulation (drilling / lead hole) | |
G82 | Fixed cycle (drilling / counter boring) | |
G83 | Fixed circulation (deep drilling) | |
G84 | Fixed circulation (tapping) | |
G85 | Fixed cycle (boring) | |
G86 | Fixed cycle (boring) | |
G87 | Fixed cycle (reverse boring) | |
G88 | Fixed cycle (boring) | |
G89 | Fixed cycle (boring) | |
*G90 | 3 | Absolute value instruction |
*G91 | Incremental value instruction | |
G92 | 0 | Mechanical coordinate system setting |
G93 | 5 | Counterclockwise feed |
*G94 | Asynchronous cutting (feed per minute) | |
*G95 | Simultaneous cutting (feed for each drilling) | |
*G96 | 17 | The cycle speed must be controlled effectively |
*G97 | The cycle speed control must be invalid | |
*G98 | 10 | Fixed cycle starting point reset |
G99 | Fixed cycle r-point reset |
27. DASEN3I lathe G code
G-code | Group | Explain |
※G00 | 1 | Fast mobile positioning |
※G01 | Straight line repair | |
G02 | Arc gap (CW, Clockwise Clock) | |
G03 | Arc gap repair (CCW, counter clock) | |
G04 | 0 | suspend |
G09 | Correct stop | |
G10 | Program parameters / correction input | |
G11 | Program parameter / correction input mode cancelled | |
※G17 | 2 | X-Y plane selection |
※G18 | Z-x plane selection | |
※G19 | Y-Z plane selection | |
※G20 | 6 | Imperial input |
※G21 | Metric input | |
G27 | 0 | Reference point reset check |
G28 | Automatic reference point reset | |
G29 | Reset from reference point | |
G30 | Reset of reference points 2, 3 and 4 | |
G31 | Jumping function | |
G33 | 1 | Thread cutting |
G34 | Variable thread cutting | |
G37 | 0 | Automatic tool correction |
*G40 | 7 | Tool diameter correction cancellation |
G41 | Tool diameter correction (left side) | |
G42 | Tool diameter correction (right side) | |
G46 | Tool diameter correction (automatic direction selection) | |
G52 | 0 | Local coordinate system setting |
G53 | Selection of mechanical coordinate system | |
※G54 | 12 | Workpiece coordinate system selection 1 |
G55 | Workpiece coordinate system selection 2 | |
G56 | Workpiece coordinate system selection 3 | |
G57 | Workpiece coordinate system selection 4 | |
G58 | Workpiece coordinate system selection 5 | |
G59 | Workpiece coordinate system selection 6 | |
G61 | 13 | Correct stop check mode |
G62 | Automatic angle speed control | |
G63 | Tapping mode | |
*G64 | Cutting mode | |
G70 | 9 | Finish cutting cycle |
G71 | Straight turning rough cutting cycle | |
G72 | End face rough cutting cycle | |
G73 | Spindle table movement in rough machining cycle | |
G74 | End cutting cycle | |
G75 | Straight turning cycle | |
G76 | Thread cutting cycle | |
G77 | From cutting cycle | |
G78 | Tooth fixation cycle | |
G79 | End cutting fixed cycle | |
G80 | Machining hole cycle command cancel | |
G83 | Deep drilling cycle (Z-axis) | |
G84 | Tapping cycle (Z axis) | |
G85 | Boring cycle (Z axis) | |
G87 | Deep hole drilling cycle (x-axis) | |
G88 | Tapping cycle (x-axis) | |
G89 | Boring cycle (x-axis) | |
※G90 | 3 | Absolute value command |
※G91 | Incremental value command | |
G92 | 0 | Coordinate system setting / spindle speed setting |
※G94 | 5 | Asynchronous feed (feed per minute) |
※G95 | Synchronous feed (feed per revolution) | |
※G96 | 17 | Cycle speed control on |
※G97 | Cycle speed must be controlled off | |
*G98 | 10 | Fixed cycle |
Initial value reversion | ||
G99 | Fixed cycle | |
R-point reset |
28. Huaxing lathe G code
G-code | Explain |
G00 | Fast positioning |
G01 | Linear interpolation |
G02 | Clockwise circular interpolation |
G03 | Counterclockwise circular interpolation |
G04 | delayed |
G09 | Feed quasi stop |
G20 | Independent subroutine call |
G22 | Independent subroutine definition |
G24 | When the independent subroutine definition is finished, return to the calling program |
G25 | Jump processing |
G26 | Block call subroutine call in machining program |
G27 | Infinite loop |
G30 | Magnification cancellation |
G31 | Magnification definition |
G47 | Short linear speed automatic transition |
G48 | cancel |
G54~G59 | Workpiece coordinate system selection |
G71 | Internal and external circular cutting |
G72 | Face cutting compound cycle |
G73 | Closed contour compound cycle |
G74 | Return to machine reference point (mechanical origin) |
G75 | Return to tool setting point |
G76 | Return to machining start point |
G77 | Restore the current coordinate system |
G81 | Cylindrical machining cycle |
G82 | End face machining cycle |
G85 | Inch rigid tapping cycle |
G86 | Metric thread machining cycle |
G87 | Inch thread machining cycle |
G90 | Absolute value mode programming |
G91 | Incremental value programming |
G92 | Set program zero |
G96 | Constant linear speed cutting is effective |
G97 | Cancel constant linear speed cutting |
G98 | Cancel feed per revolution |
G99 | Set feed per revolution |
P = parameter assignment |
29. Huaxing lathe M code
Minstruction | Explain |
M01 | Conditional stop |
M02 | Program end and shutdown |
M03 | Spindle forward rotation |
M04 | Spindle reversal |
M05 | Spindle stop |
M06 | Cooling on |
M07 | Cooling off |
M08 | Workpiece clamping |
M09 | Workpiece loosening |
M10 | Turn on the specified relay |
M11 | Turn off the specified relay |
M20 | Set tool complement number |
M21 | The program ends and returns to the beginning of the program |
M71~M85 | Relay pulse output |
30. Huaxing milling machine G code
G-code | Explain |
G01 | linear interpolation |
G02 | Clockwise arc interpolation or spiral interpolation |
G03 | Counterclockwise arc interpolation or spiral interpolation |
G04 | delayed |
G09 | Servo quasi stop in place |
G11 | The block is mirrored along the Y axis |
G12 | The block is mirrored along the X axis |
G13 | The program block is processed by mirror image at the origin |
G17 | Select the xoy plane |
G18 | Select the x0z plane |
G19 | Select the y0z plane |
G20 | Subroutine call |
G22 | subprogram declaration |
G24 | The subroutine definition ends and returns to the calling program |
G25 | Jump processing |
G26 | Transfer processing |
G27 | Infinite loop |
G30 | Zoom in / out magnification cancel |
G31 | Definition of magnification / reduction ratio |
G40 | Cancel tool radius compensation |
G41 | Left tool radius compensation |
G42 | Right tool radius compensation |
G43 | Establish tool length compensation |
G44 | Undo tool length compensation |
G47 | Short linear speed automatic transition |
G48 | Cancel the automatic transition of short linear speed |
G54~G59 | Workpiece coordinate system selection |
G73 | High speed deep hole machining cycle |
G74 | Return to machine reference point (mechanical origin) |
G75 | Return to tool setting point |
G76 | Return to program zero from current position |
G78 | Fine boring cycle |
G81 | Central hole drilling cycle |
G82 | Central drilling cycle with pause |
G83 | Deep hole machining cycle |
G84 | Metric rigid tapping cycle |
G85 | Inch rigid tapping cycle |
G86 | Boring cycle (automatic return) |
G87 | Reverse boring cycle |
G88 | Boring cycle (manual return) |
G89 | Boring cycle with pause |
G90 | Absolute value mode programming |
G91 | Incremental value programming |
G92 | Set workpiece coordinate system |
P = parameter assignment |
31. Huaxing milling machine M code
G-code | Explain |
M00 | Program pause |
M01 | L ××(K ××) |
M02 | Program end and shutdown |
M03 | Spindle forward rotation |
M04 | Spindle reversal |
M05 | Spindle stop |
M08 | Cooling on |
M09 | Cooling off |
M10 | Workpiece clamping |
M11 | Workpiece loosening |
M20 | K ×× Relay No |
M21 | K ×× shut ×× Relay No |
M30 | The program ends and returns to the beginning of the program |
M71~M85 | Relay pulse output |
32. Renhe 32T Gcode
G code | Explain |
G00 | quick point positioning instructions |
G01 | Linear interpolation instruction |
G02、G03 | Circular interpolation instruction |
G04 | Program delay instruction |
G26、G27 | Return to starting point instruction |
G28、G29 | |
G22、G80 | Program loop instruction |
G23 | Rectangular loop instruction |
G37、G38G39、G36 | Return hard reference point command |
G82、G83 | Thread cycle command |
G46、G47G48、G49 | Return soft reference point command |
G96、G97 | Constant linear speed cutting function |
33. Renhe 32T M code
Minstruction | Explain |
M00 | Program pause instruction |
M02 | Program end instruction |
M30 | Spindle stop, program end command |
M20 | Automatic cycle command |
M03 | Spindle forward rotation command |
M04 | Spindle reverse command |
M05 | Spindle stop command |
M06 | Wait for instructions after sending a letter |
M26 | Sending instructions |
M21 | Wait for instructions after sending a letter |
M97 | Program jump instruction |
M98 | Subroutine call instruction |
M99 | Subroutine return instruction |
34. SKY 2003N M G-code
G-code | Group | Type | Function |
G00 | 01 | 1 | Positioning (fast moving) |
G01 | Linear interpolation (feed) | ||
G02 | Arc interpolation (clockwise) | ||
G03 | Arc interpolation (counterclockwise) | ||
G02+Z | Right helix interpolation | ||
G03+Z | Left spiral interpolation | ||
G04 | 02 | 2 | suspend |
G17 | 04 | 1 | XY plane selection |
G18 | 1 | ZX plane selection | |
G19 | YZ plane selection | ||
G40 | 07 | 1 | Tool compensationerase |
G41 | Tool compensation left | ||
G42 | Tool compensation right | ||
G43 | 08 | Tool length forward compensation | |
G44 | Tool length negative compensation | ||
G49 | Tool length compensation erasure | ||
G50 | 11 | Zoom, mirror off | |
G51 | 11 | Zoom, mirror on | |
G54 | 14 | Workpiece coordinate system 1 Selection | |
G55 | Workpiece coordinate system 2 selection | ||
G56 | Workpiece coordinate system 3 selection | ||
G57 | Workpiece coordinate system 4 selection | ||
G58 | Workpiece coordinate system 5 Selection | ||
G59 | Workpiece coordinate system 6 selection | ||
G68 | 03 | Coordinate rotation | |
G69 | 03 | Coordinate rotation erasure | |
G73 | 15 | Step cycle | |
G74 | Counter attack tooth circulation (machining center) | ||
G76 | Fine boring cycle (machining center) | ||
G80 | Fixed cycle erasure | ||
G81 | Drilling and spot facing cycle | ||
G82 | Drilling and reverse boring cycle | ||
G83 | Deep hole drilling cycle | ||
G84 | Tapping circulation | ||
G85/G86 | Boring cycle | ||
G87 | Reverse boring cycle | ||
G88/G89 | Boring cycle | ||
G90 | 00 | Absolute value programming | |
G91 | Incremental value programming | ||
G92 | 05 | Coordinate system setting | |
G98 | 16 | Return to initial plane | |
G99 | Return to r-point plane |
35. SKY 2003N M Mcode
Group | M-code | Function |
A | M00,M01,M02 | The program stops, the program chooses to stop, and the program ends |
B | M03,M04,M05 | Spindle forward rotation, spindle reverse rotation, spindle stop |
C | M06 | Automatic tool change |
D | M08,M09 | Coolant on, coolant off |
E | M98,M99 | Call the subroutine and the subroutine returns |
Variations Across Different CNC Machines
CNC (Computer Numerical Control) machines vary significantly in their capabilities, configurations, and specific interpretations of G codes and M codes. Understanding these variations is crucial for CNC programmers and operators to ensure precise and efficient machining processes.
Types of CNC Machines by Number of Axes
2-Axis CNC Machines
2-axis CNC machines operate on the X (horizontal) and Y (vertical) axes. These machines are typically used for straightforward operations such as making straight-line cuts, drilling holes, or processing a single surface of a workpiece without needing to reposition it. They are commonly used in industries like woodworking and simple metalworking tasks.
3-Axis CNC Machines
3-axis CNC machines add the Z-axis (depth) to the X and Y axes, allowing for more complex machining in three dimensions. These machines can handle a variety of tasks, such as milling, drilling, and cutting, making them the most common type of CNC machine. They are widely used in manufacturing components for the automotive and aerospace industries.
4-Axis CNC Machines
4-axis CNC machines incorporate an additional rotational axis (A-axis) to the three linear axes (X, Y, Z). This rotational axis allows the cutting tool or workpiece to rotate, enabling the creation of more complex geometries and cutouts along an arc. They are particularly useful in tasks like engraving curved surfaces or machining cylindrical objects, often found in jewelry making and advanced metalworking.
5-Axis CNC Machines
5-axis CNC machines feature two additional rotational axes (B-axis and C-axis) on top of the three linear axes. These machines enable simultaneous multi-surface machining, allowing the cutting tool or work table to pivot. This capability is essential for producing intricate parts with complex geometries, commonly used in industries like aerospace and medical device manufacturing.
6-Axis CNC Machines
6-axis CNC machines include a third rotational direction (B-axis) in addition to the five axes of a 5-axis machine. This configuration allows for creating parts with any possible surface finish by involving all conceivable movement directions of the cutting tool and workpiece. They are frequently used in applications requiring extremely high precision and complex surface finishes, such as in the production of high-end automotive components.
7-Axis CNC Machines
7-axis CNC machines combine three traditional axes for cutting tool movement, three axes for rotating the workpiece, and a seventh axis (E-axis) that rotates the arm holding the cutting tool. These machines are designed for producing highly complex parts, often used in the aerospace, medical, and military industries for components like turbine blades and orthopedic implants.
9-Axis CNC Machines
9-axis CNC machines combine the functions of a 5-axis milling machine and a 4-axis lathe. This allows the milling machine to work on the surface while the lathe completes internal features of the workpiece, enabling the creation of both internal and external features in a single setup. These machines are ideal for producing complex components like dental implants and surgical tools.
12-Axis CNC Machines
12-axis CNC machines are the most complex, featuring two cutting heads that can move in all six possible axes (X, Y, Z, A, B, and C). These machines significantly enhance accuracy and production speed but are generally reserved for highly specialized applications, such as advanced aerospace components.
Machine Configurations
CNC Milling Machines
CNC milling machines are available in vertical and horizontal configurations.
- Vertical CNC Machines: These machines have a vertically oriented spindle and are ideal for high-volume, rapid projects. They are valued for their precision, efficiency, and ability to meet tight tolerances. However, they often lack pallet changers, meaning part loading and cutting occur in the same area. Common applications include machining flat surfaces and cavities, often used in mold making and die sinking.
- Horizontal CNC Machines: These machines feature a horizontally oriented spindle, allowing for more aggressive material removal and better chip evacuation. They can accommodate larger workpieces and perform multiple operations without changing fixtures. They are commonly used in machining complex parts like engine blocks and gearboxes.
CNC Lathes (CNC Turning Centers)
CNC lathes are designed for precision and repeatability, using a cutting tool to remove material from a rotating workpiece. They can be configured with additional “live tools” for milling tasks, which allow the machine to perform secondary operations such as drilling or tapping without moving the workpiece to another machine. CNC lathes are integral to industries such as automotive, aerospace, medical, and defense, often used for producing cylindrical components like shafts and bushings.
Specialized Features
Multi-Axis Machining
Multi-axis machining involves using multiple axes to achieve complex geometries and tight tolerances. This type of machining is more complex and requires specialized machinery and operators with expert knowledge. It is essential for applications requiring intricate designs and precision, such as in the production of aerospace components and medical implants.
Indexed and Continuous 5-Axis CNC Machines
- Indexed 5-Axis CNC Machines: These machines allow the cutting tool or work table to rotate between operations, giving access to the workpiece from different angles without human intervention. They are faster and more accurate than 3-axis machines but lack the true free-form capabilities of continuous 5-axis machines. Indexed 5-axis machines are often used in the production of parts with angled features, such as turbine blades.
- Continuous 5-Axis CNC Machines: These machines enable the movement of all five axes simultaneously during machining operations, allowing for highly complex and smooth geometries. This capability is crucial for creating freeform surfaces and intricate details, often required in the aerospace and medical industries for components like complex airfoils and prosthetic devices.
Automatic Tool Changer (ATC)
An ATC is a feature available on various CNC machines that enables the automatic switching of tools, enhancing efficiency and reducing downtime. This feature is particularly useful in operations requiring frequent tool changes, such as in high-volume manufacturing environments.
Variations in G and M Codes
G and M codes can vary between different CNC machines and controllers. For instance, the same G or M code might have different functions or parameters on machines from different manufacturers or using different control systems (e.g., Fanuc, Siemens, Haas). It is crucial for CNC programmers to understand these variations to ensure compatibility and correct machine operation.
By understanding the variations across different CNC machines, programmers and operators can optimize their use of G and M codes to achieve precise and efficient machining processes tailored to the specific capabilities of their equipment.
Integration with CAD/CAM Software
Definition and Workflow
Integration of CAD (Computer-Aided Design) and CAM (Computer-Aided Manufacturing) software is crucial in modern CNC machining. This integration provides a seamless workflow from design to production. Integrated CAD/CAM systems utilize the same design data for both designing and manufacturing. This eliminates the need to export and import data between separate CAD and CAM applications. As a result, the design geometry created in the CAD software is directly utilized by the CAM software to generate tool paths and machining instructions.
Benefits of Integrated CAD/CAM Systems
Elimination of Data Translation Errors
A primary benefit of integrated CAD/CAM systems is the elimination of data translation errors. When CAD and CAM software are separate, exporting design data from CAD and importing it into CAM can lead to inaccuracies. Integrated systems ensure that the CAM software receives accurate geometry from the CAD design. This significantly reduces costly and error-prone data translations.
Improved Collaboration and Organization
Integrated CAD/CAM systems facilitate better collaboration between design and manufacturing teams. By using a single model that supports both design and manufacturing functions, the need for multiple disconnected files is reduced. All teams work with the latest design iteration, leading to more efficient workflows and quicker turnaround times.
Simplified Workflow
The integrated workflow of CAD/CAM systems reduces the time-consuming iterations required when design changes occur. Changes made to the CAD design are automatically reflected in the CAM tool paths. This streamlining reduces rework and ensures that any modifications in the design phase are promptly incorporated into the manufacturing phase, enhancing overall efficiency.
Reduced Production Costs and Improved Accuracy
By eliminating data translation errors and ensuring that the CAM software uses the exact design geometry, integrated CAD/CAM systems improve manufacturing accuracy. This improvement reduces production costs associated with errors and rework. The seamless transition from design to manufacturing ensures that the final product adheres closely to the original design specifications, enhancing product quality. For example, a study showed that companies utilizing integrated CAD/CAM systems experienced up to a 30% reduction in production time and a 25% decrease in errors.
Automation of Manufacturing Processes
Integrated CAD/CAM systems enable automation by using the same data formats and interfaces. This allows for the automatic generation of CNC programs, including tool selection, speeds, and feeds based on design data such as tolerances and surface finish information. Automation minimizes manual input, reduces errors, and accelerates the production process.
Integrated Validation Tools
These systems often include modules for validating designs before machining operations begin. Integrated validation tools, such as G-code machine simulations, help eliminate dry runs and avoid costly machine collisions and programming errors. By simulating the entire machining process, potential issues can be identified and resolved before actual production begins.
Enhanced Efficiency and Reduced Training Time
Working within a familiar CAD environment reduces training time for CAM users. The continuous workflow and associativity with the CAD model ensure faster and more productive work processes. Users can leverage their existing knowledge of CAD tools to transition efficiently to CAM tasks, streamlining the learning curve.
Case Studies and Practical Applications
Companies like CP-Carrillo LLC have leveraged integrated CAD/CAM solutions, such as SOLIDWORKS and CAMWorks, to automate design and part programming. These integrations have led to significant reductions in lead time, design time, CNC programming time, and scrap/rework. For instance, they reported a 40% decrease in programming time and a 20% reduction in lead times. Such case studies highlight the tangible benefits of adopting integrated CAD/CAM systems in real-world manufacturing environments.
Frequently Asked Questions
Below are answers to some frequently asked questions:
What are G codes and M codes in CNC machining?
In CNC machining, G codes and M codes are essential programming languages that dictate the machine’s operations. G codes, which stand for “geometry,” are primarily responsible for directing the machine’s movements and cutting actions. They instruct the CNC machine to perform specific geometric operations like moving in straight lines, circles, or other defined paths. Examples of G codes include G00 for rapid positioning, G01 for linear interpolation, G02 for circular interpolation in a clockwise direction, and G03 for circular interpolation in a counterclockwise direction. These codes use Cartesian coordinates (X, Y, Z) to specify tool positions and movements, with other letters like A, T, F, R, I, and J designating additional movements or geometric locations.
On the other hand, M codes, referred to as “miscellaneous” or “machine” codes, control non-geometric functions. These codes manage tasks such as starting or stopping the spindle, changing tools, activating coolant systems, and halting the program. Examples of M codes include M00 for a program stop, M01 for an optional program stop, M02 for ending the program, M03 for spindle on clockwise, M04 for spindle on counterclockwise, M05 for spindle stop, M06 for tool change, M08 for flood coolant on, and M09 for coolant off. M codes are crucial for controlling various machine functions unrelated to the tool’s geometric movement, and they must be used precisely to avoid programming conflicts.
G and M codes can vary across different CNC machines due to machine-specific dialects, affecting numerical formatting and code interpretation. Therefore, CNC programmers must be familiar with the specific coding requirements of the equipment they are using to ensure accurate machining processes. Together, G codes and M codes work in CNC programs to achieve desired machining operations, with G codes providing geometric instructions and M codes managing auxiliary functions. This integration is facilitated by computer-aided manufacturing (CAM) software, which can generate complex programs and optimize tooling paths, although manual programming is also possible with proper expertise.
How do G codes control the motion of a CNC machine?
G codes are essential for controlling the motion of a CNC machine by providing specific instructions that dictate how the machine should operate to create parts. These codes can command various types of movements, including rapid positioning (G00) for quickly moving the tool without cutting, and linear interpolation (G01) for moving the tool in a straight line at a defined feed rate during cutting operations. Additionally, G codes allow for circular movements through commands like G02 and G03, which instruct the machine to move in clockwise or counterclockwise arcs, respectively.
Positioning modes are also controlled by G codes. For instance, G90 sets the machine to absolute positioning, where movements are referenced from a fixed origin, while G91 enables incremental positioning, where movements are based on the current tool position.
Speed and feed rates are managed through various G codes as well. G94 and G95 specify how the feed rate is interpreted—either per minute or per revolution of the spindle—while G96 and G97 control the surface speed and spindle speed, respectively.
The machine’s operational plane is selected using G codes like G17, G18, and G19, which define whether the tool will move in the XY, XZ, or YZ plane, respectively. This selection is crucial in multi-axis machining to ensure proper tool path execution.
Furthermore, G codes can include miscellaneous commands, such as G04 for dwell, which pauses the machine for a specific duration, allowing for processes like cooling or stabilizing spindle speed.
Overall, G codes are interpreted by the CNC machine’s microcontroller, which translates these high-level instructions into precise motor actions, enabling accurate and controlled machining processes. Each line of G code, known as a block, can encompass multiple commands, ensuring a seamless operation tailored to the machining requirements.
What are some common examples of M codes?
M-codes are essential commands in CNC machining that control various machine functions. Here are some common examples along with their functions:
- M00: Program stop. Halts all machine operations for operator intervention or inspection.
- M01: Optional program stop. Similar to M00 but can be bypassed based on settings or operator preference.
- M02: End of program. Indicates the completion of the machining process.
- M03: Spindle on clockwise. Activates spindle rotation in a clockwise direction.
- M04: Spindle on counterclockwise. Commands the spindle to rotate counterclockwise.
- M05: Spindle stop. Stops spindle rotation.
- M06: Tool change. Facilitates changing the tool.
- M07: Mist coolant on. Turns on mist coolant.
- M08: Flood coolant on. Activates flood coolant.
- M09: Coolant off. Deactivates both mist and flood coolants.
- M10: Clamp on. Engages the clamp.
- M11: Clamp off. Disengages the clamp.
- M19: Spindle orientation. Sets the spindle to a specific orientation.
- M30: End of program, rewind, and reset. Signals the end of the program and resets the machine to its starting point.
- M98: Subprogram call. Calls a subprogram within the main program.
- M99: Return from subprogram. Returns control from a subprogram to the main program.
These M-codes are fundamental for controlling machine functions, ensuring precise and efficient CNC machining operations.
How do G and M codes vary between different CNC machines?
G and M codes, while standardized, exhibit significant variations across different CNC machines due to several key factors.
Firstly, the numerical formatting of these codes can differ. Some machines may require leading zeros (for example, usingG03
instead ofG3
), and the spacing between commands may also vary, which can lead to execution errors if not properly understood.
Secondly, the interpretation of the same G or M code can differ from one machine to another. For instance, a specific G code might serve one function on a particular machine but could have an entirely different application on another. This variability is especially pronounced with M codes, which can be more tailored and machine-specific. Additionally, certain machines may utilize proprietary coding systems, such as Mazak’s Mazatrol, diverging from standard G and M codes.
Furthermore, the use of additional letters and numbers in these codes can vary based on the machine’s capabilities. For example, the representation of coordinates and auxiliary functions may differ in machines with varying axes. Letters like A, B, and C can have distinct meanings depending on the configuration of the machine, impacting how rotational values or auxiliary axes are defined.
Customization is another important aspect, particularly with M codes, which can be highly specific to the machine’s design. An M code that performs a function on one machine may not yield the same results on another due to these customizations. Additionally, proprietary coding systems developed by manufacturers can complicate compatibility across different machines.
Finally, programming software such as CAM tools can influence how G and M codes are generated and interpreted. While these tools can produce code optimized for specific machines, programmers must remain aware of the unique requirements of each machine to ensure accuracy and functionality.
In conclusion, despite the standardized nature of G and M codes, their implementation and interpretation can vary greatly between different CNC machines, making it essential for operators and programmers to have a comprehensive understanding of the specific machine’s coding requirements.
Can CAD/CAM software generate G and M codes automatically?
Yes, CAD/CAM software can automatically generate G and M codes. This capability streamlines the process of converting design models into executable instructions for CNC machines, significantly enhancing productivity and reducing the potential for errors.
CAD/CAM software integrates the design phase with the manufacturing phase. It uses the 3D CAD model geometry to automatically generate G codes, which dictate the geometric movements of the machine, such as tool paths, cutting speeds, and feed rates. This eliminates the need for manual programming and ensures precise control over the machining operations.
In addition to G codes, CAM software also generates M codes, which manage auxiliary machine operations like starting and stopping the spindle, tool changes, and coolant control. These codes ensure efficient and smooth transitions between different operations.
The typical workflow involves:
- Designing the part using CAD software.
- Importing the CAD model into CAM software.
- Defining machining parameters and toolpaths.
- Simulating the tool path to verify the process.
- Generating the G and M codes.
- Post-processing the codes for compatibility with the specific CNC machine.
- Transferring the G and M codes to the CNC machine for execution.
This automated process improves productivity, reduces development costs, and enhances product quality by minimizing human errors.
What is the importance of understanding G and M codes for CNC programming?
Understanding G and M codes is crucial for effective and efficient CNC (Computer Numerical Control) programming for several key reasons:
G codes, which control the geometric movements of the CNC machine, are essential for achieving precise and repeatable part production. These codes dictate how the machine tool should move, whether in a straight line, circular motion, or at a specific feed rate, ensuring accuracy and reducing material waste.
M codes handle miscellaneous machine operations such as starting and stopping the spindle, tool changes, and coolant control. They are vital for ensuring the machine functions efficiently, enabling smooth transitions and maintaining productivity.
Both G and M codes work together to automate and control complex manufacturing tasks, allowing CNC machines to execute intricate designs with minimal supervision. This automation frees operators to focus on other production areas, making CNC machines highly flexible and capable of manufacturing a wide range of parts.
Despite the advancements in CAD/CAM software that simplify the generation of these codes, manual programming skills remain important. Understanding G and M codes is necessary for fine-tuning operations, troubleshooting issues, and making custom adjustments that software cannot fully automate. This knowledge helps optimize the machining process by identifying areas for improvement, reducing cycle times, and maximizing the use of tools and machines.
A basic understanding of these codes also allows machinists to adapt their knowledge to different CNC machines, facilitating interoperability and reducing the learning curve when working with new equipment. This adaptability is crucial for avoiding programming conflicts and operational errors.
In industries requiring high precision, such as aerospace or medical device manufacturing, expertise in G and M codes is indispensable for producing complex parts accurately and efficiently. Skilled machinists knowledgeable in these codes are essential for maintaining the high standards required in these fields.
Finally, understanding G and M codes helps reduce errors and improve troubleshooting capabilities. Experienced machinists can quickly identify and correct errors, optimizing setup and run times, reducing costs, and enhancing productivity.
How do you select the appropriate G-codes and M-codes for programming based on different CNC systems?
To select the appropriate G-codes and M-codes for programming based on different CNC systems, a comprehensive approach considering system specifics, processing requirements, and industry best practices is essential. Here’s an optimized explanation:
System-Specific Knowledge:
Thoroughly understand the characteristics and capabilities of the specific CNC system you’re working with (e.g., Fanuc, Siemens, Heidenhain). Each system may have unique implementations of G and M codes, custom cycles, or proprietary functions. Consult the manufacturer’s programming manuals and keep updated on the latest firmware versions and supported features.
Code Functionality and Hierarchy:
Master the fundamental functions of G and M codes:
- G-codes: Motion control, coordinate system selection, canned cycles, etc.
- M-codes: Auxiliary functions like spindle control, coolant management, tool changes.
Understand the modal nature of certain codes and their hierarchy within the control system to avoid conflicts and ensure proper execution.
Process-Driven Selection:
Choose codes based on the specific machining operations and part requirements:
- For contouring: G01 (linear interpolation), G02/G03 (circular interpolation)
- For rapid movements: G00 (rapid positioning)
- For complex geometries: Consider using parametric programming or canned cycles
- For tool management: Appropriate M-codes for tool changes and coolant control
Optimization for Efficiency:
Select codes that optimize machining efficiency:
- Use high-speed machining codes when applicable (e.g., G05.1 for Fanuc)
- Implement canned cycles (e.g., G81 for drilling) to reduce program length and simplify programming
- Utilize advanced features like tool center point control (TCPC) for 5-axis machining when available
Coordinate Systems and Workpiece Setup:
Properly select and utilize coordinate system codes:
- G54-G59 for workpiece coordinate systems
- G17/G18/G19 for plane selection in circular interpolation and canned cycles
Consider using features like coordinate system rotation (G68) for multi-sided machining when appropriate.
Safety and Compliance:
Incorporate safety-related codes and best practices:
- Use M00 (program stop) or M01 (optional stop) for critical inspection points
- Implement G43 (tool length compensation) to prevent collisions
- Include M30 (program end and rewind) to ensure proper program termination
Machine-Specific Optimizations:
Leverage machine-specific features:
- For high-speed machining centers: Use look-ahead functions (e.g., G05.1 Q1 for Fanuc)
- For multi-axis machines: Implement RTCP (Rotation Tool Center Point) functions when available
- For turn-mill centers: Utilize specialized codes for synchronizing spindles and live tooling
Testing and Validation:
Rigorously test your code selections:
- Use simulation software to verify tool paths and identify potential issues
- Perform dry runs and single block execution to ensure proper code functionality
- Validate the program on the actual machine, starting with reduced feed rates for safety
Documentation and Standardization:
Develop and maintain a standardized code library for common operations within your organization. This promotes consistency, reduces programming errors, and facilitates knowledge transfer among team members.
By following this comprehensive approach, you can select the most appropriate G and M codes for your specific CNC system, ensuring efficient, safe, and optimized machining processes. Remember to continuously update your knowledge as CNC technology and programming techniques evolve.
In practical CNC machining, how can G-codes and M-codes be effectively combined to enhance machining efficiency and precision?
In practical CNC machining, effectively combining G-codes and M-codes is crucial for enhancing machining efficiency and precision. This integration requires a deep understanding of both code types and their strategic application within the machining process.
G-codes, which control tool movement and cutting operations, form the backbone of CNC programming. Key G-codes include G00 (rapid positioning), G01 (linear interpolation), G02/G03 (circular interpolation), and G81-G89 (canned cycles for drilling, boring, and tapping). M-codes, on the other hand, manage auxiliary functions such as coolant control (M08/M09), spindle control (M03/M04/M05), and tool changes (M06).
To optimize machining efficiency and precision:
- Streamline tool paths: Utilize advanced G-code functions like G70 (finishing cycle) and G71-G73 (stock removal cycles) for efficient material removal. Implement high-speed machining techniques using G05 (high-speed mode) when appropriate, reducing cycle times while maintaining accuracy.
- Optimize cutting parameters: Combine G96 (constant surface speed control) with appropriate M-codes for spindle speed control to maintain optimal cutting conditions throughout the process, especially for parts with varying diameters.
- Intelligent coolant management: Use M08/M09 in conjunction with through-tool coolant activation (e.g., M88) at critical points in the program. This ensures proper cooling and chip evacuation, particularly during high-precision operations or when machining difficult materials.
- Adaptive tool changes: Implement smart tool change strategies using M06 in combination with tool life monitoring G-codes (G43.4 for tool length compensation). This minimizes unnecessary tool changes while ensuring consistent machining quality.
- Coordinate system optimization: Utilize multiple coordinate systems (G54-G59) in conjunction with G92 (coordinate system setting) to minimize setup times for complex parts or multi-operation jobs.
- Probing and in-process measurement: Integrate probing cycles (G31) with M-codes for automatic workpiece alignment and in-process dimension checking, enhancing overall precision and reducing scrap rates.
- Macro programming: Develop custom macros that combine G-codes and M-codes for frequently repeated operations. This not only improves programming efficiency but also ensures consistency in complex machining sequences.
- Optimized acceleration/deceleration: Use G05.1 (AI contour control) in conjunction with appropriate M-codes for servo control to optimize machine dynamics, particularly for complex contours or high-speed operations.
- Synchronized auxiliary operations: Coordinate M-codes for auxiliary functions (e.g., pallet changes, bar feeders) with G-code sequences to minimize non-cutting time and maximize machine utilization.
- Advanced canned cycles: Utilize specialized canned cycles like G76 (fine boring cycle) or G83 (peck drilling cycle) in combination with appropriate M-codes for coolant and spindle control to optimize challenging operations.
By strategically combining these G-codes and M-codes, CNC programmers can significantly enhance both machining efficiency and precision. This approach requires a thorough understanding of the machine’s capabilities, the workpiece material properties, and the specific requirements of each machining operation. Continuous optimization and refinement of these code combinations, based on real-world performance data and emerging technologies, will further push the boundaries of CNC machining capabilities.
Recommended for you:
- The Complete Guide to CNC Machines: Everything You Need to Know
- The 10 Best Drilling Machine Manufacturers
- 5 Axis Machining: Your Ultimate Guide
- What Is CNC Machine: Parts and Functions Explained
- The Ultimate Guide to CNC Turret Punch Press
- Stainless Steel Cutting: 6 Hot Techniques to Know