G-code academy

G02, G03 - Circular interpolation

Codes G02 and G03 are designed to perform circular interpolation. G02 command is used to move in an arc clockwise, and G03 - counterclockwise.

The direction of movement is determined when we look at the tool from the spindle side, in the negative direction of the Z axis. As with linear interpolation, in the circular interpolation block, you must specify the feedrate F.

There are two ways to form a circular interpolation frame:
- setting the center of the circle using I, J, K;
- setting the radius of the circle with R.

Arc with I, J, K
For a complete description of the arc, it is not enough to specify only the coordinates of its end point. You must also specify the coordinates of the center.

I, J, K are used to determine the center of the arc


Using I, J, and K, you specify the relative (incremental) distances from the starting point of the arc to its center.

You must specify a positive value for I and a negative value for J



You must specify a positive value for I and a positive value for J



Arc with R
A simpler way to specify the center of the arc is based on applying the address R (radius). To unambiguously determine the shape of the arc, you must specify the corresponding sign in front of the numerical value of the radius R. For an arc that is greater than 180 °, the value of R will be negative. For an arc that is less than 180 °, the R value will be positive.

Since the arc is less than 180 ° (its center is located outside the chord), then R will have a positive value



Since the arc is greater than 180 ° (its center is located inside the chord), then R will have a negative value


Using G02 and G03
Let's see how circular interpolation works, using an example. The following fragment of the control program moves the tool along an arc with a radius of 8 mm from point A (0; 0) to point B (8; 8) with a working feed speed of 80 mm / min.

G01X0Y0
G02 X8.0 Y8.0 I8.0 J0.0 F80

Since the center of the arc is at a distance of 8 mm along the X axis and 0 mm along the Y axis relative to the starting point A, then I will be 8.0, and J is 0. The resulting arc is only a quarter of the full circle. Let's try to describe the whole circle gradually.

Moving along an arc with R = 8 from point A (0; 0) to point B (8; 8)


The next frame moves the tool from point B (B1) to point B2. Since the feedrate does not change, there is no need to re-specify the data F-word.
Since the center of the arc is at a distance of 0 mm along the X axis and 8 mm along the Y axis relative to point B, then I will be 0, and J will be -8. Thus, we were able to create a displacement along an arc from point A to point B2 using two frames.
Currently, most CNC systems allow you to perform an operation to describe the full circle in two or even one frame. Therefore, the movement from point A to point C can be written as follows:

G01X0Y0
G02 X8.0 Y8.0 I8.0 J0.0 F80 G02 X16.0 Y0.0 I-8.0 J0.0


Modern CNC systems allow the description of such an arc in one block


G01X-8Y0
G02 X-8.0 Y0.0 I8.0 J0.0

Full circle description in one frame is also possible.



Spiral.
If the XY plane (G17) is activated and the Z word is programmed in the circular interpolation block, then a spiral forms in the XY plane. The direction of the arc or spiral in the XY plane can be determined visually.

An example of a spiral:

G01F800
G01X0Y0Z0
G02X0Y0Z-10I38J38
G02Z-20I38J38
G02Z-30I38J38
G02Z-40I38J38
G02Z-50I38J38
G02Z-60I38J38
G02Z-70I38J38
G02Z-80I38J38
G01X10Y10



An example of a finished program:

G00X0Y0 ;zero position

M3 S6000 ;turn on the spindle at a speed of 6000 rpm
G00Z5 ;raise the cutter to a safe position
G01X14.1421Y-14.1421 ;moving a tool to a point
G01Z-0.5F700 ;moving a tool to a point at a speed of 700
G02X14.1421Y14.1421R-20 ;using the G02 command using R
G01X40.0Y-14.1421 ;moving a tool to a point
G03X40.0Y14.1421R-20 ;using the G02 command using R
G01X14.1421Y-14.1421 ;move the tool to a point
G00Z5 ;raising the cutter along the axis by z by 5
M5 ;spindle shutdown
G00X0Y0 ;move to zero position