0 votes
in cnc programming by (9.0k points)

In this article, we describe linear motion command which is called G01 code on CNC machines with all details and examples.

Linear interpolation is closely related to rapid positioning motion. While rapid tool motion is meant to be used from one position of the work area to another position without cutting, linear interpolation mode is designed for actual material removal, such as contouring, pocketing, face milling and many other cutting motions.
Linear interpolation is used in part programming to make a straight cutting motion from the  cutter start position to its end position. It always uses the shortest distance a cutting tool path can take. The motion programmed in linear interpolation mode is always a straight line, connecting the contour start and end points. In this mode, the cutter moves from one position to another by the shortest distance between the end points. This is a very important programming feature, used mainly in contouring and profiling. Any angular motion (such as chamfers, bevels, angles, tapers, etc.) must be programmed in this mode to be accurate. Three types of motion can be generated in the linear interpolation mode:

  • Horizontal motion ( single axis only )
  • Vertical motion ( single axis only )
  • Angular motion ( multiple axes )

The term linear interpolation means that the control system is capable to calculate thousands of intermediate coordinate points between the start point and end point of the cut. Result of this calculation is the shortest path between the two points. All calculations are automatic – the control system constantly coordinates and adjusts the feedrate for all cutting axes, normally two or three.

Linear Command

G01 Linear interpolation (linear motion)
In G01 mode, the feedrate function F must be in effect. The first program block that starts linear interpolation mode must have a feedrate in effect, otherwise an alarm will occur during the first run, after power on. Command G01 and feedrate F are modal, which means they may be omitted in all subsequent linear interpolation blocks, once they have been designated, and providing the feedrate remains unchanged. Only a change of coordinate location is required for the axis designation in a program block. In addition to a single axis motion, linear motion along two or three axes may be also programmed simultaneously.

Start and End of the Linear Motion

Linear motion, like any other motion in CNC programming, is a motion between two end points of a contour. It has the start position and the end position. Any start position is often called the departure position, the end position is often called the target position. Start of a linear motion is defined by the current tool position, its end is defined by the target coordinates of the current block. It is easy to see that the end position of one motion will become the start position of the next motion, as the cutter moves along the part, through all contour change points.

Single Axis Linear Interpolation

Programmed tool motion along any single axis is always a motion parallel to that axis, regardless of the motion mode. Programming in either G00 or G01 mode will result in the same programmed end point, but at different feedrates and with different results. Evaluate Figure 22-1 for comparison of the two motion modes.

Figure 22-1
Comparison of the rapid mode and the linear interpolation mode

For CNC machining centers and the related machines, all tool motions that are parallel to the table edges are single axis motions. On CNC lathes, many external and internal operations, such as facing, shoulder turning, diameter turning, drilling, tapping and others, are programmed as single axis motions. In all cases, a single axis motion can be along either the vertical or the horizontal axis, within the current (working) plane. A single axis motion can never be an angular motion, which requires two or three axes. Another name for a motion that is parallel to a machine axis is orthogonal – horizontal or vertical only.

Figure 22-2
Single axis linear interpolation motion

Figure 22-2 illustrates a single axis linear interpolation motion, one along X-axis and the other along Y- axis.

Two Axes Linear Interpolation

Linear motion can also be programmed along two axes simultaneously. This is a very common situation when the start point of linear motion and its end point have at least two coordinates that are different from each other, while in linear interpolation mode G01. The result of this two-axis motion is a straight tool motion at an angle. Such motion will always be the shortest distance between the start point and end point and results in a straight line at an angle calculated by the control – Figure 22-3.

Figure 22-3
Two axes simultaneous linear interpolation motion

Three Axis Linear Interpolation

Linear motion that takes place along three axes at the same time, is called the three axis linear interpolation. A simultaneous linear motion along three axes is possible on virtually all CNC machining centers. Programming a linear motion of this kind is not always easy, particularly when working with complex parts. Due to many difficult calculations involved in this type of tool motion, the manual programming method is not efficient enough. Such programming projects more than justify an investment into a professional computer based programming system, such as the very powerful and widely used Mastercam™, that is based on modern computer technology combined with machining know-how. This type of programming is using desktop computers and is affordable by virtually all machine shops.
Three-axis (XYZ) simultaneous linear motion is illustrated in Figure 22-4.

Figure 22-4
Three axes simultaneous linear interpolation motion

Programming Format

In order to program a tool motion in linear interpolation mode, use preparatory command G01 along with one, two, or three axes of tool motion, as well as a cutting feedrate (F address) suitable for the job at hand:
G01 X.. Y.. Z.. F..
All entries in linear motion block are modal and need to be programmed only if they are new or changed. Only the block instruction (word) that is affected by the change needs to be included in the program block.
Depending on which programming method is selected, linear interpolation motion may be programmed in absolute or incremental mode, using G90 and G91 preparatory commands for milling, and incremental addresses U and W for turning.

G01 Program Example

CNC Linear Motion – G01 Code Program Example

Tool Diameter : 5mm
Depth : 5mm
N15 G54 ;
N20 G90;
N90 T02 M6;
N92 G94 F500;
N95 S2000 ;
N100 M03;
N105 G43 G0 Z100 H2;
N110 G00 X21 Y64;
N115 G00 Z5;
N120 G01 Z–5;
N130 G01 Y34;
N135 G00 Z5;
N140 G00 X62 Y30;
N145 G01 Z–5;
N150 X93 Y58;
N155 G00 Z5;
N160 X90 Y95;
N165 G01 Z–5;
N170 X30;
N175 G00 Z200;
N195 M05 M09;
N205 M30;

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.