MFG-CNC14-04 · Lesson 7 · 16 clock hours · demo
Lathe G-Code: Turning, Facing, Threading, and Grooving
Objective. Students write G-code programs for a CNC lathe that produce a turned profile using G00, G01, G70/G71 stock-removal and finish cycles, a single-point thread (G76), and an external groove.
⚠ Pending professional review
This lesson, its worked examples and its practice questions has not yet been verified by a licensed engineer or certified journey-level tradesperson or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.
VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.
Lathe G-Code: Turning, Facing, Threading, and Grooving
Why Lathe G-Code Is Different from Mill G-Code
A CNC lathe rotates the workpiece while stationary tools move in two axes: Z (along the spindle centerline) and X (toward or away from the centerline). Because the part is round, X values are usually programmed as diameters, not radii, unless you switch to radius mode. Every Haas lathe control defaults to diameter programming, so X2.000 means the tool is at a 2.000 in. diameter, which is 1.000 in. from the centerline. Confirm your control's setting before you run any program.
Safety Before You Touch the Machine
Before loading a workpiece or setting up tooling, follow lockout/tagout (LOTO) procedures whenever you need to reach into the work envelope for a non-running task such as jaw changes or manual tool installation. Wear safety glasses with side shields at all times on the shop floor. Confirm the chuck jaws grip the stock with enough engagement—a rule of thumb is at least two-thirds of the jaw face in contact. Never stand directly in line with the spindle axis while the chuck is spinning. Keep the chip guard or enclosure door closed during any automatic cycle. When running a new program for the first time, use single-block mode and a feedrate override at 0–25 % so you can stop the cycle before a crash.
Facing and Rapid Positioning: G00 and G01
A facing cut removes material from the face of the stock to establish a clean, flat reference surface perpendicular to the spindle.
- G00 — Rapid traverse; moves the tool at maximum machine speed. Use only for positioning, never for cutting.
- G01 — Linear feed; moves at a programmer-specified feedrate (F word, in inches per minute or inches per revolution).
A typical facing block:
```
G00 X2.200 Z0.1; (rapid to just outside stock diameter, 0.1 in. clear of face)
G01 Z0.0 F0.012; (feed to face surface)
G00 X-0.05; (rapid across face to center; slight negative X cleans center burr)
G00 Z0.1; (retract)
```
Stock-Removal Cycle G71 and Finish Cycle G70
G71 is a canned rough-turning cycle. You define the finished contour in a series of blocks labeled with sequence numbers (N words), then call G71 with parameters that tell the control how much to hog off per pass and how much stock to leave for finishing.
Key G71 parameters (Haas format):
- P — sequence number of the first contour block
- Q — sequence number of the last contour block
- U — diameter stock allowance to leave for finish (positive leaves stock on the OD)
- W — Z-axis stock allowance to leave for finish
- D — depth of cut per rough pass (radius value, no decimal on some controls—check your reference)
- F — roughing feedrate
G70 is the finish pass cycle. It retraces the same P–Q contour blocks at a finer feedrate and removes the U/W allowance left by G71.
Contour blocks between P and Q describe the finished shape: diameters, tapers (G01 with both X and Z words), and radii (G02/G03). The control automatically calculates each rough pass offset.
External Grooving: G75
G75 is the peck-grooving cycle for the X axis. It plunges the grooving tool to a target X diameter in incremental pecks, retracts to clear chips, then advances in Z for multi-groove patterns.
Key G75 parameters:
- X — groove bottom diameter
- Z — Z-end of groove pattern (for multiple grooves)
- P — X peck increment (no decimal, in 0.0001 in. units on many Haas controls—verify)
- Q — Z step between grooves
- F — feedrate
For a single groove, set Z equal to the groove center position and Q to zero.
Single-Point Threading: G76
G76 is a two-block threading cycle that makes multiple passes, each one slightly deeper, until the thread is complete. The tool approaches on an angle (compound-style) to reduce chatter.
G76 Block 1 (cycle settings):
- P — three two-digit values concatenated: number of spring passes, thread runout angle (degrees × 10), thread profile angle (typically 60 for UN threads)
- Q — minimum depth of cut per pass (radius, no decimal, 0.0001 in. units)
- R — finish allowance (radius)
G76 Block 2 (thread geometry):
- X — minor diameter (root diameter for external thread)
- Z — Z end of thread
- I — taper offset; zero (I0.) for a straight thread
- K — thread height (radial depth from major to minor diameter)
- D — first-pass depth of cut (radius, no decimal)
- F — thread lead (= pitch for single-start threads), in inches per revolution
- A — thread profile angle (60 for UN/UNF)
Calculating K and minor diameter:
- For UN threads: K = 0.6495 × pitch (thread height, in inches)
- Minor diameter ≈ Major diameter − (2 × K)
Workflow: Writing the Complete Lathe Program
1. Face the part to Z0 datum.
2. Rough turn with G71; leave 0.010–0.020 in. (diameter) for finishing.
3. Finish turn with G70; use a finer feedrate (0.005–0.008 IPR is typical for a finish pass).
4. Groove with G75; index to the groove position, plunge to depth.
5. Thread with G76; calculate K, D (first-pass depth), and minor diameter before entering values.
Always simulate in CNCSimulator Pro before running on the machine. Verify the profile matches all drawing dimensions. Check that the threading cycle reaches the correct minor diameter and that the tool clears the groove on retract.
Key terms9
Diameter programmingStandard lathe convention where X-axis values represent the full diameter of the workpiece at that point, not the radial distance from the centerline.
G71 (rough-turning cycle)Canned lathe cycle that automatically makes multiple roughing passes along a programmed contour, removing bulk stock while leaving a user-specified allowance for finishing.
G70 (finish cycle)Canned lathe cycle that follows the same P–Q contour defined for G71 and removes the remaining stock allowance in a single finish pass at a finer feedrate.
G75 (peck-grooving cycle)Canned lathe cycle that plunges a grooving tool to a target diameter in incremental pecks, retracting between pecks to clear chips, and stepping in Z for multiple-groove patterns.
G76 (threading cycle)Two-block canned lathe cycle that makes multiple angled infeed passes to cut a single-point thread, with programmer-specified first-pass depth, thread height (K), and lead (F).
Thread height (K)The radial depth of a thread from major diameter to minor diameter; for UN threads, K = 0.6495 × pitch.
Thread lead (F in G76)The axial distance the thread advances in one full revolution of the spindle; equal to the pitch for a single-start thread.
Stock allowance (U/W in G71)Material deliberately left on the part after rough turning—U in the X (diameter) direction, W in the Z direction—to be removed by the G70 finish cycle.
Lockout/tagout (LOTO)OSHA-required energy-control procedure that isolates and de-energizes a machine before any maintenance or setup task where unexpected startup could cause injury.
Worked examples4
1. Calculate the thread height K and the minor diameter for a 1.000-18 UNF external thread to be programmed in G76.
- Identify the pitch. For 18 threads per inch, pitch = 1 ÷ 18 = 0.05556 in.
- Calculate thread height: K = 0.6495 × pitch = 0.6495 × 0.05556 = 0.03608 in. Round to 0.0361 in.
- Calculate minor diameter: Minor dia. = Major dia. − (2 × K) = 1.0000 − (2 × 0.0361) = 1.0000 − 0.0722 = 0.9278 in.
- In the G76 block, enter K as a radius value without a decimal point in 0.0001-in. units if the control requires it: K = 0361. Enter X (minor diameter) = X0.9278. Verify your specific control's format in the Haas lathe reference before running.
Answer: Thread height K ≈ 0.0361 in.; minor diameter ≈ 0.9278 in.
2. A G71 cycle is programmed with U0.020 and a roughing feedrate of 0.015 IPR. The contour finish feedrate in G70 is 0.007 IPR. The raw stock is 2.500 in. diameter and the finished smallest diameter on the part is 1.250 in. How many full rough passes will G71 make if D (depth of cut per pass) is set to 0.100 in. (diameter)?
- Total stock to remove (diameter): 2.500 − 1.250 = 1.250 in. diameter, which is 0.625 in. radially.
- G71 leaves U = 0.020 in. (diameter) = 0.010 in. radially for G70. So the radial depth G71 must remove: 0.625 − 0.010 = 0.615 in.
- D = 0.100 in. diameter per pass = 0.050 in. radially per pass.
- Number of passes = 0.615 ÷ 0.050 = 12.3. The control rounds up, so G71 will make 13 rough passes to clear the material without cutting below the U allowance.
Answer: 13 roughing passes.
3. A G76 threading cycle specifies a first-pass depth D of 0.008 in. (radius). The thread height K is 0.0361 in. If subsequent passes are reduced by the control's infeed algorithm (compound infeed), roughly how many total cutting passes will be needed before the spring passes if the minimum per-pass depth Q is 0.003 in.?
- With compound (angled) infeed the actual chip load per pass decreases as depth increases. A simplified way to estimate total passes uses the formula: number of passes ≈ (K / D_first)² adjusted for the compound angle, but for a quick planning estimate, divide total thread height by an average per-pass depth.
- Average per-pass depth (rough estimate) ≈ (D_first + Q) ÷ 2 = (0.008 + 0.003) ÷ 2 = 0.0055 in.
- Estimated passes = K ÷ average depth = 0.0361 ÷ 0.0055 ≈ 6.6, so approximately 7 cutting passes before spring passes.
- Note: The actual number is determined by the control's built-in algorithm. This calculation is a planning estimate only; always verify in simulation.
Answer: Approximately 7 cutting passes (plus any programmed spring passes) — confirm in simulation.
4. A grooving tool is 0.125 in. wide. The drawing calls for a groove centered at Z−2.500 with a groove bottom diameter of 1.500 in. The current OD at that location is 2.000 in. Calculate the X and Z values to enter in the G75 block.
- X target = groove bottom diameter = 1.500 in. In diameter programming, enter X1.5000.
- Z position = groove center = Z−2.500. Enter Z−2.5000.
- Since this is a single groove (not a pattern), Q = 0 (no Z step between grooves).
- Verify that the tool width matches the drawing groove width before running. If the groove is wider than the tool, multiple Z-offset passes are needed, stepping over by less than the tool width each time.
Answer: G75 X1.5000 Z−2.5000 P(peck value per control) Q0 F(feedrate);
The math in this lesson2
Learners compute groove depth and roughing allowances from diameters and stock-to-leave.
7.NS.1A-SSE.1
In class: Instructor demonstrates G71 rough-turning cycle with live edits, then students copy the program into CNCSimulator Pro Lathe module, alter the stock dimensions, and re-run to observe how the cycle adapts. · From a turned-part drawing with a shoulder, taper, and external thread, students write the complete lathe program in stages—facing, rough turn G71, finish turn G70, groove G75, thread G76—checking each stage in simulation before adding the next. · Thread-parameter calculation exercise: given thread pitch, major diameter, and depth-of-cut per pass, students calculate G76 Q (first-pass depth), I (taper), and K (thread height) values before entering them into the simulator.
Materials: CNCSimulator Pro Lathe module; turned-part drawing; Haas lathe G-code reference; thread-parameter calculation worksheet; Smid Chapters 14–16
Check: Simulated lathe program must run to completion without alarm; finished profile must match all drawing dimensions within 0.005 in. in simulation; thread parameters verified mathematically by instructor.
Practice check8
Answer each question, then check it. Nothing is recorded; this is your own practice.
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.