G71 example: the Fanuc lathe roughing cycle, line by line
A working G71 program for a stepped shaft, with every word explained, the G70 finishing pass, and the mistakes to avoid.
G71 syntax on a Fanuc lathe
G71 is the stock removal cycle for turning along the Z axis. Fanuc controls usually read it in two blocks:
G71 U(depth) R(retract) G71 P(first block) Q(last block) U(allowance X) W(allowance Z) F(feed)
| Word | Meaning |
|---|---|
U (first block) | Depth of cut per pass, measured on the radius. |
R | How far the tool backs off after each cut. |
P / Q | Numbers of the first and last block of the finished contour. |
U (second block) | Finishing allowance left in X, given as a diameter value (0.4 leaves 0.2 per side). |
W | Finishing allowance left in Z. |
F | Roughing feed. Feed and speed words written inside the contour blocks are ignored during G71 and used by G70. |
A complete G71 example program
Bar stock 50 mm in diameter, finished to a stepped shaft: 20 mm for 25 mm, 30 mm up to Z-50, then 40 mm up to Z-70. Feeds in mm per revolution (G99).
O1001 (G71 EXAMPLE - STEPPED SHAFT, STOCK D50) G21 G40 G97 G99 T0101 (ROUGHING TOOL) G97 S1200 M03 G00 X52. Z2. G71 U2. R0.5 G71 P100 Q200 U0.4 W0.1 F0.25 N100 G00 X16. G01 Z0. F0.12 X20. Z-2. Z-25. X30. Z-50. X40. Z-70. N200 X52. G00 X100. Z100. M05 T0202 (FINISHING TOOL) G97 S1800 M03 G00 X52. Z2. G70 P100 Q200 G00 X100. Z100. M05 M30
The speeds and feeds here only show the format. Take real values from your insert catalog and your machine.
The example, line by line
G00 X52. Z2.is the start point. It sits above the stock and just in front of the face, so the cycle begins in clear air.G71 U2. R0.5cuts 2 mm deep per pass on the radius and backs off 0.5 mm.G71 P100 Q200 ...tells the control that the finished shape is in blocks N100 to N200 and leaves 0.2 mm per side in X and 0.1 mm in Z.N100 ... N200is the contour: a 2x45 degree chamfer, three diameters and two shoulders. The last blockX52.clears the stock.G70 P100 Q200runs the same blocks again with the finishing tool and the feed written in the contour.
G71, G72 and G70
- G71 roughs by cutting passes parallel to the Z axis. It is the usual choice for shafts.
- G72 roughs by cutting passes parallel to the X axis, which suits short, wide parts and facing.
- G70 is the finishing cycle that follows either of them.
Other controls
Haas lathes also accept a one-block form, G71 P Q U W D F, where D is the depth of cut. Siemens controls use CYCLE95 instead. The generator on this site writes the right form for the controller you pick. Always check the format against your machine manual.
Five mistakes that scrap parts
- A contour that goes back on itself. The basic (type I) Fanuc G71 needs X and Z to move in one direction only; pockets and undercuts need the type II form described in your manual.
- Reading the X allowance as a radius value. On Fanuc it is a diameter value.
- Expecting the feed written in the contour to be used during roughing. It is used only by G70.
- Starting the cycle inside the stock. The start point must clear the stock in X and Z.
- Mixing feed units. Check that G99 (mm per revolution) or G98 (mm per minute) is the mode you mean.
Frequently asked questions
What do P and Q mean in G71?
P is the number of the first block of the finished contour and Q is the number of the last block. The control repeats the roughing passes along that shape.
Is the G71 allowance U a radius or a diameter?
On Fanuc controls the U allowance in the second G71 block is a diameter value, so U0.4 leaves 0.2 mm on each side.
Do I need G70 after G71?
G71 only roughs and leaves the allowance. G70 runs the same contour as a finishing pass with the finishing tool and the feed written in the contour blocks.
Can the generator write G71 for me?
Yes. For Fanuc it writes the two-block G71 and the G70 finishing pass from your drawing, and for Haas the one-block form.
Skip the typingUpload a drawing, get a program for your controller and check it in the 3D simulator before it goes near the machine. Try the example with no sign-up; a new account gets 2 free generations.
Open the generator