# Fanuc CNC Lathe | G12.1 and G13.1 Codes | Polar Coordinate Interpolation

769 views

edited

In this article, we describe how to use polar coordinate function on CNC Lathe machines which is called G12.1 and G13.1 G code.

## Polar Coordinate Introduction

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.

 G12.1; Starts polar coordinate interpolation mode (enables polar coordinate interpolation). 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 (for not performing polar coordinate interpolation). Specify G12.1 and G13.1 in Separate Blocks. G112 and G113 can be used in place of G12.1 and G13.1, respectively.

## Polar Coordinate Mode On (G12.1)

The axes of polar coordinate interpolation (linear axis and rotary axis) should be specified in advance, with corresponding parameters. Specifying G12.1 places the system in the polar coordinate interpolation mode, and selects a plane (called the polar coordinate interpolation plane) formed by one linear axis and a hypothetical axis intersecting the linear axis at right angles. The linear axis is called the first axis of the plane, and the hypothetical axis is called the second axis of the plane. Polar coordinate interpolation is performed in this plane.

In the polar coordinate interpolation mode, both linear interpolation and circular interpolation can be specified by absolute or incremental programming.

Tool nose radius compensation can also be performed. The polar coordinate interpolation is performed for a path obtained after tool nose radius compensation.

The tangential velocity in the polar coordinate interpolation plane (Cartesian coordinate system) is specified as the feedrate, using F.

## Polar Coordinate Mode Off (G13.1)

Specifying G13.1 cancels the polar coordinate interpolation mode.

## Polar Coordinate Details

### Polar Coordinate Interpolation Plane

G12.1 starts the polar coordinate interpolation mode and selects a polar coordinate interpolation plane (Fig. 3.1 (a)). Polar coordinate interpolation is performed on this plane.

Fig. 3.1 (a) Polar coordinate interpolation plane

When the power is turned on or the system is reset, polar coordinate interpolation is canceled (G13.1). The linear and rotation axes for polar coordinate interpolation must be set in parameters Nos. 5460 and 5461 beforehand.

Caution: The plane used before G12.1 is specified (plane selected by G17, G18, or G19) is canceled. It is restored when G13.1 (canceling polar coordinate interpolation) is specified.
When the system is reset, polar coordinate interpolation is canceled and the plane specified by G17, G18, or G19 is used.

### Distance moved and feedrate for polar coordinate interpolation

• The unit for coordinates on the hypothetical axis is the same as the unit for the linear axis (mm/inch). In the polar coordinate interpolation mode, program commands are specified with Cartesian coordinates on the polar coordinate interpolation plane. The axis address for the rotary axis is used as the axis address for the second axis (hypothetical axis) in the plane. Whether a diameter or radius is specified for the first axis in the plane is the same as for the rotary axis regardless of the specification for the first axis in the plane.

The hypothetical axis is at coordinate 0 immediately after G12.1 is specified. Polar interpolation is started assuming the rotation angle of 0 for the position of the tool when G12.1 is specified.

Example

When a value on the X-axis (linear axis) is input in millimeters

 G12.1; G01 X10. F1000.; A 10-mm movement is made on the Cartesian coordinate system. C20. ; A 20-mm movement is made on the Cartesian coordinate system. G13.1;

When a value on the X-axis (linear axis) is input in inches

 G12.1; G01 X10. F1000. ; A 10-inch movement is made on the Cartesian coordinate system. C20. ; A 20-inch movement is made on the Cartesian coordinate system. G13.1;
• The unit for the feedrate is mm/min or inch/min.
Specify the feedrate as a speed (relative speed between the workpiece and tool) tangential to the polar coordinate interpolation plane (Cartesian coordinate system) using F.

### 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.

Movement along axes not in the polar coordinate interpolation plane in the polar coordinate interpolation mode

The tool moves along such axes normally, independent of polar coordinate interpolation.

Current position display in the polar coordinate interpolation mode

Actual coordinates are displayed. However, the remaining distance to move in a block is displayed based on the coordinates in the polar coordinate interpolation plane (Cartesian coordinates).

Coordinate system for the polar coordinate interpolation

Basically, before G12.1 is specified, a local coordinate system (or workpiece coordinate system) where the center of the rotary axis is the origin of the coordinate system must be set.

In the G12.1 mode, the coordinate system must not be changed (G50, G52, G53, relative coordinate reset, G54 through G59, etc.).

Compensation in the direction of the hypothetical axis in polar coordinate interpolation

If the first axis of the plane has an error from the center of the rotary axis in the hypothetical axis direction, in other words, if the rotary axis center is not on the X-axis, the hypothetical axis direction compensation function in the polar coordinate interpolation mode is used. With the function, the error is considered in polar coordinate interpolation. The amount of error is specified in parameter No. 5464.

Shifting the coordinate system in polar coordinate interpolation

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 is specified accordingly.

The shift can be specified in the polar coordinate interpolation 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_ ; (Polar coordinate interpolation for the X-axis and C-axis)
G12.1 Y_ A_ ; (Polar coordinate interpolation for the Y-axis and A-axis)
G12.1 Z_ B_ ; (Polar coordinate interpolation for the Z-axis and B-axis)

## G12.1 Code Examples

### G12.1 CNC Program Example – 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 ;

Need to more?

In this article, we described how to use polar coordinate function on CNC Lathe machines which is called G12.1 and G13.1 G codes with all details and examples. For more details;