G02 and G03 are G-code commands that instruct a CNC machine to move the tool along a circular arc. G02 is used for clockwise arcs, while G03 is used for counterclockwise arcs. These commands are useful for creating curved shapes and contours on a workpiece.
Usage Format
The general format for G02 and G03 commands is:
G02/G03 X__ Y__ Z__ I__ J__ K__ F__
where:
X
,Y
, andZ
are the coordinates of the end point of the arcI
,J
, andK
are the offsets of the center of the arc from the current pointF
is the feed rate
Note that:
- The
Z
andK
parameters are optional and only used for helical arcs (arcs that move along the Z-axis) - The
I
,J
, andK
parameters define the radius of the arc, not the center point - The arc must lie in a plane defined by two axes (XY, YZ, or ZX)
- The plane can be specified by a G17, G18, or G19 command before the arc command
- The direction of the arc (clockwise or counterclockwise) is determined by the sign of the
I
,J
, andK
parameters
Explanation
To understand how G02 and G03 commands work, let’s look at some examples of circular arcs in the XY plane. The following diagram shows the current point (P1), the end point (P2), the center point (C), and the radius (R) of an arc.
Y
^
|
| P2
| /)
| / )
| / ) R
|/ )
C (----+----> X
\ )
\ )
\ )
\)
P1
The I
and J
parameters are the offsets of the center point from the current point. They can be calculated as follows:
I = Xc - X1
J = Yc - Y1
where:
Xc
andYc
are the coordinates of the center pointX1
andY1
are the coordinates of the current point
The sign of the I
and J
parameters determines the direction of the arc. For example, if I
and J
are both positive, the arc will be clockwise. If I
and J
are both negative, the arc will be counterclockwise. If I
and J
have different signs, the arc will be either clockwise or counterclockwise depending on which parameter is larger in magnitude.
Example
Let’s say we want to move the tool from point P1 (10, 10) to point P2 (20, 20) along a clockwise arc with a radius of 10 units. The center point of the arc is C (10, 20). The G-code command for this arc is:
G02 X20 Y20 I0 J10 F100
where:
X20
andY20
are the coordinates of the end pointI0
andJ10
are the offsets of the center point from the current pointF100
is the feed rate
The tool will move along the arc as shown in the diagram below.
Y
^
|
| P2
| /)
| / )
| / ) 10
|/ )
C (----+----> X
\ )
\ )
\ )
\)
P1
10 10