← How-Tos
cnc 1 hr ago ◯ 4 min read

CNC Lathe G-Code Cycles for Makers: Threading, Roughing, and Programming Your First Turned Part

cnc latheg76g71threading cyclelinuxcncgrblmach3mach4turninghowto

This site's guide to converting a mini metal lathe to CNC covers the hardware side: ballscrews, steppers, and wiring a controller in. What it doesn't cover — and what trips up almost everyone the first time they try to actually cut a thread on their newly-converted lathe — is that the G-code world of a CNC lathe is genuinely different from the router and mill G-code most makers already know. A router cuts a 2D or 2.5D path; a lathe cuts a profile that's being spun past a stationary tool, and a handful of canned cycles exist specifically to handle the repetitive, precision-critical operations that come with that: threading and stock-roughing above everything else.

The Controller Matters More Than It Does for a Router

This is the single most important thing to get right before you write a line of lathe G-code: GRBL does not support lathe canned cycles. GRBL was designed for routers and mills and has no G76 (threading) or G71 (rough turning) implementation, no lathe-specific diameter/radius mode switching (G07/G08 or similar), and no native concept of constant surface speed. If your lathe conversion is running GRBL, you will be hand-coding every threading pass as a series of individual G1 moves — workable for a one-off part, miserable for anything with real thread engagement length. This is exactly why this site's lathe conversion guide pairs GRBL with LinuxCNC as an alternative, and it's the reason most serious hobby CNC lathe builds end up on LinuxCNC or a commercial lathe-aware controller (Mach3/Mach4 with a lathe configuration, or a Centroid/Tormach-style controller) rather than staying on GRBL once threading enters the picture.

ControllerG76 ThreadingG71 Rough TurningNotes GRBLNoNoFine for simple turning/facing via manual G1 moves; not realistic for threading LinuxCNCYes (its own G76 dialect — parameters differ from Fanuc-style, documented in the LinuxCNC lathe section)Partial/limited — many LinuxCNC users rough-turn with simple repeated G1 passes or a sub-program rather than a true G71The most common real choice for hobby CNC lathe conversions; free and well documented Mach3/Mach4 (lathe config)YesYesCloser to industrial Fanuc-style canned cycle syntax; commercial license cost

G76: The Threading Cycle

G76 automates what would otherwise be dozens of manually-coded passes: it takes a single block of parameters — thread pitch, final depth, number of springpasses, taper angle for things like pipe threads, and infeed angle — and generates the full multi-pass threading sequence itself, including the compound infeed angle (typically 29.5° for a standard 60° thread form) that keeps the cutting load on one flank of the tool rather than both, extending tool life and improving finish. The practical workflow:

  1. Rough-turn the thread's major diameter to size first using simple G1 passes or your controller's rough-turning cycle
  2. Confirm your threading tool is ground or indexed to the correct included angle for your thread form (60° for standard metric/UN threads) and is set exactly on center height — off-center threading tools produce a distorted thread form that a tap or nut will not fit correctly
  3. Calculate thread depth from standard tables (external 60° thread depth is approximately 0.613 × pitch for a basic triangular form, though always check against the specific thread spec you're cutting rather than relying on memory)
  4. Program the G76 block with your start point, end point, pitch, and depth parameters per your controller's specific syntax — LinuxCNC's parameter layout is not identical to a Fanuc-style G76 block, so follow your controller's documentation exactly rather than a generic internet example
  5. Run the first pass in a dry run or at reduced spindle speed and verify the tool path clears the chuck and tailstock before committing to a full-speed cut

G71: Stock Removal Roughing

G71 (where supported) handles the repetitive job of hogging a rough blank down close to final profile in a series of depth-of-cut passes, following whatever finish profile you define in a subsequent block, leaving a small finishing allowance for a final clean pass. On controllers without a true G71 (LinuxCNC's support here is limited), the practical substitute is a simple sub-program loop: repeat a G1 facing/turning pass at successively deeper radial positions, stepping toward your final diameter, then run one clean finishing pass at the exact target profile. It's less elegant than a single canned-cycle block but produces an identical result.

Safety Notes Specific to Lathe Work

A CNC lathe conversion carries real risk that a converted router or mill doesn't: workpieces are spinning, often at several hundred to a few thousand RPM, with substantial stored rotational energy. Always confirm chuck jaws are fully seated and the workpiece is gripped on enough length before running any program, verify your G76/G71 program's rapid moves clear the chuck body and jaws (a crash into spinning jaws at rapid speed is far more violent than an equivalent router crash into a vise), and never reach toward a running spindle to clear chips or adjust anything. Dry-run every new threading program in the air, away from the material, before committing to a live cut.

Once you've internalized that lathe G-code lives by different rules than router G-code — different canned cycles, different controller support, different physics at the cutting edge — threading on a hobby CNC lathe stops being a mystery and becomes just another repeatable setup, the same way bed-leveling or tool-length-offset became routine on your other machines.