Skip to content

G‐Code Reference

GhostTypes edited this page Feb 22, 2026 · 1 revision

G-Code Reference

This reference covers G-code commands supported via the TCP port 8899 across FlashForge printer families.

Supported G-Codes

Code Function Parameters Description
G1 Linear Move X, Y, Z, E, F Move to specified position
G28 Auto Home X, Y, Z (optional) Home specified axes
G90 Absolute Positioning None Use absolute coordinates
G91 Relative Positioning None Use relative coordinates
G92 Set Position X, Y, Z, E Reset position without moving

G1 - Linear Move

Moves the print head to the specified coordinates.

Command Format:

~G1 [X<pos>] [Y<pos>] [Z<pos>] [E<pos>] [F<feedrate>]
Parameter Type Unit Description
X float mm Target X position
Y float mm Target Y position
Z float mm Target Z position
E float mm Extruder position
F float mm/min Feedrate (movement speed)

Examples:

~G1 X10 Y10 Z0.3 F3000        (Move to position at 3000 mm/min)
~G1 E10 F1800                  (Extrude 10mm)
~G1 Z5 F600                    (Raise Z by 5mm)

E-Parameter Quirk

If a G1 command includes an E (extruder) parameter, the firmware automatically injects a G92 E0 command before the move.

Reason: Prevents extruder position accumulation errors during manual moves.

Impact: You do not need to manually reset E before a manual extrusion move.

Blocking Behavior

Motion commands (G1) are ignored if a print job is active. The firmware checks for an active BuildPrint instance and will not execute motion commands during printing.

G28 - Auto Home

Initiates the homing sequence for specified axes, moving the print head to the origin position.

Command Format:

~G28 [X] [Y] [Z]
Parameter Description
(none) Home all axes (X, Y, Z)
X Home X axis only
Y Home Y axis only
Z Home Z axis only
X Y Home X and Y axes

Examples:

~G28              (Home all axes)
~G28 X Y          (Home X and Y only)
~G28 Z            (Home Z only)

Homing Sequence

The typical homing sequence order:

  1. Z-axis homes first (moves down)
  2. X and Y home simultaneously (after Z completes)

Response:

CMD G28 Received.
ok

G90 - Absolute Positioning

Sets all subsequent movements to use absolute coordinates.

Command: ~G90

Behavior: After this command, all positions specified in G1 commands are interpreted as absolute positions relative to the origin.

Example:

~G90
~G1 X10 Y10      (Move to position 10,10)
~G1 X20 Y20      (Move to position 20,20)

G91 - Relative Positioning

Sets all subsequent movements to use relative coordinates.

Command: ~G91

Behavior: After this command, all positions specified in G1 commands are interpreted as offsets from the current position.

Example:

~G91
~G1 X10 Y10      (Move 10mm in X, 10mm in Y from current position)
~G1 X5           (Move additional 5mm in X)

G92 - Set Position

Resets the coordinate system without moving the print head.

Command Format:

~G92 [X<pos>] [Y<pos>] [Z<pos>] [E<pos>]
Parameter Type Unit Description
X float mm Set current X position
Y float mm Set current Y position
Z float mm Set current Z position
E float mm Set current extruder position

Examples:

~G92 E0           (Reset extruder position to 0)
~G92 Z0           (Set current Z as origin)
~G92 X0 Y0 Z0     (Reset all axes to 0)

Common Use Cases:

  • Reset extruder position before a new extrusion sequence
  • Set the current position as a reference point
  • Adjust coordinate system after manual positioning

Coordinate System Notes

Build Volume

Build volume varies by printer model. Typical values:

Printer X Y Z
Adventurer 3 150 150 150
Adventurer 5M 220 220 220
AD5X 220 220 220

Use M115 to query actual build volume from the printer.

Position Query

Use M114 to query the current position:

~M114
Response:
CMD M114 Received.
X:110.050 Y:110.050 Z:200.000 A:0.000 B:0
ok
Field Description
X, Y, Z Current print head position
A Extruder A position (primary)
B Extruder B position (secondary, if present)

Movement Considerations

Feedrate

The F parameter sets movement speed in mm/min. Common values:

Movement Type Feedrate (mm/min)
Fast travel 3000-6000
Normal print 1500-3000
Slow/precise 300-1500

Safety Limits

  • Movement commands are blocked during active prints
  • Homing should be performed before absolute positioning moves
  • Always ensure the print head is clear of obstructions before large movements

Multiple Axes

When moving multiple axes simultaneously:

  • All axes arrive at their target positions at the same time
  • The feedrate applies to the combined movement vector
  • Individual axis speeds may be lower than the specified feedrate

Clone this wiki locally