G12.1 Code | Polar Coordinate Interpolation

G12.1 CNC Code

G12.1 is a CNC code and used to perform polar coordinate interpolation in CNC Lathe machines.

Polar coordinate interpolation is a function that exercises contour control in converting a command programmed in a Cartesian coordinate system to the movement of a linear axis (movement of a tool) and the movement of a rotary axis (rotation of a workpiece). This function is useful in cutting a front surface and grinding a cam shaft for turning.

Figure for Interpolation between C and X axis

On a CNC lathe machines, that is equipped with a rotary axis (C-axis), interpolation between the linear axis “X” and the rotary axis “C” is possible by use of the G12.1 code. This function simplifies programming of shapes to be machined on the front face of a part, such as the rectangular shape with rounded corners as shown here. Machining of such shapes is accomplished by use of an end mill that is attached to a “Z axis live tool attachment” with the end mill pointing toward the front face of the part.

Coordinate Systems

G12.1-function is done on the X-C coordinate system plane usually, for other axes also possible. In this X-C coordinate system plane; the C–axis is regarded as a linear axis instead of a virtual rotary axis. Programming is done similar to the way it is done on a basic X-Y plane. Linear or circular interpolation can be done. Cartesian coordinates are used for defining either the part shape geometry or the tool path geometry. In the G12.1 mode the control converts cartesian coordinates to polar coordinates, automatically.

G12.1 Code Format

G12.1; Starts polar coordinate interpolation mode
Specify linear or circular interpolation using coordinates in a Cartesian coordinate system consisting of a linear axis and rotary axis (hypothetical axis).

G13.1; Polar coordinate interpolation mode is cancelled
Specify G12.1 and G13.1 in Separate Blocks.
G112 and G113 can be used in place of G12.1 and G13.1, respectively in Fanuc Controller.

Shifting the coordinate system in G12.1 Code

In the polar coordinate interpolation mode, the workpiece coordinate system can be shifted. The current position display function shows the position viewed from the workpiece coordinate system before the shift. The function to shift the coordinate system is enabled when bit 2 (PLS) of parameter No. 5450 (Fanuc controller) is specified accordingly.

The shift can be specified in this mode, by specifying the position of the center of the rotary axis C (A, B) in the X-C (Y-A, Z-B) interpolation plane with reference to the origin of the workpiece coordinate system, in the following format.

G12.1 X_ C_ ; (Interpolation for the X-axis and C-axis)
G12.1 Y_ A_ ; (Interpolation for the Y-axis and A-axis)
G12.1 Z_ B_ ; (Interpolation for the Z-axis and B-axis)

Workpiece coordinate system in Polar Coordinate Interpolation

G12.1 Polar Coordinate Interpolation Examples

Example - 1

G12.1 Code Example for CNC Lathe - 1

The X-axis is by diameter programming; the C-axis is by radius programming.

O0001 ;
N010 T0101 ;
N0100 G90 G00 X120.0 C0 Z_ ;
N0200 G12.1 ;
N0201 G42 G01 X40.0 F_ ;
N0202 C10.0 ;
N0203 G03 X20.0 C20.0 R10.0 ;
N0204 G01 X-40.0 ;
N0205 C-10.0 ;
N0206 G03 X-20.0 C-20.0 I10.0 J0 ;
N0207 G01 X40.0 ;
N0208 C0 ;
N0209 G40 X120.0 ;
N0210 G13.1 ;
N0300 Z_ ;
N0400 X_ C_ ;
N0900 M30 ;

Example - 2

G12.1 example for CNC Lathe

G94 ;
T0101 ;
G00 X120.0 C0 ; Positioning at the cutting start point
G12.1 ; Polar coordinate interpolation mode ON
G01 G42 X40.0 F100.0 ;
G03 X0 C40.0 I-20.0 ;
G01 X-25.0 ;
G03 X-40.0 C25.0 K-15.0 ;
G01 C0 ;
G03 X20.0 I20.0 ;
G01 G40 X120.0 ;
G13.1 ; Polar coordinate interpolation mode OFF
M30 ;

Things to Know

G codes which can be specified in the polar coordinate interpolation mode

G01 Linear interpolation
G02 G03 Circular interpolation
G04 Dwell
G40, G41, G42 Tool nose radius compensation (Polar coordinate interpolation is applied to the path after tool nose radius compensation.)
G65, G66, G67 Custom macro command
G90, G91 Absolute programming, incremental programming
(For G code system B or C)
G98, G99 Feed per minute, feed per revolution

Circular interpolation in the polar coordinate plane

The addresses for specifying the radius of an arc for circular interpolation (G02 or G03) in the polar coordinate interpolation plane depend on the first axis in the plane (linear axis).

I and J in the Xp-Yp plane when the linear axis is the X-axis or an axis parallel to the X-axis.
J and K in the Yp-Zp plane when the linear axis is the Y-axis or an axis parallel to the Y-axis.
K and I in the Zp-Xp plane when the linear axis is the Z-axis or an axis parallel to the Z-axis.

The radius of an arc can be specified also with an R command.

Note: The parallel axes U, V, and W can be used in the G code system B or C.

Positioning command

G00 cannot be used in G12.1-mode. Positioning is done in G1- mode, using a feed rate of around 30” to 60” per minute, depending on application.

Incremental axis move

U value can be used for incremental move command along the X axis. U is horizontal distance from a current point to the next point on diameter.

H value can be used for incremental move command along the C axis. H is vertical distance from a current point to the next point.

For example; G01 X__C__F__ (absolute) or: G01 U__H__ F__ (incremental)

Tool Offsets

In polar coordinate interpolation the cutter compensation function should always be used, regardless of programming method. Size control on a machined shape is done by use of the cutter compensation function, not by changing the X-offset data.

G40 must be active at the time when entering the G12.1 polar coordinate interpolation mode.
G41 or G42 must be commanded after the G12.1 polar coordinate interpolation code.
G40 should be commanded before canceling the G12.1 polar coordinate interpolation mode.