Stockbyte/Stockbyte/Getty Images

How to Use CNC G Codes

Growth Trends for Related Jobs

G codes are a set of commands that allow a lathe or milling machine that operates under a computer numerical control program to move to the locations necessary to cut parts. The computer in a CNC machine follows the commands, as well as the locations inputted into the control, when moving the spindle or cutting tool. The machine also uses various information after each G code command to make the proper cuts to machine metal, plastic and graphite among other types of materials.

Use the G0 command to rapidly move the tool to a specified spot. Place X, Y and Z locations after the G0 command to dictate where the spindle moves at a speed dictated by the rapid percentage. At 100 percent, the tool moves as fast as possible. You can adjust the percentage, and therefore the speed, to make sure the tool does not crash into the raw material or part.

Use the G1 command to cut the material at a particular feed rate to a final destination in a straight line. The G1 command uses the starting point entered in the G0 command line and moves the tool to the X, Y and Z positions indicated. A command line of G1 X2.0 Y3.0 Z-1.1 F20.00 moves the tool to the indicated X, Y and Z values at a feed rate of 20 millimeters per minute.

Use the G2 and G3 commands to cut in an arc. This command is responsible for curved cuts that cannot be performed using the G1 command. In the G2 or G3 line, use the I and J lines to incrementally dictate the location of the center of the arc. Use G2 to cut in a clockwise rotation and G3 for a counterclockwise direction.

Use the G4 command to dwell. This command does nothing, but you can use it to stop the cutting process so that you can check the part and make sure that things are running smoothly. Use X, F or P commands to dictate the amount of time in milliseconds the tool will dwell in the program. For example, G4 P20 pauses the tool for 20 milliseconds.

Use the G90 and G91 commands to dictate whether the dimensions entered on the other lines are absolute or incremental. G90 commands are used for absolute dimensions, so the numbers used on all other command lines are based off a set position as zero, zero. G91 is used for incremental movements. If you are at X3, Y2 and you enter X.5, Y3 on the next line, the tool moves half an inch in the X direction and 3 inches in the Y direction from the location in the preceding line.

About the Author

Christian Mullen is a graduate from the University of Central Florida with a bachelor's degree in finance. He has written content articles online since 2009, specializing in financial topics. A professional musician, Mullen also has expert knowledge of the music industry and all of its facets.

Cite this Article