CNC programming and alarms
G92 threading cycle example: Fanuc lathe, G-code system A
Fanuc CNC lathe, G-code system A (Group A G-codes): 1/2-13 UNC-2A external thread, 1.000 in long, ten passes plus a spring pass.
Technical review pending. Formulas and values are cited. This notice comes down after a machinist review.
%
O0092 (1/2-13 UNC-2A EXTERNAL THREAD, 1.000 LONG)
N10 G20 G40 G99 (INCH, TNRC OFF, FEED PER REV)
N20 T0303 (60 DEG EXTERNAL THREADING TOOL)
N30 G97 S500 M03 (CONSTANT RPM, NO CSS)
N40 G00 X0.7 Z0.25 M08 (CYCLE START POINT)
N50 G92 X0.4687 Z-1.0 F0.076923 (PASS 1)
N60 X0.4563 (PASS 2)
N70 X0.4468 (PASS 3)
N80 X0.4388 (PASS 4)
N90 X0.4318 (PASS 5)
N100 X0.4254 (PASS 6)
N110 X0.4195 (PASS 7)
N120 X0.4141 (PASS 8)
N130 X0.4090 (PASS 9)
N140 X0.4041 (PASS 10, FINAL DEPTH)
N150 X0.4041 (SPRING PASS)
N160 G00 X1.0 Z1.0 M09
N170 M05
N180 M30
%
The blank is turned to the class 2A major diameter limits, and the depth is figured from the 2A maximum major: 0.5000 in basic minus the 0.0015 in allowance, 0.4985 in. Final pass X0.4041 in (10.26 mm) on diameter is a starting point. Check the final pitch and minor diameters against the ASME B1.1 class 2A (external) table for 1/2-13 UNC.
Source: FANUC lathe (T series) operator's manual, Series 0i, thread cutting cycle G92 (G-code system A); Machinery's Handbook (Unified thread form, thread depth); ASME B1.1 (Unified inch screw threads)
Line by line
| Block | What it does |
|---|---|
% | Tape start. Some controls and DNC software need it; others ignore it. |
O0092 (1/2-13 UNC-2A EXTERNAL THREAD, 1.000 LONG) | Program number and a comment naming the thread and class. |
N10 G20 G40 G99 (INCH, TNRC OFF, FEED PER REV) | Inch mode, tool nose radius compensation off, feed per revolution. |
N20 T0303 (60 DEG EXTERNAL THREADING TOOL) | Tool 3 with offset 3. Use your own tool and offset numbers. |
N30 G97 S500 M03 (CONSTANT RPM, NO CSS) | Constant spindle speed, 500 RPM, clockwise. 500 RPM is a placeholder; see the spindle speed notes below. |
N40 G00 X0.7 Z0.25 M08 (CYCLE START POINT) | Rapid to the start point, coolant on. X0.7 is the retract diameter for every pass; Z0.25 gives the Z axis room to reach thread feed. |
N50 G92 X0.4687 Z-1.0 F0.076923 (PASS 1) | Threading cycle: rapid to X0.4687, thread to Z-1.0 at F0.076923 (the lead in inches), retract to X0.7, rapid back to Z0.25. Radial depth 0.0149 in. |
N60 X0.4563 (PASS 2) | Repeats the cycle at X0.4563: cumulative radial depth 0.0211 in, 0.0062 in this pass. |
N70 X0.4468 (PASS 3) | Repeats the cycle at X0.4468: cumulative radial depth 0.0258 in, 0.0047 in this pass. |
N80 X0.4388 (PASS 4) | Repeats the cycle at X0.4388: cumulative radial depth 0.0298 in, 0.0040 in this pass. |
N90 X0.4318 (PASS 5) | Repeats the cycle at X0.4318: cumulative radial depth 0.0334 in, 0.0035 in this pass. |
N100 X0.4254 (PASS 6) | Repeats the cycle at X0.4254: cumulative radial depth 0.0366 in, 0.0032 in this pass. |
N110 X0.4195 (PASS 7) | Repeats the cycle at X0.4195: cumulative radial depth 0.0395 in, 0.0029 in this pass. |
N120 X0.4141 (PASS 8) | Repeats the cycle at X0.4141: cumulative radial depth 0.0422 in, 0.0027 in this pass. |
N130 X0.4090 (PASS 9) | Repeats the cycle at X0.4090: cumulative radial depth 0.0448 in, 0.0026 in this pass. |
N140 X0.4041 (PASS 10, FINAL DEPTH) | Repeats the cycle at X0.4041: cumulative radial depth 0.0472 in, 0.0024 in this pass. |
N150 X0.4041 (SPRING PASS) | Same diameter again. Takes off what the tool pushed away on the last pass. |
N160 G00 X1.0 Z1.0 M09 | Rapid clear, which also ends the modal G92 cycle. Coolant off. |
N170 M05 | Spindle stop. |
N180 M30 | End of program and rewind. |
% | Tape end. |
Where the numbers come from
Thread depth and final diameter
h = 0.61343 x P = 0.61343 x 0.076923 = 0.047187 in; X final = D - 2 x h = 0.4985 - 2 x 0.047187 = 0.4041 in
| Symbol | Meaning | Unit |
|---|---|---|
| P | Pitch, 1 / TPI = 1 / 13 (equal to the lead on a single-start thread) | in |
| h | Radial single depth of a 60 degree external thread: 17/24 of the sharp-V height H = 0.86603 x P | in |
| D | Class 2A maximum major diameter: 0.5000 basic minus the 0.0015 allowance (ASME B1.1) | in |
| X final | Diameter of the last pass | in |
Constant-volume infeed
d_n = d_1 x sqrt(n); d_1 = h / sqrt(N) = 0.047187 / sqrt(10) = 0.014922 in; X_n = D - 2 x d_n
| Symbol | Meaning | Unit |
|---|---|---|
| d_n | Cumulative radial depth after pass n | in |
| d_1 | Radial depth of the first pass | in |
| n | Pass number, 1 to N | |
| N | Number of passes, 10 here | |
| X_n | Diameter programmed for pass n | in |
Constant-volume infeed takes about the same chip area on every pass. The cut gets wider as the tool goes deeper, so each pass goes in less than the one before.
| Pass | Radial depth d_n (in) | This pass (in) | X diameter (in) | X diameter (mm) |
|---|---|---|---|---|
| 1 | 0.0149 | 0.0149 | 0.4687 | 11.90 |
| 2 | 0.0211 | 0.0062 | 0.4563 | 11.59 |
| 3 | 0.0258 | 0.0047 | 0.4468 | 11.35 |
| 4 | 0.0298 | 0.0040 | 0.4388 | 11.15 |
| 5 | 0.0334 | 0.0035 | 0.4318 | 10.97 |
| 6 | 0.0366 | 0.0032 | 0.4254 | 10.81 |
| 7 | 0.0395 | 0.0029 | 0.4195 | 10.66 |
| 8 | 0.0422 | 0.0027 | 0.4141 | 10.52 |
| 9 | 0.0448 | 0.0026 | 0.4090 | 10.39 |
| 10 | 0.0472 | 0.0024 | 0.4041 | 10.26 |
Computed from d_n = 0.014922 x sqrt(n) and X_n = 0.4985 - 2 x d_n with unrounded values, then rounded to nearest. The spring pass repeats X0.4041.
Source: Machinery's Handbook (Unified thread depth); infeed formula as shown
Parameter notes
Setup notes for the next shift
- F is the lead, not a feed per minute: F0.076923 for 13 TPI. The table moves 0.076923 in per spindle revolution.
- Axis feed during threading is RPM x lead: 500 x 0.076923 = 38.5 IPM (inches per minute). Keep it below the maximum threading feed in your control's manual.
- S500 is a placeholder. Take the cutting speed from the threading insert maker's data and convert with RPM = (SFM x 12) / (pi x D), where SFM is surface feet per minute. On a light lathe, start low.
- Use G97, constant RPM. Leave spindle override at one setting for every pass. Feed override has no effect during the threading move.
- Start Z at Z0.25, about 3.25 leads ahead of the face, so the Z axis reaches thread feed before the tool touches the part. The control manual gives the formula for this distance; a common rule of thumb is 3 to 4 leads.
- Turn the blank to the 1/2-13 UNC class 2A (external) major diameter limits in ASME B1.1 first. The depth on this page is figured from the 2A maximum major, 0.4985 in.
- G40 is in effect: tool nose radius compensation stays off for threading.
- Z-1.0 ends the threaded length. Without a relief groove, the thread runs out where the tool retracts; a thread pull-out chamfer at the end is set by a control parameter on many Fanuc lathes.
Variations for other controls
- Fanuc mill: G92 sets the work coordinate system. It does not cut a thread. Never run this program on a mill control.
- Fanuc lathe, G-code systems B and C: G92 sets the coordinate system, and the threading cycle is G78 in system B and G21 in system C. Check the G-code system parameter before you run a program written for system A.
- G76 multiple repetitive threading cycle: one block on some older Fanuc lathe controls, two blocks on Series 0i, 16i, 18i and 21i. It works out the passes itself and can feed in along one flank. Shorter program, less control over each pass.
FAQ
What F word do you use for 13 TPI in a G92 cycle?
F is the lead in inches: 1 / 13 = 0.076923 in, so F0.076923. Rounded to F0.0769 the lead is short by 0.000023 in per thread, 0.0003 in over the 13 threads in 1.000 in. Check how many decimal places your control accepts in F.
How deep do you cut a 1/2-13 external thread?
Radial single depth h = 0.61343 x 0.076923 = 0.0472 in. Figured from the class 2A maximum major diameter, 0.5000 - 0.0015 = 0.4985 in, the final X is 0.4985 - 2 x 0.0472 = 0.4041 in on diameter. That is a starting point: check the final pitch and minor diameters against the ASME B1.1 class 2A (external) table for 1/2-13 UNC, with a ring gauge or 3-wire measurement for pitch diameter.
Why does G92 shift coordinates on some controls?
On a Fanuc mill, G92 sets the work coordinate system. On a Fanuc lathe with G-code system A, G92 is the thread cutting cycle. In lathe G-code systems B and C, G92 sets the coordinate system, and the threading cycle is G78 in system B and G21 in system C.
Should you use G92 or G76 for threading on a Fanuc lathe?
G92 cuts one pass per block and feeds straight in on X, so you control every pass depth, as in this example. G76 cuts all the passes from one block on some older controls, or two blocks on Series 0i, 16i, 18i and 21i lathe controls, and can feed in along one flank. Use G76 for shorter programs; use G92 when you want each pass visible.
Why use G97 and not constant surface speed for threading?
Each pass starts on the spindle one-revolution signal, and the Z axis lag at the start depends on spindle speed. With G96 the RPM changes as X changes from pass to pass, so the passes can land out of step. G97 holds the RPM constant.
How many passes does the example take?
10 passes plus a spring pass, with constant-volume infeed d_n = d_1 x sqrt(n). The first pass is 0.0149 in radial and the last is 0.0024 in. Fewer, deeper passes suit rigid machines; a light lathe needs more passes.
Last updated