CNC Milling | G17 - G18 and G19 Codes | Plane Selection

CNC Plane Selection Introduction

From all available machining operations, contouring or profiling is the single most common CNC application, perhaps along with hole making. During contouring, the tool motion is programmed in at least three different ways:

  • Tool motion along a single axis only
  • Tool motion along two axes simultaneously
  • Tool motion along three axes simultaneously

There are additional axis motions that can also be applied (the fourth and fifth axis, for example), but on a CNC machining center, we always work with at least three axes, although not always simultaneously. This reflects the three dimensional reality of our world.
This article applies only to CNC milling systems, since turning systems normally use only two axes, and planes are therefore not required or used. Live tooling on CNC lathes does not enter this subject at this point.

Any absolute point in the program is defined by three coordinates, specified along the X, Y and Z axes. Programmed rapid motion G00 or a linear motion G01 can use any number of axes simultaneously, as long as the resulting tool motion is safe within the work area. No special considerations are required, no special programming is needed.

That is not the case for the following three programming procedures, where various considerations change quite significantly:

  • Circular motion using G02 or G03 command
  • Cutter radius offset using G41 or G42 command
  • Fixed cycles using G81 to G89 commands, or G73, G74 and G76 commands

In all three cases - and only in these three cases - programmer has to consider a special setting of the control system - it is called a selection of the machining plane.

Machine Tool Planes

A typical CNC machining center has three axes. Any two axes form a plane. A machine plane may be defined by looking at the machine from standard operating position. For a vertical machining center, there are three standard views, viewed perpendicularly (straight on):

Top view : XY plane
Front view : XZ plane
Right side view : YZ plane

Illustrations in Figure 31-1 show the difference between the two definitions, caused by viewpoints that are not compatible.

It is clear that the XY plane and top view are the same in both definitions, and so is the YZ plane and the right side view. The ZX mathematical plane is different from the front plane on the machine, which is XZ, as shown in the middle illustration.

Mathematical plane defined as the ZX plane, where Z is the horizontal axis, is reversed on the machine plane for CNC machining centers. On the machine, this plane becomes the XZ plane, where the X-axis is the horizontal axis - a very important distinction.

Figure 31-1
Comparison of standard mathematical planes (above), and planes as viewed on a CNC machining center (below)

In programming, the selection of planes is extremely important, yet often neglected and even misunderstood by programmers and operators alike. The main reason is that the majority of tool motions (particularly for contouring) are programmed and machined in the standard XY plane. On all CNC machining centers, the spindle is always perpendicular to the XY plane. Vertical and horizontal applications are exactly the same in this respect.

G17 - G18 - G19 Codes Format

Selection of a plane for Fanuc and related controls adheres to the mathematical designation of planes, not the actual CNC machine tool planes. In a part program, each of the three mathematical planes can be selected by a special preparatory command - a unique G code:

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

For all rapid motions (programmed with G00) and all linear motions (programmed with G01), the plane selection command is totally irrelevant and even redundant. That is not the case for other motion modes, where the plane selection in a program is extremely important and must be considered carefully.

For machining applications using circular interpolation mode, with G02 or G03 commands (including helical motion), cutter radius offset with G41 or G42 commands and fixed cycles with G81 to G89 commands, as well as G73, G74, G76, the plane selection is very critical.

Default Control Status

If a plane is not selected by the program, control defaults automatically to G17 - XY plane - in milling and G18 - ZX plane - in turning. If plane selection G-code is used, it should be included at the program beginning (top). Since the three plane commands only have affect on circular motions, cutter radius offsets and fixed cycles, the plane selection command G17, G18 or G19 can be programmed before any of these machining motions take place.

Always program the appropriate plane selection command. Never rely on the control settings!

Any plane selection change is programmed as desired, prior to actual toolpath change. Plane can be changed as often as necessary in a program, but only one plane can be active at any time. Selection of one plane cancels any other plane, so each of G17/G18/G19 commands cancels the other. Although true in an informative sense, it is most likely that any opportunities to mix all three plane commands in a single program are remote. From all three available motions, only the circular motion is affected by plane selection, but let’s have look at the programming rapid and linear motions as well, at least for comparison purposes.

G17 - G18 and G19 Codes Examples

Example - 1

The example illustrated in Figure 31-4 is a simple job that requires cutting the R0.75 arc in XZ plane. Typically, a ball nose end mill (also known as a spherical end mill) will be used for a job like this.

In the much simplified example, only two main tool passes are programmed. One pass is the left-to-right motion - across the left plane, over the cylinder, and over the right plane. The other pass is from right to left - across the right plane, over the cylinder, and across the left plane. A step over for the tool is also programmed, between the two passes. Program of this type for the whole part could be done in the incremental mode and would greatly benefit from the use of subprograms.

Figure 31-5 demonstrates tool motion for the two passes included in the program example. To interpret program data correctly, note that program zero is at the bottom left corner of the part. Both clearances off the part are 0.100 and the step over is 0.050:

Figure 31-4
Drawing for the programming example O3101

N1 G20
N3 G90 G54 G00 X-0.1 Y0 S600 M03
N4 G43 Z2.0 H01 M08
N5 G01 G42 Z0.5 D01 F8.0
N6 X1.0
N7 G03 X2.5 I0.75 (= G03 X2.5 Z0.5 I0.75 K0)
N8 G01 X3.6
N9 G91 G41 Y0.05
N10 G90 X2.5
N11 G02 X1.0 I-0.75(= G02 X1.0 Z0.5 I-0.75 K0)
N12 G01 X-0.1
N13 G91 G42 Y0.05
N14 G90 ...

When working with this type of CNC program the first time, it may be a good idea to test the toolpath in the air, a little above the job. Errors can happen quite easily.

Three axes cutting motion is programmed manually only for parts where calculations are not too time consuming. For parts requiring complex motions calculations, a computer programming software is a better choice.

Figure 31-5
Tool path for programming example O3101