What is G-Code?
G-Code is the common name for the programming language of CNC
Machines. Somewhat of a generic, catch-all type of term for CNC
programming language. Very few machines adhere to this standard today.
There are as many varations as there are manufacturers.
This is how I think of G-Code. It is a simple language built off of
the Cartesian Coordinate System for motion control. That is a mouthful.
I don't know if that is exactly right, but you will get my meaning in a
second when we go through some code line by line. You will remember
your High School Geometry soon enough. For the real pros out there, you
know there is much more to G-Code then that, but it is a good place to
start thinking about it.
You will see many variations of the G-Code name like:
Are there other "Codes?"
In a word…Yes. We will get to that in a moment. G-code is also the
name of any command in a CNC program that begins with the letter G.
G-Codes generally tell the machine to perform an action. G-Codes can
tell machines to move a certain distance in the X-Axis for example. Or,
make a rapid move to another location. Or, move in an arcing fashion
while milling. An on and on and on.
Here are some examples of G-Codes
Remember these codes change to a certain degree between CAM Software packages and CNC Machine Manufacturers.
G00 Rapid positioning
G01 Linear interpolation
G02 CW circular interpolation
G03 CCW circular interpolation
G20 Programming in inches
G21 Programming in mm
G28 Return to home position
G40 Tool radius compensation off
G41 Tool radius compensation left
G42 Tool radius compensation right
G43 Tool offset compensation positive
G44 Tool offset compensation negative
Here is a photo of a number of Post Processors. You select the
one that matches your CNC Machine and then it spits out the G-Code you
Here is a photo of a post process file. It translates the CAD
Design into g-code for you. You then take the G-Code over to your CNC
Machine and run the program.