G71 Rough Turning Cycle for Fanuc

CNCCookbook’s G-Code Tutorial

 

G71 Rough Turning Cycle Overview

Imagine how a CAM program might work for the lathe. You draw the profile that you want to turn on a part, push a button, and out comes g-code that converts that profile into the right moves to cut the profile in multiple passes based on the depth of cut for each pass you specified. G71 and its cousins are some of the most useful canned cycles you’ll ever come across for the lathe, because they essentially do what I’ve just described. The difference is that instead of specifying a profile in a CAD program, you specify the profile using g-codes.

Here is a very simple profile:

Simple G71 Profile

A simple profile consisting of 3 G01 segments with a G00 to the starting point…

This profile consists of 3 G01 line segments with a G00 rapid move to the starting point of the profile. The code associated with the profile is trivial:

N1 G0 X1.6 N2 G1 Z-4.0 N3 X2.5 Z-5.0 N4 G1 X4

Now here is a simulated G71 command to rough turn that profile:

G71 Simulation

The simulated G71 makes 2 roughing passes and then cuts the profile…

And here is the code that was simulated:

% Top to bottom, right to left ( One line G71 ) G0 X4 Z1.0 (Start Position before commanding the cycle) G71 P1 Q4 D1.0 F2 U0.2 W0.1 N1 G0 X1.6 N2 G1 Z-4.0 N3 X2.5 Z-5.0 N4 G1 X4

There’s not much more needed than the profile to get the job done. G71 can save you a whole bunch of time and make it pretty easy to crank out some parts without needing to access a CAM program. Before we dive into exactly how to program a G71, we need to cover the different flavors of G71 you may run into.

What Kind of G71 Does Your Controller Have?

There are essentially two ways in which G71 cycles vary from one controller to the next.

– They can be either 2 line or 1 line syntax.

– They can be either Type I or Type II, with Type II being capable of cutting “Pockets”

Let’s see what each entails.

Two Line Versus One Line G71 Syntax

If you have a later model Fanuc control, it probably has 2 line syntax. If you have a Fanuc 10T, 11T, or 15T, or you have a Haas, it probably uses the 1 line syntax. The two are only slightly different and for the most part they have the same capabilities. The example given above was a “1 line” format. Here is the same program set up for the “2 line” syntax:

% Top to bottom, right to left G0 X4 Z1.0 (Start Position before commanding the cycle) G71 U1.0 R0.5 G71 P1 Q4 F2 U0.2 W0.1 N1 G0 X1.6 N2 G1 Z-4.0 N3 X2.5 Z-5.0 N4 G1 X4

Now let’s compare the two and see what the different words do for each. Here is a summary:

G71 one line and two line formats

Specify the Profile Blocks With “P” and “Q” Words

The first thing that has to be done is to tell the G71 where it can find the g-codes that create the profile. The “P” word is the “N” number of the first line of profile G-code and the “Q” word is specifies the last line. There are quite a few restrictions on what can happen on those lines, so it’s best to keep them simple. If you want to do something more than just lines and arcs, you’ll want to consult your controller’s programming manual to be sure it is allowed.

Specify the Depth of Each Roughing Pass

For two line format, the rough depth is specified by “U”. For one line, it is specified by “D”. This is the distance between successive roughing passes. Roughing passes proceed until they hit the profile or the edge of the profile’s bounding box, and then they perform a retract move and go back for the next pass. With the 2-line form, you can control the retract move using the “R” word to specify how much to retract. One the one line, the amount of retraction is in a setting. For Haas machines, that’s Setting 73, and the default value is 0.05″. If you’re using G-Wizard Editor to simulate G71’s, you get to specify the retract in the Post.

For this section, we’ll describe only Type I, and will cover Type II below. In Type I, a retract is done on a 45 degree angle from the cutting pass, and then the cutter returns to the starting Z position using rapids speed before feeding down to the next pass.

The First Profile Block is Special

The first profile block, the one specified by the “P” word, is special. The move there is not part of the profile, but allows you to move the cutter to the starting point of the profile. In addition, the controller notices whether that move is made as a G00 or G01. It must be one or the other! Whichever one you use, that’s what the controller will use to partially feed on each pass. If you specified G00, it rapids down to the prior cut depth and then goes to G01 for the remainder of the feed.

Saving Some Stock for Finishing

You can use a G70 or other code (more on that in another article) to perform a finishing pass. It’s convenient to tell G71 how much stock to leave behind for finishing. This is done with the U word for the X finish allowance and the W word for the Z finish allowance. Some controllers also have a “Semi-finish” allowance specified by the I and K words that is used for one final pass with the roughing tool.

Feeds, Speeds, and Tool for G71

Only one feedrate, spindle rpm, and tool is valid for G71. You either get the values that were in effect before the G71 was called, or you may specify one or more of these using the F, S, or T words on the G71 itself. Any use of F, S, or T inside the profile is ignored.

Anatomy of a Type I G71 Rough Turning Cycle

Anatomy of a G71 Rough Turning Cycle

Anatomy of a G71 Rough Turning Cycle

The diagram shows how all the pieces fit together. From the starting point where the machine was before the G71 was called, it moves up and over by the finish allowance. It then starts to feed down by “U” each pass. The pass traverses until it gets to the profile, then it retracts on a 45 degree angle by the amount specified either by the “R” word (2 line G71) or a setting such as Setting 73. When it gets all the way back in Z, it begins to feed again. If the first line of the profile was a G00, the feed is a G00 until it gets to the depth of the last pass, and then it switches to G01 to finish going to depth.

It proceeds in this way making roughing passes until it is within less than the rough depth of the profile. Note that this is the profile shifted up and to the right by the finish amounts. When it is less than a rough depth away, it simply follows the profile all the way up, and then the final move from the end of that cut goes back to where we started from.

That’s all there is to it!

Type I Requires Monotonic Profiles: No Pockets

This page describes G71 “Type I”, but there is also a “Type II” which we’ll go over on our next page. There are some important differences between the two as you would expect. The biggest one is that Type I allows no “pockets”. Profiles that have no pockets are called “Monotonic”, a term you may have seen either in your controller documentation or perhaps as an alarm on your code if you’ve been playing with G71.

What’s a “Pocket” on a lathe?

Look at your profile, once past the first line that positions to the profile start. If you can follow the profile and never have it go deeper in the cut than that starting point, you have a monotonic profile that has no pockets. Put another way, and the reason it is called what it is, the profile is “monotonically increasing” (or decreasing depending on cut direction). It never changes direction in terms of the X axis.

Note that your profile needs to be monotonic in Z too. You can’t double back and create an undercut. G71 is still very useful as Type I (the only thing the first G71 capable controllers offered), but Type II is quite a bit more powerful. Here is a profile for a candlestick that would require a Type II G71 because it isn’t monotonic:

G71 Pockets Require Type II

Each downstroke marked in yellow creates a “pocket” that Type I G71 can’t do.

Which Direction Am I Going? G71 Has Four Possibilities

Your operation may be turning or boring. One implies motion in towards the axis, and one implies motion out away from the axis. Depending on the orientation of your tool relative to the workpiece and other factors, you may want to cut left to right or right to left. The example we’ve used above cuts right to left and top to bottom. It could be a bore or it could be a turning case where the tool approaches from above the workpiece. The direction of motion for G71 is controlled by the signs on the U and W-word finish allowances. U controls the direction on X (top to bottom or bottom to top) and W controls the direction on Z (right to left or left to right). U+ is for top to bottom, so U- gives bottom to top. W+ is for right to left and W- gives left to right.

As you go through the examples, note that you can’t just change the signs on U and W. The profile definition and starting point have to make sense too.

Let’s go through the 4 scenarios with examples:

Right to Left, Top to Bottom: U+, W+

This is the one we’ve been playing with.

G71 Simulation

Right to Left, Top to Bottom: U+, W+

One Line G71:

% Top to bottom, right to left ( One line G71 ) G0 X4 Z1.0 (Start Position before commanding the cycle) G71 P1 Q4 D1.0 F2 U0.2 W0.1 N1 G0 X1.6 N2 G1 Z-4.0 N3 X2.5 Z-5.0 N4 G1 X4

Two Line G71:

% Top to bottom, right to left G0 X4 Z1.0 (Start Position before commanding the cycle) G71 U1.0 R0.5 G71 P1 Q4 F2 U0.2 W0.1 N1 G0 X1.6 N2 G1 Z-4.0 N3 X2.5 Z-5.0 N4 G1 X4

Top to Bottom, Left to Right: U+, W-

G71 U+, W-

Top to Bottom, Left to Right: U+, W-

One Line G71:

% Top to bottom, left to right G0 X4 Z-1.0 (Start Position before commanding the cycle) G71 P1 Q4 D1.0 F2 U0.2 W-0.1 N1 G0 X1.6 N2 G1 Z2.0 N3 X3 Z4 N4 G1 X4

Two Line G71:

% Top to bottom, left to right G0 X4 Z-1.0 (Start Position before commanding the cycle) G71 U1.0 R0.5 G71 P1 Q4 F2 U0.2 W-0.1 N1 G0 X1.6 N2 G1 Z2.0 N3 X3 Z4 N4 G1 X4

Right to Left, Bottom to Top: U-, W+

G71 U-, W+

Right to Left, Bottom to Top: U-, W+

One line:

% Bottom to top, right to left G0 X-4 Z1.0 (Start Position before commanding the cycle) G71 P1 Q4 D 1.0 F2 U-0.2 W0.1 N1 G0 X-1.6 N2 G1 Z-2.0 N3 X-3 Z-4 N4 G1 X-3.9

Two line:

% Bottom to top, right to left G0 X-4 Z1.0 (Start Position before commanding the cycle) G71 U1.0 R0.5 G71 P1 Q4 F2 U-0.2 W0.1 N1 G0 X-1.6 N2 G1 Z-2.0 N3 X-3 Z-4 N4 G1 X-3.9

Left to Right, Bottom to Top: U-, W-

G71 U-, W-

Left to Right, Bottom to Top: U-, W-

One line:

% Bottom to top, left to right G0 X-4 Z-4.0 (Start Position before commanding the cycle) G71 P1 Q4 D1.0 F2 U-0.2 W-0.1 N1 G0 X-1.6 N2 G1 Z-2 N3 Z1 X-2.5 N4 X-4

Two line:

% Bottom to top, left to right G0 X-4 Z-4.0 (Start Position before commanding the cycle) G71 U1.0 R0.5 G71 P1 Q4 F2 U-0.2 W-0.1 N1 G0 X-1.6 N2 G1 Z-2 N3 Z1 X-2.5 N4 X-4

Tips When Programming G71

Program the Profile Block First

The G71 lines themselves are pretty easy, so start with the profile block. You can see it before you get the G71 going (although see the tip about using a comment to see the profile). Before beginning the profile, think about the direction of your cutting (start at top or bottom, left or right?) and establish your start point. Next, make your move to the beginning of the profile. The start point and beginning of profile differ because the beginning of the profile is likely inside the workpiece before machining. Lastly, carry through with lines and arcs until you’ve completed the profile.

Having done the profile and been satisfied by its simulated shape, add the G71 line(s) and you’re done.

Use a Comment to See the Profile

With G-Wizard Editor, just temporarily comment out the G71 lines to see the profile plotted.

Use a Comment for the Last Line of the Profile

Keep in mind that if you work on the G71 profile blocks with the G71 commented out, GWE’s line renumbering won’t know to renumber the P and Q blocks.

I like to use a comment for the Q block just as a reminder that it is the last block. I stick a big line number on it, and set the Q to point to the line number. The P block is usually not controversial because it just moves you to the initial position before beginning the profile. Hence, you can go ahead and set up P and Q so they won’t need renumbering–P isn’t changing and Q has a big number on it with plenty of room for lots of lines to be inserted and numbered before it. When you get it all done the way you like it, then uncomment the G71 to see how it looks, and lastly, run the Renumber Revision so you can get the “N” numbers all cleaned up.

The other thing to do is to number the P and Q block but don’t number the blocks in between. There is no requirement to number every block, and leaving the numbers off means you don’t have to worry about keeping them up to date as you edit.

Use Your Mill CAM Software to Create the Profile

Suppose you have CAM software for milling but not for turning. You can use your mill software to crank out a profile. You just need to make sure your mill’s post is outputing the correct format for arcs (lines don’t change much across controllers) and you can copy and paste that snippet over for your lathe. Pay careful attention to part zero and so forth and it’s not to hard to produce a suitable profile quickly and easily with your mill CAM software.

Here’s a page with a fuller explanation and worked example of how to use your Mill CAM for the lathe.

Exercises

1. First things first: pull out your CNC programming manual for your controller and see whether it uses 1 line or 2 line, and whether it offers Type I or Type II.

2. Configure G-Wizard Editor to use your controller’s G71 format.

3. Create a profile and then get it working in all 4 variations of cutting direction like the examples above.

4. If you have CAM for your Mill but no lathe CAM, try our suggestion to create a G71 program on a profile of your own.

Try the Free Trial Version of G-Wizard G-Code Editor…

 

No credit card required–just your name and email.

Next Article: G71 Type II: Rough Turning With “Pockets”

 

Is Manual Machining Faster than CNC for Simple Parts?

Recently updated on January 2nd, 2024 at 12:37 pm