smoothieware-website-v1

G0 G-code

G0 means “move without activating the tool”.

On CNC mills, it is used to go to a new area without cutting, it is also called a “rapid” move.

On laser cutters, it is used the same way, and the laser is automatically turned off during the move.

On 3D printers, it is also called a “travel” move.

While traditionally on CNC mills G0 is supposed to be an “un-coordinated” move, on Smoothie it is coordinated anyway.

G0’s evil twin is G1, which means “move while using the tool”.

Format

The command is used as such:

G0 X10 Y20 F30

Which means: move (without cutting) to X position 10, Y position 20, at a speed of 30 millimeters/minute.

Parameters

Parameter Usage Example
X Move to this position in the X axis G0 X10
Y Move to this position in the Y axis G0 Y10
Z Move to this position in the Z axis G0 Z10
A Move to this position in the A axis G0 A10
B Move to this position in the B axis G0 B10
C Move to this position in the C axis G0 C10
F Move at this speed in millimeters/minute G0 Z10 F100

Feedrate

The F parameter is modal. The speed is remembered and each subsequent command uses it.

This means if you do:

G0 X10 F100
G0 X20
G0 X30 F200
G0 X40

The first two moves will happen at 100 mm/minute, and the last two moves will happen at 200mm/minute.

[!SUCCESS] Independent feedrates Note that both G0 and G1 have their own modal feedrates, and setting one doesn’t influence the other.

This means if you do:

G0 X10 F100
G1 X20 F200
G0 X30

The third move will actually move at 100 mm/minute as that is the latest feedrate set for G0 moves.

Default feedrate

If you have just started your Smoothieboard and have never sent an F parameter, your G0 moves will move at the default “seek” feedrate.

This is set in the configuration file by setting the default_seek_rate config option.

The G0 command is modal, if a line doesn’t contain any gcode, it is assumed to be a G0 or a G1 command depending on the latest used.

This means if you do:

G0 X10
 X20
 Y10

It is the same as doing:

G0 X10
G0 X20
G0 Y10

Note the space character before each modal line, without that space, Smoothie will not know this is a modal command.

Absolute and relative motion

There are two ways to specify positions: absolutely or relatively.

Smoothie is in absolute mode by default.

You enter absolute mode by sending the G90 Gcode, and you enter the relative mode by sending the G91 Gcode.

In absolute mode, all positions passed to G0 are relative to the 0 position for the current work coordinate.

In relative mode, all positions passed to G0 are relative to the current position.

This means if you do:

G90
G0 X10
G0 X20

Smoothie will move to the X position 10, then move to the X position 20, relative to the origin.

But if you do:

G91
G0 X10
G0 X20

Smoothie will move 10 millimeters relative to the current position, then move 20 millimeters further away from that new position (moving 30 millimeters total).

Further reading

These resources are used as references for Gcode: