Lathe Programming
Typical Lathe Program Process
For a part with internal boring and external grooves and/or threading
Rough Facing/Rough Turn OD
Drilling for boring tool
Rough Bore
Finish Face/Finish Turn OD
OD Grooving
External Threading
Parting
Lathe Programming Workbook
Startup
G28 U0. W0. (First line: Always go home in case last program stopped unexpectedly such as hitting e-stop, power failure, etc.)
G20 (Inches)
G18 (Sets X-Z plans for all G02/G03 moves)
G40 G54 G80 G99 (SAFETY BLOCK: CANCEL TNR, CANCEL CANNED CYCLE, FEED PER REV)
G50 S3500 (sets maximum rpm)
Tool Change
*see note above about G28 U0. W0.
T0101 (M06 NOT NEEDED, TOOL #1 CALLED WITH ITS OFFSET 01)
Spindle
G97 S500 M03 (Direct rpm input mode - sets spindle speed at 500 rpm and turns on spindle)
G96 S500 (uses constant surface speed)
G99 sets Feed per Rev mode
M03 spindle on forward (clockwise as viewed looking from the chuck towards the tailstock. If you're standing at the operator panel position and looking at the spindle, it will appear counter-clockwise)
M05 Spindle Stop
Going Home
G28 U0. (Home along X-axis)
G28 W0. (Home along Z-Axis)
G02/G03 Circular Interpolation
On a slant-bed lathe G02/G03 may behave reversed from what you may expect. If you notice that we are looking at the underside of the cutting tool what standing at the operator position. You have to visualize the tool path from the back side on slant bed lathes with the chuck on the right not to the left.
G41/42/40 Tool Nose Compensation
Activating and shutting off requires a linear move or you will get a 613 error
G42 G00 X... Z... (G42 for external turning, G41 internal turning/boring)
G40 G00 X... Z...
G70 Finishing cycle
This command is used after the following command, G71, to finish the part. It will make use of the same P & Q code blocks describing the part profile.
P - Starting Block number of path to rough
Q - Ending Block number of path to rough
F - Feed rate
example: G70 P100 Q200 F0.004
G71 Roughing Stock Removal Cycle
* D - Depth of cut for each pass of stock removal, positive radius (Only use when using one block G71 notation)
* F - Feedrate in inches (mm) per minute ( G98) or per revolution ( G99) to use throughout G71 PQ block
P - Starting Block number of path to rough
Q - Ending Block number of path to rough
* U - X-axis size and direction of G71 finish allowance, diameter
* W - Z-axis size and direction of G71 finish allowance
* indicates optional
Note: G18 Z-X plane must be active for using G02/G03
Rules for External Profiling:
Make sure the P & Q block lines numbers are unique!
Starting point Z and Point A Z must be same value.
Starting point X must be be larger than profile X values.
Changing directions only permitted along one axis
Example:
180 G96 S500 (Constant Surface Speed)190 X2.0 Z0. (Start)200 G71 P210 Q240 U0.010 W0.005 D1000 F0.010 (D1000 sets depth of cut to 0.100" as in 1000/10,000)205 G00 X1. (A)210 G01 Z-0.50 (B)...235 G01 X1.90240 G00 X2.0 (END)250 G00 Z0.1 M05260 G28 U0.270 G28 W0.280 M01This is typically followed by a G70 for finish stock removal using the same P & Q blocks defining the profile
G96 S1000 (Faster CSS for finish)
G70 P210 Q240 F0.005 (Lower feed rate for finish pass)
Feed 0.003" per rev
Drilling
G83 Peck Drilling
See Drilling under Feed & Speeds
Video: Haas Tip of the Day - Drilling on a Haas Lathe
Threading
*no TNR used when threading
G76 Threading Cycle OD/ID Multiple Pass
X absolute thread finish point diameter
OD Threads -> Minor Diam
ID Threads -> Major Diam
Z Absolute distance for thread end
D First pass depth of cut (D=K/sqrt(N)) 9 passes
K Thread height, radius value (major diam - minor diam)/2
F feed rate = thread pitch = 1/TPI
*No G96 CSS for threading! Use G97 Feed Per Rev approximately 125 rpm * TPI
G92 Threading Cycle (Group 01) AKA "Ghost Pass" or "Spring Cut" used for cleaning up thread [MODAL]
G92 X0.523 Z-0.8 F0.0909 M24X0.520X0.515X0.5135 (final pass @ root diam)