CNC Path Analyzer

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.

ItemCalculationValue for M24×2
Thread depth h0.6134 × P1.227 mm (radius)
Minor diameterMajor diameter − 2hØ21.546
G76 second-block Ph as an integer in units of 0.001 mmP1227
G76 second-block XMinor diameterX21.546

First block: finishing passes, chamfer, angle and minimum depth of cut

  • P020060 is three two-digit values joined together. 02 means two repeated finishing passes at the final depth, 00 means no chamfering at the thread end, and 60 is the 60° tool tip angle.
  • Q100 is 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.05 is 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.
M30
M24×2 external thread, 25 mm thread length, two finishing passes — ZX (radius) pathZX (radius)
Dashed light blue is G00 rapid traverse; solid orange is cutting motion. Arcs are expanded into calculated static curves.

The 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 nCumulative depth (mm, radius)Infeed this pass (mm)
10.3500.350
20.4950.145
30.6060.111
40.7000.094
60.857About 0.07
91.050About 0.06

Common problems in threading

SymptomWhat to check
The thread splits into twoWhether the spindle speed changed between passes (use of G96). Threads are cut at a fixed spindle speed with G97.
The gauge will not go onMinor diameter X, thread depth P, tool wear offset
Only the first threads have the wrong pitchNot enough start clearance in Z
The tool tip chips quicklyFirst depth of cut Q too large, or minimum depth too small
The tool hits the shoulder at the thread endThread end Z, chamfer amount and groove (undercut) width

Frequently asked questions

What changes if G92 is used instead of G76?
With 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.
Do internal threads work the same way?
Yes. The X end point moves in the direction larger than the start point (from inside the bore outward), and the thread depth formula changes to the one for internal threads. Chatter caused by the boring bar overhang must also be considered.

Next steps

Check the path in CNC Path Analyzer