G2, G3: Circular Interpolation

Last modified by writer on 2023/06/14 14:28

The arc of a circle or spiral is set using the commands G2 (clockwise rotation) or G3 (counterclockwise rotation) with the current feedrate. The direction of rotation is determined relative to the positive direction of the axis around which the rotation occurs. The axis of the circle or spiral must be parallel to the axis X, Y or Z of the coordinate system. This axis (or, respectively, a plane perpendicular to the axis) is selected using the commands G17 (Z axis, XY plane), G18 (Y axis, XZ plane) или G19 (X axis, YZ plane).

To specify a spiral, specify the parameter of the axis perpendicular to the plane of interpolation. For example, for the G17 plane, specify the Z value. This will cause the Z axis to move to the specified value during circular interpolation in the XY plane.

To specify an arc that describes more than one full revolution, use parameter P, which is defined as the number of full revolutions plus the specified arc. Parameter P must be an integer. If parameter P is not specified, the result is the same as when setting P1: only one full or partial revolution will be performed. For example, if an arc of 180 degrees is specified with parameter P2, the resulting displacement will be 1 ½ turns.

If the G-code line defines an arc and contains the movement of the rotary axis, the rotary axis moves at a constant speed so that the rotation begins and ends simultaneously with the movement along XYZ. Such commands are rarely used.

The center of the arc is set in absolute or relative coordinates (set by commands G90.1 and G91.1, respectively).

Two formats are acceptable for defining an arc: specifying a center and specifying a radius.

It is an error if:
  • feed rate not set;
  • parameter P is not an integer.
Arc format with center

G2 or G3 axes offsets

The format of the arc with the center is more accurate than the format with the radius and is preferred for use.

To specify the arc, the end point of the arc and the offset of the center of the arc relative to the current position are used. The end point of the arc may coincide with the current position. In the incremental center positioning mode (used by default), the center coordinates are set relative to the beginning of the arc. In the absolute center positioning mode, the center coordinates are set relative to the current origin.

XY-plane (G17)
G2 or G3 <X- Y- Z- I- J- P->

XZ-plane (G18)
G2 or G3 <X- Z- Y- I- K- P->

YZ-plane (G19)
G2 or G3 <Y- Z- X- J- K- P→

It is an error if:
  • feed rate not set;
  • center offsets not set;
  • the arc is projected onto the current plane of interpolation, the distance from the current position to the center differs from the distance from the end point to the center by more than 0.5 mm or (0.005 mm and 0.1% of the radius).
Arc construction example:
G0 X0 Y0
G2 X1 Y1 I1 F10 (arc clockwise in the XY plane)
Arc construction example

Arc construction example

An example of a spiral construction:
G0 X0 Y0 Z0
G17 G2 X10 Y16 I3 J4 Z-1 (spiral with Z movement)
An example of using the parameter P:
G0 X0 Y0 Z0
G2 X0 Y1 Z-1 I1 J0.5 P2 F25

In the format of the arc with the center, the radius of the arc is not indicated, but it can be easily calculated as the distance between the center of the arc and the start or end point.

Arc format with radius

G2 or G3 axes R- <P->

To specify the arc, the endpoint of the arc and the radius of the arc are used. Command G2 axes R- where R is the radius of the arc. A positive value of the radius indicates that the arc rotates less than 180 degrees, negative - more than 180 degrees.

It is not recommended to specify arcs in a format with a radius if they are close to a full circle or a semicircle, since in this case a small change in the position of the end point leads to a much larger change in the position of the center of the arc.

It is an error if:
  • both axis parameters are not specified for the selected interpolation plane;
  • the end point of the arc is the same as the start point.
Arc construction example:
G17 G2 X10 Y15 R20 Z5 (arc format with radius)