smoothieware-website-v1

G1 G-code

G1 means “move while activating the tool”.

On CNC mills, this is used to move while cutting, it is also called a “linear” move.

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

On 3D printers, it is also called an “extrusion” move.

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

Format

The command is used as such:

G1 X10 Y20 F30

Which means: move 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 G1 X10
Y Move to this position in the Y axis G1 Y10
Z Move to this position in the Z axis G1 Z10
A Move to this position in the A axis G1 A10
B Move to this position in the B axis G1 B10
C Move to this position in the C axis G1 C10
E Move to this position in the E (extruder) axis G1 E10
F Move at this speed in millimeters/minute G1 Z10 F100
S Laser power, S1 is 100%, S0 is 0% G1 X10 S0.5

[!WARNING] Extruder moves and scientific notation

If you write this Gcode:

G1X100E100

You want Smoothie to interpret it as:

G1: move...
X10: ... by 10mm in the X direction...
E10: ... while also feeding the extruder 10mm of extrusion

However, Smoothie is going to interpret this as:

G1: move...
X10E10: ... in the X direction by 10E10, which is also 10 to the power of 10, or 10000000000.

The lesson here is: use spaces.

Feedrate

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

This means if you do:

G1 X10 F100
G1 X20
G1 X30 F200
G1 X40

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

[!TIP] 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 G1 moves will move at the default “feed” feedrate.

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

The G1 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:

G1 X10
 X20
 Y10

It is the same as doing:

G1 X10
G1 X20
G1 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 G1 are relative to the 0 position for the current work coordinate.

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

This means if you do:

G90
G1 X10
G1 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
G1 X10
G1 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: