CNC Linear Motion

G-Code is about motion, and the most common kind of motion found in part programs is straight line or linear motion. Motion is another one of those things in g-code that is modal. You tell the controller what kind of motion you’d like with a g-code and it remembers to always make that kind of motion until you tell it to change using another g-code.

G90 Absolute Positioning G-Code:

When Using G-code G90 (absolute positioning) Command, The end positioning of the tool movement is always from the absolute point (Absolute Zero) or the fixed point. All the x y and z co-ordinate movements are calculated from the Zero point or the Axis Point. Absolute zero point is always set on the mid of the center table or the corner of the part or Center of the hole depending on the machines and the complexity of the part. In simple words “Absolute zero” is where the dimensions of the part program are defined from.

When using G90 the end point movement is the machine would go to that exact location from part zero, regardless of where it began, within the travel of the machine tool.

Example for G-Code G90 (Absolute Positioning):

G90 G01 X-3 Y-2 F50;

As shown in the above code line the tool want to move to a position of 3 inches to the left, and 2 inches down from part zero was programmed, suppose if your tool somewhere in X500 Y500 position and when the G90 is called it moves to X-3 and Y-2 compared from absolute Zero.

G91 Incremental Positioning G-Code:

When using G-code G91 (Incremental Positioning) Command, the tool always moves incrementing the last position value i.e., the control thinks that the last position of the tool is zero point and adds up the new position coded. When using a G-code G91 incremental position command, each measurement or move is the actual distance to the next location is always from the current location. This G-code is modal G-code and is not cancelled until G90 is called. G91 makes all subsequent x y and z incremental throughout the program until it is cancelled.

In general, the G91 Incremental positioning G-code is used when repeating motions within a subprogram, for example, if you have four identical pockets to machine, then you can specify the motions incrementally to machine one pocket. Then just call up the subroutine again to repeat the commands to do another pocket at a new location. By doing this you can save programming effort to all the pockets

Example for G-Code G91 (Incremental Positioning):

N170 G91 G01 X-3 Y-2 F50;

As shown in the above code line the tool want to move to a position of 3 inches to the left, and 2 inches down from the last tool position, suppose if your tool somewhere in X500 Y500 position and when the G91 is called as above example it moves to X497 and Y498 compared from absolute Zero.

G00 for Fast Positioning - G01 for Slower Cutting Motion

Rapids motion tells your machine to move at its fastest possible speed. G00 is used to position the cutter near where you want to start cutting, but we never enter a cut with G00. Doing so by mistake ensures a broken cutter or worse as rapids motion is way too fast for any kind of cutting. Most controllers start up with G00 active when you first turn on the machine. That’s because the part program has to manuever the cutter into position near the cut before you can begin removing material. Once the cutter is ready and you want to make cutting motions, you would typically use G01 to specify feed motion.

Specifying X, Y, and Z

Note that simply specifying G00 or G01 does not cause any motion to happen–they merely tell the controller what type of motion is expected when you finally tell it where to move to. For actual motion you need to specify a destination using the X, Y, and Z words

As a reminder, to move to the part zero, we might issue a command like this:

G00 X0 Y0 Z0

This is an example of specifying multiple coordinates on a line, it means that more than one axis of the machine is moving at the same time. If we specify the same destination, but spread the coordinates over multiple lines, each line is a separate move. For example


X0 Y0


It will move to X0 Y0 in one move, keeping Z constant. Then move to Z0 in one move, keeping X and Y constant

Careful With Z!

It’s often a good idea to move the depth-of-cut-axis on its own, rather than as coordinated motion with other axes. Doing so just makes it easier to “eyeball” whether you’re going to have a problem (collision is the technical term) as the cutter gets close to the workpiece and fixturing. It’s really hard for the human eye to judge motion in multiple axes, particularly if you have to move a long ways in X and Y and a relatively shorter distance in Z. By first moving in X and Y and then moving in Z as shown in the example above, it’s much easier to judge whether an accidental collision is about to take place. You’re also much less likely to hit some random object sticking up, like a clamp, if you keep the cutter high until you’re directly over where you want to start cutting.

Entering a Cut

While you will often see programs and machinists that take the cutter straight into the material to begin a cut, this is not the best approach for cutter life and surface finish. You may want to read about the Feeds and Speeds but ideally you’d like to enter with some sort of an arc move that gradually builds the cutting forces instead of hammering straight in with a plunge cut of some kind. This makes it less likely you’ll chip the cutter, especially in harder materials. To do that, we’ll need to understand arc moves