G12/G13 – Circle Interpolation

Author:

G12 and G13 are G-codes that instruct a CNC machine to perform a circular interpolation in the XY-plane. Circular interpolation is the process of moving a tool along a circular arc with a constant radius and a specified direction. G12 and G13 are useful for machining circular features such as holes, slots, pockets, and contours.

Usage Format

The general format for G12 and G13 is as follows:

G12/G13 X_ Y_ I_ J_ F_

where:

  • G12 indicates a clockwise circular interpolation
  • G13 indicates a counterclockwise circular interpolation
  • X_ and Y_ are the coordinates of the end point of the arc
  • I_ and J_ are the offsets of the center point of the arc from the current point
  • F_ is the feed rate of the tool

Explanation

To perform a circular interpolation, the CNC machine needs to know three things: the start point, the end point, and the center point of the arc. The start point is the current position of the tool before the G12 or G13 command. The end point is specified by the X and Y parameters. The center point is calculated by adding the I and J offsets to the current point. The direction of the arc is determined by the G12 or G13 code. The feed rate is the speed at which the tool moves along the arc.

The following text diagram illustrates the parameters of a circular interpolation:

  Y
  ^
  |
  |     (Xe, Ye)   End point
  |       /)
  |      / )
  |     /  ) R    Radius
  |    /   )
  |   /    )
  |  /     )
  | /      )
  |/       )
(Xc, Yc)   )      Center point
  +-------+------> X
(Xs, Ys)          Start point

The center point (Xc, Yc) is calculated by:

Xc = Xs + I

Yc = Ys + J

The radius R is calculated by:

R = sqrt(I^2 + J^2)

Example

Suppose we want to machine a circular pocket with a diameter of 50 mm and a depth of 10 mm. We can use the following G-code program:

G90 G21 ; Set absolute mode and metric units
G00 Z5 ; Rapid move to clearance plane
G00 X0 Y0 ; Rapid move to center of pocket
G01 Z-5 F100 ; Linear move to first cut depth
G13 X25 Y0 I0 J-25 F200 ; CCW circular interpolation to create pocket
G01 Z-10 F100 ; Linear move to final cut depth
G13 X25 Y0 I0 J-25 F200 ; CCW circular interpolation to create pocket
G00 Z5 ; Rapid move to clearance plane
G00 X0 Y0 ; Rapid move to center of pocket
M30 ; End of program

This program will produce a pocket like this:

  Y
  ^
  |
  |     +-----+
  |    /       \
  |   /         \
  |  /           \
  | /             \
  |/               \
  +-----------------+----> X
  |                 |
  |                 |
  |                 |
  |                 |
  |                 |
  +-----------------+

Leave a Reply

Your email address will not be published. Required fields are marked *