Is Manual Machining Faster than CNC for Simple Parts?

# G68 & G69 G Codes: CNC Coordinate Rotation

**Introduction**

It can be very convenient to be able to execute g-code with the assumption that the coordinate system has been rotated. Consider, for example, a case where you want to repeat a pocket or slot multiple times on a part. The repeats are all laid out on a circle around some center point. This is a perfect excuse to use G68 coordinate system rotation.

**G68 G-Code Example**

Let’s suppose we have a part that requires 3 “arched doorway” slots. We write a subprogram to do the arched doorway, and we want to be able to rotate the coordinates as we call the doorway subprogram for each slot. Our code would look like this:

**( Example use of G68 to make 3 slots in a circle )** ** T10** ** M6** ** G0 G90 G54.1 P20 X0 Y0 S8000 M3** ** G43 Z3 H22 D22 M8** ** ( First time we don’t rotate the slot )**

**M98 P0071** ** ( Second time we rotate 120 degrees )**

**G68 X0 Y0 R120.** ** M98 P0071** ** ( Third time we rotate 240 degrees**

**G68 X0 Y0 R240.** ** M98 P0071** ** G69 (Turn off coordinate rotation so it doesn’t confuse us later! )** ** G0 G90 Z250 M9** ** G0 G91 G28 Z0 Y0 M5** ** M30**

**:0071 (SUBPROGRAM FOR SLOT)** ** G0 X0 Y-4.** ** G0 Z-6.** ** G1 Y-16.775 F400** ** G1 Y-10.** ** G1 G41 X1.51 Y-13.51** ** G3 X5.01 Y-10. R3.5** ** G1 Y0 R3** ** G1 X-5.01 R3** ** G1 Y-16.775** ** G3 X5.01 Y-16.775 R5.01** ** G1 Y-10.** ** G3 X1.51 Y-6.5 R3.5** ** G1 G40 X0 Y-10.** ** G0 Z3** ** G0 X0 Y0** ** M99**

And here is what the simulation in G-Wizard Editor looks like:

G68 rotated the “arched doorway” slot through 3 calls of a subprogram to create 3 slots…

BTW, those fans in the middle of each pocket are tool entry and exit paths. You’ll get a much better finish if your tool arcs into the cut rather than just heading straight in along a line. This is one of the many tricks discussed in our CAM Toolpath Considerations page of the Feeds and Speeds Cookbook.

**Syntax for G68 Coordinate System Rotation (Fanuc & Mach3)**

The syntax for a G68 is pretty simple. For Fanuc, use:

G68 <alpha> <beta> R<angle>

Where, alpha and beta are words for the 2 coordinates of the circle’s center we want to rotate about. For G17, <alpha> is X and <beta> is Y. In the example, we had the circle center at X0Y0. R specifies the angle of rotation in degrees, counterclockwise.

For Mach3, we use a slightly different syntax:

G68 A<center coordinate 1> B<center coordinate 2> R<angle>

Rather than having the coordinate words vary with which plane is selected (G17, G18, or G19), Mach3 just uses the “A” and “B” words. The first G68 in the example would be written like so:

G68 A0B0 R120

As you can see from the example, multiple G68’s just replace the R or center values.

There is the option on some controls to make G68’s relative, rather than absolute. In this case, rather than having multiple G68’s replace the values, they are relative to the values. For most controls, the decision of whether subsequent G68’s are relative or absolute is a parameter. For Mach3, it is a function of whether the “I” word is present (think “I” for “Incremental”). The value (address) of the word is ignored, but any I will cause Mach3 to treat the coordinate as relative.

## G69 G-Code: Cancel Rotation

To cancel rotation, just use a G69.

**Other Uses for G68 Coordinate Rotation**

Beside the obvious usefulness of rotating the coordinates before calling a subprogram so that the same cut may be applied along a circular path, there are other important uses for G68. Here are some examples (for completeness, we include the subprogram example too):

– Simplify your part program by creation of subprograms that repeat cutting operations multiple times along an arc. This will also reduce the memory requirements of the part program.

– Align work that is not exactly aligned to the coordinate system. For example, suppose you wanted to run without tramming in a fixture. If you can probe the fixture to determine its angle, you can apply a G68 to “zero out” that angle and then run the part program. This can reduce setup time by reducing the need to be accurate and trammed in.

– If a part program is written for a bigger machine and has more Y-travel (extents) than X, you may be able to rotate the coordinates so the long axis is aligned with your X and still be able to run it.

– You may be able to nest more parts on your machine table if you can perform arbitrary rotations on them. This is very easy to do with G68.

– A part that is otherwise too large for a machine might fit if you could take advantage of the extra long diagonal dimension. Once again, this is easy to do with G68.

**Exercises**

1. Write a program similar to the example that takes some cutting operation, puts it in a subprogram, and then uses G68 to rotate it to multiple positions around the circle.

**Next Article: Mirroring the Coordinate System**