G2 G-code

G-code icon

G2 means “move while activating the tool”, in a clockwise arc motion.

This command is equivalent to G1, except the motion is rotational instead of linear.

G2’s evil twin is G3, which is exactly the same, except it is counter-clockwise instead of clockwise.

Format

The command is used as such:

G2 X10 Y20 I30 J40 F100

Which means: move to X position 10, Y position 20, while maintaining a constant distance from the point of relative coordinates X 30 and Y 40, at a speed of 100 millimeters/minute.

Parameters

Parameter Usage Example
X Move to this position in the X axis G2 X10 I10
Y Move to this position in the Y axis G2 Y10 I10
Z Move to this position in the Z axis G2 Z10 I10
I The point in X space from the current X position to maintain a constant distance from G2 X10 I10
J The point in Y space from the current Y position to maintain a constant distance from G2 Y10 J10
K The point in Z space from the current Z position to maintain a constant distance from G2 Z10 K10
R Arc radius in absolute distance. Incompatible with I/J/K parameters. G2 X10 Y10 R5
F Move at this speed in millimeters/minute (No F parameter results in using last G1 feedrate) G2 X10 I10 F100
Parameter Usage Example
X Move to this position in the X axis G2 X10 I10
Y Move to this position in the Y axis G2 Y10 I10
Z Move to this position in the Z axis G2 Z10 I10
I The point in X space from the current X position to maintain a constant distance from G2 X10 I10
J The point in Y space from the current Y position to maintain a constant distance from G2 Y10 J10
K The point in Z space from the current Z position to maintain a constant distance from G2 Z10 K10
F Move at this speed in millimeters/minute (No F parameter results in using last G1 feedrate) G2 X10 I10 F100

Version-Specific Information

V1 supports both arc modes:

  • I/J/K mode: Uses the I, J, K parameters to define the arc center point relative to the current position
  • R mode: Uses a single R parameter to specify the arc radius (incompatible with I/J/K mode)

The R mode provides a convenient way to specify arcs when you know the radius but not the exact center point.

V2 supports only I/J/K mode:

V2 firmware removes support for R-mode arcs (radius mode). All arcs must be specified using I/J/K parameters that define the arc center point.

If you have V1 G-code using R mode (e.g., G2 X10 Y0 R5), you must convert it to I/J/K format for use with V2:

; V1 format (R mode) - does NOT work in V2
G2 X10 Y0 R5

; V2 format (I/J/K mode) - use this instead
G2 X10 Y0 I5

V2 will generate an error if R mode is detected: “Radius mode not supported by G2 or G3”

Arc Segmentation and Configuration

Arc motion in both V1 and V2 is broken into straight-line segments for execution. The firmware automatically determines segment length based on the arc radius and allowable deviation to maintain smooth motion.

Arc segmentation in V1 uses automatic calculation based on the configured arc accuracy parameters. The motion planner divides the arc into appropriate segments.

In V2, arc segmentation is configurable through:

  • mm_max_arc_error: Maximum allowable deviation (in millimeters) from the ideal arc. Default is 0.1mm. When set to 0, the firmware uses arc_segments_per_second instead.
  • arc_segments_per_second: When mm_max_arc_error is 0, this controls how many arc segments per second are generated. Higher values produce smoother arcs but slower execution.

Adjust these settings based on your machine’s speed and required precision.

Further Reading

These resources are used as references for Gcode:

See also: G3 - Counter-Clockwise Arc

This is a wiki! If you'd like to improve this page, you can edit it on GitHub.