G-Code stands for Geometric code. This is the generic industry term for the computer language machinists use to control the movements of a machine. These commands direct the machine tool where to move, how fast to move, and the toolpath to follow.

Take for example the CNC lathe machine. The lathe tool is driven by the commands of the G-code to follow a specific toolpath that is programmed into the computer of the machine. In the case of 3D printing, the G-code instructs the machine to layer material to form a specific 3-dimensional figure. Without the G-code, the tools that cut or deposit materials on a machine would fail to move in the designated tool path.  

CAD/CAM Software

CAD/CAM (computer aided design/computer aided manufacturing) is the software CNC machines use for design and machining. Certainly, the tools are synonymous with each other, but they function separately. CAD software is a computer aided program used to create, modify or apply a design. CAD involves the use of geometric shapes to construct a figure that can be 2D or 3D shapes. Designs in the CAD can be drawn using lines, points, and circles allowing for the creation of parts used in multi-axis CNC machining. CAD is the first essential function in the design process of manufacturing. Once the design is completed, it’s processed into a computer aided machine that programs coded language to be read by a CNC machine. Machinists refer to that language as G-Code.

Simply put, CAD deals with the creation of a design. CAM creates a code based on the transferred design. Tools like a lathe or mill read the language of the G-code and follow the specific toolpath programmed by the CAM to form the desired shape out of a piece of material.

To the average person, G-code would appear perplexing. However, a machinist should not find it any more difficult to read than their native language. In fact, one may even argue that G-code is written in a straightforward way.

Each line of code directs the machine to carry out a specific action. In other words, the code controls the speed, position, rotation, etc. These sets of codes that deliver point-by-point directions to the machine form a figure. A simple product can require hundreds and even thousands of lines of code because every movement entails complete precision to produce a flawless result.

 

G-Code Example

For better understanding, here’s a single line of G-code:

G01 X247.951560 Y11.817060 Z-1.000000 F400.000000

As previously mentioned, this may appear perplexing at first, but it is a formula that can easily be understood.

A line of code begins with “G”. Following that will be a set of numbers; in this case, it’s 01. What this means is the machine needs to move in a straight line. Like the coordinates on a plot, X, Y, and Z are the dimensions. The F value represents the feed rate, or the speed.

Moving on to the next set in the G-code line, X247.951560 Y11.817060 Z-1.000000 is directing the machine to move in a straight line to the coordinates, X247.951560, Y11.817060 and Z-1.000000. The last set of the code, F400.000000, explains the speed at which the tool will move to the coordinates, which is 400 mm/min. Units will not always be set to millimeters.  Machines can modify units for this command.

 

Common Commands

In addition, some of the more frequent G-code commands include G00, G01, G02, and G03.

G00 indicates rapid positioning. This will command the machine to move all axis simultaneously at maximum travel speed to a specified point. This is a non-cutting movement instead moves the tool to a specific position to begin cutting, layering, or printing.

G01 indicates linear interpolation. Like in the first example, this G-code will instruct the machine to move in a straight line at a set speed. The G01 is a fundamental command that is often executed in cutting material and extrusion material.

G02 is circular Interpolation clockwise. This command instructs the machine to move in a circular motion clockwise.

G03 command represents circular interpolation counterclockwise. Reverse of G02, his command instructs the machine to move in a circular motion counterclockwise.

These commands require a defined center of rotation. The starting point of a new command is the end point of the previous. Furthermore, the complexities of G-code can certainly intimidate any person. But what may seem like an infinite set of confusing combinations of letters and numbers is a string of logical instructions that deliver a high-performing function. Customers looking for machining services that produce perfect quality can depend on Autoline to provide just that.