The G76 threading cycle: calculating P, Q and R with an M24×2 external thread
Explains the two-block format of the G76 multiple threading cycle with an M24×2 metric thread example: calculating the minor diameter and thread depth, the relationship between first depth of cut and number of passes, and start-position clearance, together with the path drawing.
Why threads are cut with a cycle
A thread is produced when the tool is precisely synchronized with spindle rotation and moves one lead along Z per revolution. A thread more than 1 mm deep cannot be cut in one pass, so the same helix has to be followed many times, a little deeper each time. Writing each pass directly with G32 needs four blocks per pass (approach, cut, retract, return), so the program runs to dozens of lines.
G76 produces this entire process from just two blocks. It reduces the infeed with each pass to keep the cut area constant, and feeds in obliquely along one flank so that only one side of the cutting edge is loaded.
Calculating minor diameter and thread depth
In practice, the thread depth (machining depth) of an ISO metric coarse external thread is commonly calculated as 0.6134 × pitch. For a 2 mm pitch, 0.6134 × 2 = 1.2268, rounded to 1.227 mm. This is a radius value, so the minor diameter is 24 − 2 × 1.227 = 21.546 mm.
The final minor diameter is usually adjusted after a test cut, depending on the tool tip geometry, tolerance class and mating part. The value above is a starting point; the fit is then adjusted with the wear offset based on gauge results.
| Item | Calculation | Value for M24×2 |
|---|---|---|
| Thread depth h | 0.6134 × P | 1.227 mm (radius) |
| Minor diameter | Major diameter − 2h | Ø21.546 |
| G76 second-block P | h as an integer in units of 0.001 mm | P1227 |
| G76 second-block X | Minor diameter | X21.546 |
First block: finishing passes, chamfer, angle and minimum depth of cut
P020060is three two-digit values joined together.02means two repeated finishing passes at the final depth,00means no chamfering at the thread end, and60is the 60° tool tip angle.Q100is a minimum depth of cut of 0.1 mm (radius, in units of 0.001 mm). The calculated infeed becomes very thin as the depth increases; this value stops it from becoming thinner, avoiding a situation where the tool only rubs the workpiece.R0.05is the finishing allowance. The roughing passes stop leaving this amount, and the final finishing passes remove it.
Second block: end point, depth, first depth of cut and lead
X21.546 Z-25. are the minor diameter and Z position of the thread end point, P1227 is the thread depth, Q350 is a first depth of cut of 0.35 mm, and F2.0 is the lead (equal to the pitch for a single-start thread). For a taper thread, R is added here for the radius difference between the start and end.
In the FANUC method, the cumulative depth of the nth pass increases roughly as first depth × √n. With a first depth of 0.35 mm, it accumulates to 0.35 after pass 1, about 0.49 after pass 2, about 0.61 after pass 3, 0.70 after pass 4 and so on, so the cross-sectional area removed per pass stays nearly the same. Filling a depth of 1.227 mm takes roughly (1.227 / 0.35)² ≈ 12 passes; the minimum depth limit and the finishing repetitions then determine the actual number.
Example path
In the drawing below, the closely spaced horizontal lines are the thread cutting passes, and the rapid moves connecting them are the retracts and returns. You can see the spacing between passes narrowing as the depth increases.
M24×2 external thread, 25 mm thread length, two finishing passes
O2006
T0707
G21 G90 G18 G99
G97 S800 M03
G00 X28. Z6.
G76 P020060 Q100 R0.05
G76 X21.546 Z-25. P1227 Q350 F2.0
G00 X100. Z100.
M30The figure above is the CNC Path Analyzer result for this program (rapid 45 segments, thread cutting 11 segments).
Why the start position is placed ahead of the thread
The example starts at Z6., three leads ahead of the face (Z0) where the thread begins. Spindle-synchronized feed is not accurate in lead during the acceleration right after starting, so clearance is given so that this section ends outside the workpiece. If the start point is too close, the pitch of the first few threads is distorted and the gauge will not go on. The start X, X28., must also be well above the Ø24 major diameter so that retracts and returns do not touch the thread.
The √n rule in a table of depths per pass
Calculating the cumulative depth 0.35 × √n with a first depth of 0.35 mm gives the following. The cumulative depth keeps increasing, but the extra amount cut in each pass keeps decreasing. Because the thread profile is triangular, the edge contact width grows as the tool goes deeper, so the infeed must be reduced to keep the area cut per pass similar.
| Pass n | Cumulative depth (mm, radius) | Infeed this pass (mm) |
|---|---|---|
| 1 | 0.350 | 0.350 |
| 2 | 0.495 | 0.145 |
| 3 | 0.606 | 0.111 |
| 4 | 0.700 | 0.094 |
| 6 | 0.857 | About 0.07 |
| 9 | 1.050 | About 0.06 |
Common problems in threading
| Symptom | What to check |
|---|---|
| The thread splits into two | Whether the spindle speed changed between passes (use of G96). Threads are cut at a fixed spindle speed with G97. |
| The gauge will not go on | Minor diameter X, thread depth P, tool wear offset |
| Only the first threads have the wrong pitch | Not enough start clearance in Z |
| The tool tip chips quickly | First depth of cut Q too large, or minimum depth too small |
| The tool hits the shoulder at the thread end | Thread end Z, chamfer amount and groove (undercut) width |
Frequently asked questions
What changes if G92 is used instead of G76?
G92, one block is one pass. The depth of cut has to be written for every pass, so there are more lines, but the depth of each pass can be fully controlled, which is why it is used for special threads and thin workpieces.