CNC Milling | G15 and G16 Codes | Polar Coordinate System

Polar Coordinate Introduction

So far, all mathematical calculations relating to the arc or bolt circle pattern of holes have been using lengthy trigonometric formulas to calculate each coordinate. This seems to be a slow practice for a modern CNC system with a very advanced computer. Indeed, there is a special programming method available (usually as a control option) that takes away all tedious calculations from an arc or bolt circle pattern - it is called the polar coordinate system.

G15 and G16 Codes Format

There are two polar coordinate functions available, always recommended to be written as a separate block:

G15 : Polar coordinate system cancel OFF
G16 : Polar coordinate system ON

Program input values for bolt hole or arc patterns may be programmed with the polar coordinate system commands. Check first options of the control before using this method. Programming format is similar to that of programming fixed cycles. In fact, the format is identical - for example:

N… G9… G8… X… Y… R… Z… F…

Two factors distinguish a standard fixed cycle from the same cycle used in polar coordinate mode.

The first factor is the initial command G that precedes the cycle - no special G-code is required for a standard cycle. For any cycle programmed in polar coordinate system mode, the preparatory command G16 must be issued to activate polar mode (ON mode). When polar coordinate mode is completed and no longer required in the program, command G15 must be used to terminate it (OFF mode). Both commands must be in a separate block:

N… G9… G8… X… Y… R… Z… F…
N… …
N… …

The second factor is meaning of the X and Y words. In a standard fixed cycle, XY words define the hole position in rectangular coordinates, typically as an absolute location. In polar mode and G17 in effect (XY plane), both words take on a totally different meaning - specifying a radius and an angle:

  • X-word becomes radius of the bolt circle
  • Y-word becomes angle of the hole, measured from 0 degree

Figure 27-12 illustrates all three basic input requirements for a polar coordinate system.

Figure 27-12
Three basic characteristics of polar coordinates

In addition to the X and Y data, polar coordinates also require the center of rotation (pivot point). This is the last point programmed before G16 command.

G15 and G16 Program Examples

Polar Coordinate Example - 1

CNC Milling - G16 Polar Coordinate Example

With the polar coordinates control option, final program can be much simplified - O2710:

N1 G20
N2 G17 G40 G80
N3 G90 G54 G00 X1.5 Y1.0 S900 M03 (PIVOT POINT)
N4 G43 Z1.0 H01 M08
N6 G99 G81 X2.5 Y20.0 R0.1 Z-0.163 F3.0
N7 X2.5 Y40.0
N8 X2.5 Y60.0
N9 X2.5 Y80.0
N11 G80 M09
N12 G91 G28 Z0 M5
N13 G28 X0 Y0
N14 M30

Polar Coordinate Example - 2

In the next program O2711, holes are equally spaced on bolt circle circumference. Dimensions in Figure 27-13 are applied to the polar coordinate programming method.

Figure 27-13
Polar coordinate system applied to bolt hole circle - program O2711

N1 G20
N2 G17 G40 G80
N3 G90 G54 G00 X0 Y0 S900 M03 (PIVOT POINT)
N4 G43 Z1.0 H01 M08
N6 G99 G81 X6.8 Y0 R0.1 Z-0.163 F3.0
N7 X6.8 Y60.0
N8 X6.8 Y120.0
N9 X6.8 Y180.0
N10 X6.8 Y240.0
N11 X6.8 Y300.0
N13 G80 M09
N14 G91 G28 Z0 M05
N15 G28 X0 Y0
N16 M30

Note that the center of polar coordinates (also called pivot point) is defined in block N3 - it is the last X and Y location programmed before the polar command G16 is called. In the program example O2711, the center is at X0Y0 location (block N3) - compare it with program O2710.

Both, the radius and angle values,may be programmed in either absolute mode G90 or incremental mode G91.

If a particular job requires many arc or bolt hole patterns, polar coordinate system option will be worthy of purchase, even at the cost of adding it later. If the Fanuc User Macro option is installed, macro programs can be created without having polar coordinates on the control and offer even more programming flexibility.

Polar Coordinate Plane Selection

There are three mathematical planes, used for variety of applications, such as polar coordinates.

G17 : XY plane selection
G18 : ZX plane selection
G19 : YZ plane selection

Selection of a correct plane is extremely critical to the proper use of polar coordinates. Always make it a habit to program the necessary plane, even the default G17 plane.

G17 plane is known as the XY plane. If working in another plane, make double sure to adhere to the following rules:

The first axis of selected plane is programmed with the arc radius value
The second axis of selected plane is programmed as the angular position of the hole

In a table format, all three plane possibilities are shown. Note, that if no plane is selected in the program, the control system defaults to G17 - the XY plane.

Most polar coordinate applications take place in the default XY plane, programmed with G17 command.

Order of Machining

The order in which holes are machined can be controlled by changing the sign of the angular value, while the polar coordinate command is in effect. If the angular value is programmed as a positive number, the order of machining will be counterclockwise, based on 0° position. By changing the value to a negative number, the order of machining will be clockwise (reversed).

This feature is quite significant for efficient programming approach, particularly for a large number of various bolt hole patterns. For example, a center drilling or spot drilling operation can be programmed very efficiently with positive angular values (counterclockwise order). Start will be at the first hole and, after the tool change, drilling can continue in reverse order, starting with the last hole. All angular values will now be negative, for the clockwise order of a subsequent tool. This approach requires a lot more work in standard programming, when polar coordinates are not used. The polar coordinate application using G16 command eliminates all unnecessary rapid motions, therefore shortening the overall cycle time.