What is a G01 Code? [With Lots of Examples]

The information below is meant for beginners. If you are experienced with CNC programming, then you probably already know this stuff and much more. If you are new to CNC programming, this is the place for you.

Please note that some of the topics below could include more information on the subject. However, in the interest of keeping things simple for those just starting out, they have been left out of this G code guide.

Ready to learn? Let’s go.

Code

G01

Name

Linear movement

Type

Modal - stays on until changed

Description

Straight line movement at a specified feed rate

A G01 code is a linear movement CNC G code. It is used to move the CNC table and/or spindle.

When to use a G01 code?

G01 codes will usually be in the lines of the program that are used to cut the part. The G01 code allows the programmer to specify where the tool will move to. F and S codes are used together with a G01 code to specify the feed rate and spindle speed.

The location movement, speeds, and feeds are the main factors that influence your cut.

What to think about when using a G01 code?

Units

First, make sure you know what units you are working in. Moving 10 inches instead of 10 millimeters is a big difference. A G20 (inches) or G21 (mm) code should identify the units you are working in before your G01 code.

Absolute vs incremental mode

The second thing to look for is whether you are working in absolute (G90) or incremental (G91) coordinates. The most recent G90 or G91 code in the program will determine which mode you are in.

Absolute coordinates will move from a set zero location such as your machines home location or a specified location on your part.

Incremental coordinates will move relative to your current position. See our posts on G90 and G91 codes to learn more about the differences between absolute and incremental coordinates.

Start and stop locations

Lastly, make sure you understand where you are currently position wise (X, Y & Z location), where you will be moving to and if there is anything in between the two locations.

The G01 code will move the machine in a straight line to your new location. You don’t want anything in the way or to miscalculate your stop point. Clamps or vises can be easy to forget about and run into. Crashing your machine is never a good time.

6 G01 code examples and descriptions of what they do

For the examples below, we will assume your machine is in absolute mode (G90). If you are working in incremental mode (G91), the resulting movements will be different. Check out our guides to G90 and G91 G codes to understand the difference between the two movement types.

Example #1

N015 G01 X7.0 Y5.0 Z3.0

This is line number 15 of the program.

G01 sets the movement mode as linear (straight line).

X7.0 Y5.0 Z3.0 is the location the machine will move to. If the Z location of the machine was already at 3.0, then the Z axis will not move. This is the same for each axis.

Example #2

N070 G01 X6.0 Y2.0

This is line number 70 of the program.

G01 sets the movement mode as linear (straight line).

X6.0 Y2.0 is the location that the machine will move to. The Z axis of the machine will not change and remain at the location it was previously set at.

Example #3

N120 G01 Y2.5 Z1.0

This is line number 120 of the program.

G01 sets the movement mode as linear (straight line).

Y2.5 Z1.0 is the location that the machine will move to. The X axis of the machine will not change and remain at the location it was previously set at.

Example #4

N020 G00 Y4.0

This is line number 20 of the program.

G01 sets the movement mode as linear (straight line).

Y4.0 is the location that the machine will move to. The X and Z axes of the machine will not change and remain at the location they were previously set at.

Example #5

N100 G01

This is line number 100 of the program.

G01 sets the movement mode as linear (straight line).

There is no location specified on this line. The machine will not move based on this code line.

Example #6

N256 G01 X8.0

This is line number 256 of the program.

G01 sets the movement mode as linear (straight line).

X8.0 is the location that the machine will move to. The Y and Z axes of the machine will not change and remain at the location they were previously set at.

CNC codes that are similar to G01

Note that all the movement codes listed below are modal. This means they will stay in the movement mode identified by the code until switched to a different mode.

Leave a Comment