# G02 G-Code Command

## G02 G-Code Command

G02 is a G-code command used in CNC (Computer Numerical Control) machining to specify a clockwise circular motion. It is used to create circular arcs or partial circles in a machining program. The G02 command requires the programmer to specify the center point of the arc, the endpoint of the arc, and the radius of the arc. The command is used in conjunction with other G-codes to create complex shapes and patterns in a CNC machining process.

### How G02 G-Code Command is used

Here’s an example of G02 being used in a G-code program with comments in brackets and a spindle on command for 2000 rpm.

``````G00 X0 Y0 Z0   (Move to starting point)
M03 S2000      (Turn on spindle at 2000 RPM)
G02 X10 Y10 I5 J5   (Create a clockwise arc from current position to X10, Y10 with a radius of 5 units)
G01 X20 Y0      (Move in a straight line to X20, Y0)
M05    ``````

In this example, the program starts by moving the tool to the starting point at X0, Y0, and Z0. The M03 command turns on the spindle at a speed of 2000 RPM. The G02 command creates a clockwise arc from the current position to X10, Y10 with a radius of 5 units, using the I and J parameters to specify the center point of the arc. The G01 command then moves the tool in a straight line to X20, Y0. Finally, the M05 command turns off the spindle.

Here’s an example of G02 being used in a G-code program to produce a rectangle 50mm long, 30mm wide, with all the corners having a 5mm radius:

``````G00 X0 Y0 Z0    (Move to starting point)
M03 S2000       (Turn on spindle at 2000 RPM)
G02 X-50 Y0 R5   (Create a clockwise arc from current position to X50, Y0 with a radius of 5 units)
G01 X-45 Y0      (Move in a straight line to X45, Y0)
G02 X-50 Y5 R5   (Create a clockwise arc from current position to X-50, Y5 with a radius of 5 units)
G01 X-50 Y25     (Move in a straight line to X50, Y25)
G02 X-45 Y30 R5  (Create a clockwise arc from current position to X-45, Y30 with a radius of 5 units)
G01 X-5 Y30      (Move in a straight line to X-5, Y30)
G02 X0 Y25 R5   (Create a clockwise arc from current position to X0, Y25 with a radius of 5 units)
G01 X0 Y5       (Move in a straight line to X0, Y5)
G02 X-5 Y0 R5    (Create a clockwise arc from current position to X-5, Y0 with a radius of 5 units)
G01 X-45 Y0      (Move in a straight line to X-50, Y0)
M05             (Turn off spindle)``````

In this example, the program starts by moving the tool to the starting point at X0, Y0, and Z0. The M03 command turns on the spindle at a speed of 2000 RPM. The G02 command creates a clockwise arc from the current position to X-50, Y0 with a radius of 5 units, using the R parameter to specify the radius of the arc. The program then moves in a straight line to X-45, Y0 using the G01 command. The G02 command is used again to create arcs with a radius of 5 units at each corner of the rectangle, and the G01 command is used to move in straight lines between the corners. Finally, the M05 command turns off the spindle.