Machining Technology at HCC

There is no standardized format for writing a CNC program that is compatible with all machine control models. Each MCU manufacturer has developed its own unique programming format. Each one has minor differences, but the principles contained in the context of a program are the same among them all. These programs that I have written for school projects will relate most closely to Fanuc-type controllers specifically Haas, Doosan, Mori Seiki, and Romi; however, the principles may be applied to any manufacturer's programming format (see the specific machine's programming manual).

Free download from Haas:

    1. Haas Lathe Programming Workbook
    2. Haas CNC Lathe Operator's Manual
    3. Live Tool for Haas Lathe

Free download from Doosan:

    1. Doosan NC Programming Manual for Turning Centers Fanuc 30 Series Controls
    2. Doosan Programming Manual Fanuc Controls
    3. DOOSAN CNC Turning Center Programming Manual
    4. Fanuc Manual Guide i Operator's Manual

Free download from Mori Seiki:

    1. Mori Seiki Operating Manual ZL-153 ZL-253SMC
    2. Mori Seiki Programming Manual

Free download from Romi:

    1. ROMI G GL GLM Fanuc 0I-TD Programming Operation Manual

I have several projects per semester. By the end of the semester, I have created many programs and machined the entire things and that really is inspirational. Here are some of the projects I have done in the shop.

Rough & Finish

CNC Lathe Project 1

Lathe Simulator

Lathe Simulator

The G71 Roughing cycle will rough out material on a part defining the finished part shap. The G70 Finishing cycle can be used to finish cut paths that are defined and roughed out with stock removal cycles G71. After execution of the Q block, a rapid (G00) is executed returning the machine to the start position that was saved earlier during G70 initialization. The program then returns to the block following the G70 call.

Groove & Thread

Turning Operation

Turning Operation

Lathe Simulator

The G75 canned cycle can be used for grooving an outside diameter with a chip break. The G76 canned cycle can be used for threading both straight or tappered (pipe) threads.

For Haas CNC Lathe Machines

%
O00021
(PROGRAMMER: FRANCIS NGUYEN)
(VERSION: 2020)
(STOCK 2.5" O.D. ALUMINUM)
(T0101 O.D. ROUGH TOOL x 1/32 TNR)
(T0202 O.D. FINISH TOOL x 1/64 TNR)
(T0303 GROOVING TOOL x 0.118")
(T0404 O.D. THREADING TOOL x 0.19")
(T0505 CENTER DRILL #2)

G53 G00 X0.0 Z0.0 T0 (SENDING HOME FOR A TOOL CHANGE)
T0101 (TOOL #1 AND OFFSET #1)
G50 S2000 (SPINDLE SPEED CLAMP AT 2000 RPM)
G97 S1200 M03 (CANCEL CSS, 1200 RPM, SPINDLE ON FORWARD)
G55 G00 X2.6 Z0.1 M08 (RAPID X2.6, Z0.1 TO START POINT, COOLANT ON)
G96 S600 (CSS ON, AT 600 SURFACE SPEED)
G01 Z0.0 F0.01
X-0.063 (FEED DOWN X-0.063 TO FACE END OF PART)
G00 X2.6 Z0.1 (RAPID TO X2.6, Z0.1 START POINT ABOVE PART)
G97 S1200 M09 (CANCEL CSS, 1200 RPM, COOLANT OFF)
G28 U0. (SENDING HOME FOR A TOOL CHANGE)
G00 Z5.0
M05 (SPINDLE STOP)
M01 (OPTIONAL STOP COMMAND)

(CENTER DRILL USING LIVE TOOL)
0T505 (Tool 5 Offset 5)
G98 (Feed per minute)
M154 (Engage C-Axis)
G97 M133 P1500 (Live Tool Drive Forward/Live Tool Spindle Speed)
G55 G00 X0. C0. Y0. Z0.25 M08 (Rapid to Initial Start Point)

G81 Z-0.125 R-0.1 F1.0 (G81 Drilling Cycle)
G80 G00 Z0.25 M09

M155 (Disengage C-Axis)
M135 (Live Tool Drive Stop)
G28 H0 (Return C-Axis to Home Position)
G00 X5. Y0. Z.1
G99 (Feed per revolution)
G28 U0. (SENDING HOME FOR A TOOL CHANGE)
G00 Z5.0
M01

(ROUGH PART PROFILE USING TAILSTOCK)
M21 (TAILSTOCK ADVANCE)
T0101 (TOOL #1 AND OFFSET #1)
G50 S2000 (SPINDLE SPEED CLAMP AT 2000 RPM)
G97 S1200 M03 (CANCEL CSS, 1200 RPM, SPINDLE ON)
G54 G00 X2.6 Z0.1 M08 (RAPID TO X2.6, Z0.1 START POINT ABOVE PART)
G96 S600 (TURN ON CSS TO 600)

(D - DEPTH OF ROUGHING PASSES)
(P - STARTING BLOCK NUMBER OF PATH TO ROUGH)
(Q - ENDING BLOCK NUMBER OF PATH TO ROUGH)
(U - AMOUNT OF MATERIAL TO BE LEFT ON DIA)
(W - AMOUNT OF MATERIAL TO BE LEFT ON FACES)

G71 P100 Q200 U0.01 W0.005 D0.05 F0.01 (G71 ROUGH CYCLE)
N100 G42 G00 X0.72 (PNN START #100, RAPID X0.72, CUTTER COMP. ON)
G01 Z0.0 F0.005 (G71 PART GEOMETRY)
X0.82 (POINT 1)
X1. Z-0.09 (POINT 2)
Z-1.5 (POINT 3)
X1.45 (POINT 4)
Z-3. (POINT 5)
X1.7 (POINT 6)
Z-3.5 (POINT 7)
X1.95 (POINT 8)
Z-4.425 (POINT 9 EXTEND 0.125)
N200 G40 G00 X2.6 (QNN END #200, CANCEL CUTTER COMP., FEED X TO 2.6)
G97 S1200 M09 (CANCEL CSS, 1200 RPM, COOLANT OFF)
G28 U0. (SENDING HOME FOR A TOOL CHANGE)
G00 Z5.0
M01 (OPTIONAL STOP COMMAND)

(FINISH PART PROFILE)
T0202 (TOOL #2 AND OFFSET #2)
G50 S2000 (SPINDLE SPEED CLAMP AT 2000 RPM)
G97 S1800 M03 (CANCEL CSS, 1800 RPM, SPINDLE ON)
G54 G00 X2.6 Z0.1 M08 (RAPID TO X2.6, Z0.1 START POINT ABOVE PART)
G96 S900 (TURN ON CSS TO 900)
Z0.0 (POSITION TO Z0.0 END OF PART)
G01 X-0.031 F0.001 (FEED DOWN FACE OF PART)
G00 X2.6 Z0.1 (RAPID TO X2.6, Z0.1 START POINT ABOVE PART)
G70 P100 Q200 (DEFINE A G70 FINISH PASS OF PART GEOMETRY)
G97 S1800 M09 (CANCEL CSS, BACK TO RPM MODE)
G28 U0. (SENDING HOME FOR A TOOL CHANGE)
G00 Z5.0
M01 (OPTIONAL STOP COMMAND)

(GROOVING CYCLE)
T0303
G97 S500 M03
G54 G00 X1.6 Z0.1 M08
Z-1.418 (1.30 + 0.118 GROOVING TOOL = 1.418)

(I - X AXIS PECKING DEPTH INCREMENT, RADIUS VALUE)
(K - Z AXIS SHIFT INCREMENT BETWEEN PECKING CYCLES)

G75 X0.750 Z-1.5 I0.05 K0.1 F0.005
G00 X1.8
Z-2.918 (2.800 + 0.118 GROOVING TOOL = 2.918)
G75 X1.250 Z-3.0 I0.05 K0.1 F0.005
G00 X2.6 M09

G28 U0. (SENDING HOME FOR A TOOL CHANGE)
G00 Z5.0
M01

(THREADING CYCLE)
T0404
G97 S500 M03

(SINGLE DEPTH = 0.61343 / TPI)
(SINGLE DEPTH = 0.61343 / 8 = 0.0767)
(X START POINT = MAJOR DIA. + 2 X SINGLE DEPTH)
(X START POINT = 0.9905 + 2 X 0.0767 = 1.1439)
(PITCH = 1/ TPI)
(PITCH = 1/ 8 = 0.125)
(Z START POINT = 4 X PITCH)
(Z START POINT = 4 X 0.125 = 0.5)

G54 G00 X1.1439 Z0.6 M08 (X START POINT)
Z0.5 M23 (Z START POINT, CHAMFER AT END OF THREAD ON)

(K - THREAD HEIGHT, RADIUS VALUE)
(D - FIRST PASS CUTTING DEPTH)
(F - 1/TPI)
(X - MIN MINOR DIAMETER)
(Z - THREAD LENGHT)

G76 X0.8206 Z-1.3 K0.0767 D0.0192 F0.125 (16 PASSES)

G00 X2.6 M09
G28 U0. (SENDING HOME FOR A TOOL CHANGE)
G00 Z5.0
M01

(PARTING PART)
M22 (TAILSTOCK RETRACT)
T0303
G97 S500 M03
G54 G00 X2.6 Z-4.418 M08 (4.30 + 0.118 PARTING TOOL = 4.418)
G01 X-.03 F0.001 M36 (PARTS CATCHER ON)
G00 Z0.1 M09
M37 (PARTS CATCHER OFF)
G28 U0. (SENDING HOME FOR A TOOL CHANGE)
G00 Z5.0
M05 (SPINDLE STOP)
M30 (END OF PROGRAM AND RESET)
%

CNC Lathe Machine

For Doosan CNC Lathe Machines

%
O0001
(PROGRAMMER: FRANCIS NGUYEN)
(VERSION: 2021)
(STOCK 2.5" O.D. ALUMINUM)
(T0101 O.D. ROUGH TOOL x 1/32 TNR)
(T0202 O.D. FINISH TOOL x 1/64 TNR)
(T0303 GROOVING TOOL x 0.118")
(T0404 O.D. THREADING TOOL)
(T0505 PARTING TOOL x 0.118")
(T0606 STOP BAR)
(T0707 CENTER DRILL #2)

#100 = 4.300 (PART LENGTH)
#101 = 2.500 (STOCK DIA)
#102 = #101 + 0.1(STOCK DIA + 0.1)
#103 = #100 + 0.118 (PART LENGTH CUTOFF)
#5222 = #100 (G54)
#5242 = 0.5 (G55)

(BAR STOP)
T0606
G55 G00 Z0.02 X0.0
M00

Z0.1
G28 U0.0
Z5.0
T0600
M01

(DNMG 432 - RP5 WPP10S)
T0101 (TOOL #1 AND OFFSET #1)
G50 S2000 (SPINDLE SPEED CLAMP AT 2000 RPM)
G97 S1200 M03 (CANCEL CSS, 1200 RPM, SPINDLE ON FORWARD)
G55 G00 X#102 Z0.1 M08 (RAPID X2.6, Z0.1 TO START POINT, COOLANT ON)
G96 S600 P11 (CSS ON, AT 600 SURFACE SPEED, MAIN SPINDLE)
G01 Z0.0 F0.01
X-0.063 (FEED DOWN X-0.063 TO FACE END OF PART)
G00 X#102 Z0.1 (RAPID TO X2.6, Z0.1 START POINT ABOVE PART)
G97 S1200 M09 (CANCEL CSS, 1200 RPM, COOLANT OFF)
G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0
M05 P11 (SPINDLE STOP)
T0100
M01 (OPTIONAL STOP COMMAND)

(CENTER DRILL USING LIVE TOOL)
T0707 (Tool 7 Offset 7)
G98 (Feed per minute)
M35 (SPINDLE STOP C-Axis)
G97 S1500 M03 P12(Live Tool Spindle Speed/Live Tool Drive Forward)
G55 G00 X0. C0. Z0.25 M08 (Rapid to Initial Start Point)

G83 Z-0.125 R-0.1 F1.0 (G83 Drilling Cycle)
G80 G00 Z0.25 M09

M05 P12 (LIVE TOOL SPINDLE STOP)
M34 (SPINDLE REVERSE C-Axis)
G28 H0 (Return C-Axis to Home Position)
G00 X5. Z1.
G99 (Feed per revolution)
G28 U0.
Z5.0
T0700
M01

(BAR STOP)
T0606
G54 G00 Z0.0 X0.0
M00

Z0.1
G28 U0.0
Z5.0
T0600
M01

(ROUGH PART PROFILE USING TAILSTOCK)
M78 (QUILL ADVANCE)
T0101 (TOOL #1 AND OFFSET #1)
G50 S2000 (SPINDLE SPEED CLAMP AT 2000 RPM)
G97 S1200 M03 (CANCEL CSS, 1200 RPM, SPINDLE ON)
G54 G00 X2.6 Z0.1 M08 (RAPID TO X2.6, Z0.1 START POINT ABOVE PART)
G96 S600 P11 (TURN ON CSS TO 600)

(U - SETS THE DEPTH OF THE ROUGHING PASSES)
(R - SETS THE DISTANCE THE TOOL WILL RETRACT FROM EACH ROUGHING PASS)
(P - STARTING BLOCK NUMBER OF PATH TO ROUGH)
(Q - ENDING BLOCK NUMBER OF PATH TO ROUGH)
(U - AMOUNT OF MATERIAL TO BE LEFT ON DIA)
(W - AMOUNT OF MATERIAL TO BE LEFT ON FACES)
(TOOL NOSE RADIUS COMPENSATION CANNOT BE APPLIED TO G71, G72, G73, G74, G75, G76, OR G78 FOR DOOSAN)

G71 U0.050 R0.050
G71 P100 Q200 U0.010 W0.005 F0.010
N100 G42 G00 X0.72 (PNN START #100, CUTTER COMP. ON FOR G70, RAPID X0.72)
G01 Z0.0 F0.005 (G71 PART GEOMETRY)
X0.82 (POINT 1)
X1. Z-0.09 (POINT 2)
Z-1.5 (POINT 3)
X1.45 (POINT 4)
Z-3. (POINT 5)
X1.7 (POINT 6)
Z-3.5 (POINT 7)
X1.95 (POINT 8)
Z-#103 (POINT 9)
N200 G40 G00 X#102 (QNN END #200, CANCEL CUTTER COMP. FOR G70, FEED X TO 2.6)
G97 S1200 M09 (CANCEL CSS, 1200 RPM, COOLANT OFF)
G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0
T0100
M01 (OPTIONAL STOP COMMAND)

(FINISH PART PROFILE)
(SET R IN TOOL GEOM TO 0.0156)
(DNMG 431 MP3 WPP10S)
T0202 (TOOL #2 AND OFFSET #2)
G50 S2000 (SPINDLE SPEED CLAMP AT 2000 RPM)
G97 S1800 M03 (CANCEL CSS, 1800 RPM, SPINDLE ON)
G54 G00 X#102 Z0.1 M08 (RAPID TO X2.6, Z0.1 START POINT ABOVE PART)
G96 S900 P11 (TURN ON CSS TO 900, MAIN SPINDLE)
Z0.0 (POSITION TO Z0.0 END OF PART)
G01 X-0.031 F0.001 (FEED DOWN FACE OF PART)
G00 X#102 Z0.1 (RAPID TO X2.6, Z0.1 START POINT ABOVE PART)
G70 P100 Q200 (DEFINE A G70 FINISH PASS OF PART GEOMETRY)
G97 S1800 M09 (CANCEL CSS, BACK TO RPM MODE)
G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0
T0200
M01 (OPTIONAL STOP COMMAND)

(GROOVING CYCLE)
T0303
G97 S500 M03 P11
G54 G00 X1.6 Z0.1 M08
Z-1.418 (1.30 + 0.118 GROOVING TOOL = 1.418)

(R - RETRACTION AMOUNT)
(P - X AXIS PECKING DEPTH INCREMENT, RADIUS VALUE)
(Q - Z AXIS SHIFT INCREMENT BETWEEN PECKING CYCLES)

G75 R0.01
G75 X0.750 Z-1.5 P0500 Q1000 F0.0005
G00 X1.8
Z-2.918 (2.800 + 0.118 GROOVING TOOL = 2.918)
G75 X1.250 Z-3.0 P0500 Q1000 F0.0005
G00 X#102 M09

G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0
T0300
M01 (OPTIONAL STOP COMMAND)

(THREADING CYCLE)
T0404
G97 S500 M03 P11 (MAIN SPINDLE)

(SINGLE DEPTH = 0.61343 / TPI)
(SINGLE DEPTH = 0.61343 / 8 = 0.0767)
(X START POINT = MAJOR DIA. + 2 X SINGLE DEPTH)
(X START POINT = 0.9905 + 2 X 0.0767 = 1.1439)
(PITCH = 1/ TPI)
(PITCH = 1/ 8 = 0.125)
(Z START POINT = 4 X PITCH)
(Z START POINT = 4 X 0.125 = 0.5)

G54 G00 X1.1439 Z0.6 M08 (X START POINT)
Z0.5 (Z START POINT)

(P - SETS THE NUMBER OF SPRING PASSES)
(THE FIRST NUMERICAL VALUE CONTROLS HOW QUICKLY THE TOOL RETRACTS.)
(THE SECOND NUMERICAL VALUE CONTROLS THE TOOL INFEED ANGLE SUCH AS: 80°, 60°, 55°, 30°, 29° or 0° )
(Q - SETS THE MINIMUM CUT DEPTH)
(R - SETS THE DEPTH OF THE FINAL PATH)

(X - MIN MINOR DIAMETER)
(Z - THREAD LENGHT)
(P - SINGLE DEPTH, THREAD HEIGHT, RADIUS VALUE)
(Height of the thread = (Major diameter - minor diameter) / 2)
(Q - FIRST PASS CUTTING DEPTH)
(R - DIFFERENCE OF THREAD RADIUS)
(If R = 0, ordinary straight thread cutting can be made.)
(R-: Taper thread to X+)
(R+: Taper thread to X-)
(F - 1/TPI)

G76 P010060 Q0015 R0.0005
G76 X0.8206 Z-1.3 R0.0 P0767 Q0192 F0.125

G00 X#102 M09
G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0
T0400
M01

M79 (QUILL RETRACT)
M54 (PART COUNT)
(0.118 CUT OFF)
T0505
G97 S500 M03 P11 (MAIN SPINDLE)
G54 G00 X#102 Z-#103 M08 (4.30 + 0.118 PARTING TOOL = 4.418)
G01 X-0.03 F0.001 M10 (PARTS CATCHER RECEIVE ADVANCE)
G00 Z0.1 M09
G28 U0.0
Z5.0 M11 (PARTS CATCHER RECEIVE RETURN)
M05 (SPINDLE STOP)
T0500
M30

%

For Mori Seiki CNC Lathe Machines

%
O0001
(PROGRAMMER: FRANCIS NGUYEN)
(VERSION: 2022)
(STOCK 2.5" O.D. ALUMINUM)
(T0101 O.D. ROUGH TOOL x 1/32 TNR)
(T0202 O.D. FINISH TOOL x 1/64 TNR)
(T0303 GROOVING TOOL x 0.118")
(T0404 O.D. THREADING TOOL)
(T0505 PARTING TOOL x 0.118")
(T0606 STOP BAR)
(T0707 CENTER DRILL #2)

(BAR STOP)
T0606
G55 G00 Z0.02 X0.0
M00

Z0.1
G28 U0.0
Z5.0
M01

T0101 (TOOL #1 AND OFFSET #1)
G50 S2000 (SPINDLE SPEED CLAMP AT 2000 RPM)
G55 G00 X2.6 Z0.1 M08 (RAPID X2.6, Z0.1 TO START POINT, COOLANT ON)
G96 S600 (CSS ON, AT 600 SURFACE SPEED)
G01 Z0.0 F0.01
X-0.063 (FEED DOWN X-0.063 TO FACE END OF PART)
G00 X2.6 Z0.1 (RAPID TO X2.6, Z0.1 START POINT ABOVE PART)
G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0
M05 (SPINDLE STOP)
M01 (OPTIONAL STOP COMMAND)

(CENTER DRILL USING LIVE TOOL)
T0707 (Selecting the Tool 7)
G98 (Feed per minute)
M45 (Connecting the spindle as the C-Axis)
G28 H0 (Return the C-Axis to the machine zero point)
G97 S1500 M13 (Starting the rotary tool spindle in the normal direction at 1500)
G55 G00 X0. C0. Z0.25 M08 (Rapid to Initial Start Point)

G83 Z-0.125 R-0.1 F1.0 (G83 Drilling Cycle)
G80 G00 Z0.25 M05 (Stopping the rotary tool spindle)

M46 (Canceling the C-Axis connection)
G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0 M09
G99 (Feed per revolution)
M01

(BAR STOP)
T0606
G54 G00 Z0.0 X0.0
M00

Z0.1
G28 U0.0
Z5.0
M01

(ROUGH PART PROFILE USING TAILSTOCK)
M25 (TAILSTOCK SPINDLE IN)
T0101 (TOOL #1 AND OFFSET #1)
G50 S2000 (SPINDLE SPEED CLAMP AT 2000 RPM)
G54 G00 X2.6 Z0.1 M08 (RAPID TO X2.6, Z0.1 START POINT ABOVE PART)
G96 S600 (TURN ON CSS TO 600)

(U - SETS THE DEPTH OF THE ROUGHING PASSES)
(R - SETS THE DISTANCE THE TOOL WILL RETRACT FROM EACH ROUGHING PASS)
(P - STARTING BLOCK NUMBER OF PATH TO ROUGH)
(Q - ENDING BLOCK NUMBER OF PATH TO ROUGH)
(U - AMOUNT OF MATERIAL TO BE LEFT ON DIA)
(W - AMOUNT OF MATERIAL TO BE LEFT ON FACES)

G71 U0.050 R0.050
G71 P100 Q200 U0.010 W0.005 F0.010
N100 G42 G00 X0.72 (PNN START #100, CUTTER COMP. ON FOR G70, RAPID X0.72)
G01 Z0.0 F0.005 (G71 PART GEOMETRY)
X0.82 (POINT 1)
X1. Z-0.09 (POINT 2)
Z-1.5 (POINT 3)
X1.45 (POINT 4)
Z-3. (POINT 5)
X1.7 (POINT 6)
Z-3.5 (POINT 7)
X1.95 (POINT 8)
Z-4.425 (POINT 9)
N200 G40 G00 X2.6 (QNN END #200, CANCEL CUTTER COMP. FOR G70, FEED X TO 2.6)
G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0
M01 (OPTIONAL STOP COMMAND)

(FINISH PART PROFILE)
(SET R IN TOOL GEOM TO 0.0156)
(DNMG 431 MP3 WPP10S)
T0202 (TOOL #2 AND OFFSET #2)
G50 S2000 (SPINDLE SPEED CLAMP AT 2000 RPM)
G54 G00 X2.6 Z0.1 M08 (RAPID TO X2.6, Z0.1 START POINT ABOVE PART)
G96 S900 (TURN ON CSS TO 900)
Z0.0 (POSITION TO Z0.0 END OF PART)
G01 X-0.031 F0.001 (FEED DOWN FACE OF PART)
G00 X2.6 Z0.1 (RAPID TO X2.6, Z0.1 START POINT ABOVE PART)
G70 P100 Q200 (DEFINE A G70 FINISH PASS OF PART GEOMETRY)
G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0
M01 (OPTIONAL STOP COMMAND)

(GROOVING CYCLE)
T0303
G97 S500 M03
G54 G00 X1.6 Z0.1 M08
Z-1.418 (1.30 + 0.118 GROOVING TOOL = 1.418)

(R - RETRACTION AMOUNT)
(P - X AXIS PECKING DEPTH INCREMENT, RADIUS VALUE)
(Q - Z AXIS SHIFT INCREMENT BETWEEN PECKING CYCLES)

G75 R0.01
G75 X0.750 Z-1.5 P0500 Q1000 F0.0005
G00 X1.8
Z-2.918 (2.800 + 0.118 GROOVING TOOL = 2.918)
G75 X1.250 Z-3.0 P0500 Q1000 F0.0005
G00 X2.6 M09

G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0
M01 (OPTIONAL STOP COMMAND)

(THREADING CYCLE)
T0404
G97 S500 M03

(SINGLE DEPTH = 0.61343 / TPI)
(SINGLE DEPTH = 0.61343 / 8 = 0.0767)
(X START POINT = MAJOR DIA. + 2 X SINGLE DEPTH)
(X START POINT = 0.9905 + 2 X 0.0767 = 1.1439)
(PITCH = 1/ TPI)
(PITCH = 1/ 8 = 0.125)
(Z START POINT = 4 X PITCH)
(Z START POINT = 4 X 0.125 = 0.5)

G54 G00 X1.1439 Z0.6 M08 (X START POINT)
Z0.5 (Z START POINT)

(P - SETS THE NUMBER OF SPRING PASSES)
(THE FIRST NUMERICAL VALUE CONTROLS HOW QUICKLY THE TOOL RETRACTS.)
(THE SECOND NUMERICAL VALUE CONTROLS THE TOOL INFEED ANGLE.)
(Q - SETS THE MINIMUM CUT DEPTH)
(R - SETS THE DEPTH OF THE FINAL PATH)

(X - MIN MINOR DIAMETER)
(Z - THREAD LENGHT)
(P - SINGLE DEPTH, THREAD HEIGHT, RADIUS VALUE)
(Q - FIRST PASS CUTTING DEPTH)
(R - DIFFERENCE OF THREAD RADIUS)
(F - 1/TPI)

G76 P010060 Q0015 R0.0005
G76 X0.8206 Z-1.3 R0.0 P0767 Q0192 F0.125

G00 X2.6 M09
G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0
M01

M26 (TAILSTOCK SPINDLE OUT)
(PARTING)
T0505
G97 S500 M03
G54 G00 X2.6 Z-4.418 M08
G01 X-0.03 F0.001 M73 (PARTS CATCHER IN)
G00 Z0.1 M09
G28 U0.0
Z5.0 M74 (PARTS CATCHER OUT)
M05 (SPINDLE STOP)
M30
%

For Romi CNC Lathe Machines

%
O0001
(PROGRAMMER: FRANCIS NGUYEN)
(VERSION: 2022)
(STOCK 2.5" O.D. ALUMINUM)
(T0101 O.D. ROUGH TOOL x 1/32 TNR)
(T0202 O.D. FINISH TOOL x 1/64 TNR)
(T0303 GROOVING TOOL x 0.118")
(T0404 O.D. THREADING TOOL)
(T0505 PARTING TOOL x 0.118")
(T0606 STOP BAR)
(T0707 CENTER DRILL #2)

(BAR STOP)
G55 G00 Z5.0 T00
T0606
X0.0 Z0.02
M00

Z0.1
G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0
T00
M01

(DNMG 432 - RP5 WPP10S)
G55 G00 X5.0 Z5.0 T00
T0101 (TOOL #1 AND OFFSET #1)
G96 S600 (TURN ON CSS TO 600)
G92 S2000 M03 (SPINDLE SPEED CLAMP AT 2000 RPM)
X2.6 Z0.1 M08 (RAPID X2.6, Z0.1 TO START POINT, COOLANT ON)
G01 Z0.0 F0.01
X-0.063 (FEED DOWN X-0.063 TO FACE END OF PART)
G00 X2.6 Z0.1 M09 (RAPID TO X2.6, Z0.1 START POINT ABOVE PART)
G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0 M09
M05 (SPINDLE STOP)
T00
M01 (OPTIONAL STOP COMMAND)

(CENTER DRILL USING LIVE TOOL)
G55 G00 Z5.0 T00
T0707 (Tool 7 Offset 7)
G97 S1500 M15 (Turn on the driven tool in clockwise direction)
M19 (LEFT SPINDLE ORIENTATION)
G28 C0
G00 C0
G94 M86 (Feed per min/Turn on left spindle low torque brake)
G54 G00 X0. Z0.25 M08 (Rapid to Initial Start Point)

G83 Z-0.125 R-0.1 F1.0 (G83 Drilling Cycle)
G80 G00 Z0.25 M09

M18 (TURN OFF THE SPINDLE DIRECTION)
M17 (TURN OFF THE DRIVEN TOOL)
G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0
G95 (FEED PER REVOLUTION)
T00
M01

(BAR STOP)
G54 G00 Z5.0 T00
T0606
X0.0 Z0.0
M00

Z0.1
G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0
T00
M01

(ROUGH PART PROFILE USING TAILSTOCK)
G54 G00 Z5.0 T00
T0101 (TOOL #1 AND OFFSET #1)
G96 S600 (TURN ON CSS TO 600)
G92 S2000 M03 (SPINDLE SPEED CLAMP AT 2000 RPM)
X2.6 Z0.1 M08 (RAPID TO X2.6, Z0.1 START POINT ABOVE PART)

(U - SETS THE DEPTH OF THE ROUGHING PASSES)
(R - SETS THE DISTANCE THE TOOL WILL RETRACT FROM EACH ROUGHING PASS)
(P - STARTING BLOCK NUMBER OF PATH TO ROUGH)
(Q - ENDING BLOCK NUMBER OF PATH TO ROUGH)
(U - AMOUNT OF MATERIAL TO BE LEFT ON DIA)
(W - AMOUNT OF MATERIAL TO BE LEFT ON FACES)

G71 U0.050 R0.050
G71 P100 Q200 U0.010 W0.005 F0.010
N100 G00 X0.72 (PNN START #100, CUTTER COMP. ON FOR G70, RAPID X0.72)
G01 Z0.0 F0.005 (G71 PART GEOMETRY)
X0.82 (POINT 1)
X1. Z-0.09 (POINT 2)
Z-1.5 (POINT 3)
X1.45 (POINT 4)
Z-3. (POINT 5)
X1.7 (POINT 6)
Z-3.5 (POINT 7)
X1.95 (POINT 8)
Z-4.418 (POINT 9)
N200 G00 X2.6 M09 (QNN END #200, CANCEL CUTTER COMP. FOR G70, FEED X TO 2.6)
G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0
T00
M01 (OPTIONAL STOP COMMAND)

(FINISH PART PROFILE)
(SET R IN TOOL GEOM TO 0.0156)
(DNMG 431 MP3 WPP10S)
G54 G00 Z5.0 T00
T0202 (TOOL #2 AND OFFSET #2)
G96 S900 (TURN ON CSS TO 900, MAIN SPINDLE)
G92 S2000 M03 (SPINDLE SPEED CLAMP AT 2000 RPM)
X2.6 Z0.1 M08 (RAPID TO X2.6, Z0.1 START POINT ABOVE PART)
Z0.0 (POSITION TO Z0.0 END OF PART)
G01 X-0.031 F0.001 (FEED DOWN FACE OF PART)
G00 X2.6 Z0.1 (RAPID TO X2.6, Z0.1 START POINT ABOVE PART)
G42
G70 P100 Q200 (DEFINE A G70 FINISH PASS OF PART GEOMETRY)
G40
G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0
T00
M01 (OPTIONAL STOP COMMAND)

(GROOVING CYCLE)
G54 G00 Z5.0 T00
T0303
G96 S500
G92 S2000 M03 (SPINDLE SPEED CLAMP AT 2000 RPM)
X1.6 Z0.1 M08
Z-1.418 (1.30 + 0.118 GROOVING TOOL = 1.418)

(R - RETRACTION AMOUNT)
(P - X AXIS PECKING DEPTH INCREMENT, RADIUS VALUE)
(Q - Z AXIS SHIFT INCREMENT BETWEEN PECKING CYCLES)

G75 R0.01
G75 X0.750 Z-1.5 P0500 Q1000 F0.0005
G00 X1.8
Z-2.918 (2.800 + 0.118 GROOVING TOOL = 2.918)
G75 X1.250 Z-3.0 P0500 Q1000 F0.0005
G00 X2.6 M09

G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0
T00
M01 (OPTIONAL STOP COMMAND)

(THREADING CYCLE)
G54 G00 Z5.0 T00
T0404
G97 S500 M03 (MAIN SPINDLE)
(SINGLE DEPTH = 0.61343 / TPI)
(SINGLE DEPTH = 0.61343 / 8 = 0.0767)
(X START POINT = MAJOR DIA. + 2 X SINGLE DEPTH)
(X START POINT = 0.9905 + 2 X 0.0767 = 1.1439)
(PITCH = 1/ TPI)
(PITCH = 1/ 8 = 0.125)
(Z START POINT = 4 X PITCH)
(Z START POINT = 4 X 0.125 = 0.5)

X1.1439 Z0.6 M08 (X START POINT)
Z0.5 (Z START POINT)

(P - SETS THE NUMBER OF SPRING PASSES)
(THE FIRST NUMERICAL VALUE CONTROLS HOW QUICKLY THE TOOL RETRACTS.)
(THE SECOND NUMERICAL VALUE CONTROLS THE TOOL INFEED ANGLE SUCH AS: 80°, 60°, 55°, 30°, 29° or 0° )
(Q - SETS THE MINIMUM CUT DEPTH)
(R - SETS THE DEPTH OF THE FINAL PATH)

(X - MIN MINOR DIAMETER)
(Z - THREAD LENGHT)
(P - SINGLE DEPTH, THREAD HEIGHT, RADIUS VALUE)
(Height of the thread = (Major diameter - minor diameter) / 2)
(Q - FIRST PASS CUTTING DEPTH)
(R - DIFFERENCE OF THREAD RADIUS)
(If R = 0, ordinary straight thread cutting can be made.)
(R-: Taper thread to X+)
(R+: Taper thread to X-)
(F - 1/TPI)

G76 P030060 Q0015 R0.0005
G76 X0.8206 Z-1.3 R0.0 P0767 Q0192 F0.125

G00 X2.6 M09
G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0
T00
M01

M76 (PART COUNT)
(0.118 CUT OFF)
G54 G00 Z5.0 T00
T0505
G96 S500
G92 S2000 M03 (SPINDLE SPEED CLAMP AT 2000 RPM)
X2.6 Z-4.418 M08 (4.30 + 0.118 PARTING TOOL = 4.418)
G01 X-0.03 F0.001 M38 (FORWARD PART CATCHER)
G00 Z0.1 M09
G28 U0.0 (SENDING HOME FOR A TOOL CHANGE)
Z5.0 M39 (PULL BACK PART CATCHER)
M05 (SPINDLE STOP)
T00
M30
%

C-Axis Turning and Live Tooling

C-axis

The C-axis machine tool combines the best elements of a lathe and a milling machine to turn out complex parts quickly that would be much less productive if done as multiple ops across different machines. First, it has the ability to treat the spindle as another axis, called the C-Axis. This allows positioning the part with great position to any angle. Second, it has live tooling. Instead of an ordinary lathe tool in a turret position, there’s a miniature motorized spindle that can hold endmills, twist drills, saws, or whatever else is needed.

cnc_lathe_live_tools

Live Tooling Code for Haas:

G98 versus G99: G99 (feed per spindle revolution) is the default on a lathe. With most live tooling code G98 (feed per minute) is used as the spindle is not rotating at high rpm. The units are inches per minute or degrees per minute.

M133 (Live Tool Drive Forward)
Turns on the live tooling motor to a (PXXXX) rpm.

M134 Live Tool Drive Reverse

M135 Live Tool Drive Stop

M14 Clamp Main Spindle
M14 clamps or turns on the spindle brake.

M15 Unclamp Main Spindle
M15 unclamps or turns off the spindle brake.

M19 Orient Spindle (Optional)
M19 will orient the spindle to the zero position. A P or R value is used to orient the spindle to a specific position (in degrees).

M119 will position the secondary spindle (DS lathes) the same way.

M154 C-Axis Engage

M155 C-Axis Disengage

These codes engage and turn on and off the C-Axis motor. After engaging the C-Axis with M154, it is recommended that the following line (G28 H0) block be inserted. H is the incremental C-Axis command. G28 H0 will take the machine home in the C-Axis (C0). This will ensure that the gears used for the C-Axis are fully engaged.

cnc_lathe_live_tools

The default on a lathe is G18. All axial or face working operations use G18 to properly work. All radial or cross drilling can cycles need to be in G19 to work properly.

Plane Selection and Feed Rates for Different Canned Cycles:

cnc_lathe_live_tools

cnc_lathe_live_tools

G82 Axial Drilling Program Example:

%
O00010
(LIVE SPOT DRILL - AXIAL)
T1111
G98 (Feed per minute)
M154 (Engage C-Axis)
G54 G00 X6. C0. Y0. Z1. (Rapid to a position)
G00 X1.5 Z0.25
G97 M133 P1500 (Live Tool Drive Forward/Live Tool Spindle Speed)
M08

G82 G98 C45. Z-0.8627 F10. P80
C135. (Rotate C-Axis to 135 degrees)
C225.
C315.
G00 G80 Z0.25 M09

M155 (Disengage C-Axis)
M135 (Live Tool Drive Stop)
G28 H0. (Return C-Axis to Home Position)
G00 X6. Y0. Z1.
G99 (Feed per revolution)
M30
%

cnc_lathe_live_tools

G241 Radial Drilling Program Example:

%
O00011
T1111
G98 (Feed per minute)
M154 (Engage C-Axis)
G54 G00 X5. Y0. Z-0.75 (Rapid to a position)
M133 P2500 (Live Tooling On, 2500 RPM)
G19 (YZ Plane Selection)
M08

G241 X2.1 Y0.125 Z-1.3 C35. R4. F20. (Drill to X2.1)
G00 G80 Z1.

M09
M155 (Disengage C-Axis)
M135 (Stop live tool spindle)
G53 G00 X0. Y0.
G18 (RETURN TO NORMAL PLANE XZ)
G99 (Feed per revolution)
M30
%

cnc_lathe_live_tools

Y-Axis Milling Program Example:

%
O02003
(MILL FLAT ON DIAMETER 3.00 DIAMETER .375 DEEP)
T101 (.750 4 FLUTE ENDMILL)
G19 (SELECT PLANE YZ)
G98 (Inches per minute)
M154 (ENGAGE C-AXIS)
G54 G00 X6. C0. Y0. Z1. (RAPID TO A POSITION)
G00 C90. (ROTATE C AXIS TO 90 DEGREES)
M14 (BRAKE ON)
G97 P3000 M133 (Live tool spindle speed/Live tool drive forward)
G00 X3.25 Y-1.75 Z0. (RAPID POSITION)
G00 X2.25 Y-1.75 M08

G01 Y1.75 F22.
G00 X3.25
G00 Y-1.75 Z-0.375
G00 X2.25
G01 Y1.75 F22.
G00 X3.25
G00 Y-1.75 Z-0.75
G00 X2.25
G01 Y1.75 F22.
G00 X3.25
G00 X3.25 Y0. Z1.

M15 (BRAKE OFF)
M135 (LIVE TOOL OFF)
M155 (DISENGAGE C-AXIS)
G00 X6. Y0. Z3. M09
G18 (RETURN TO NORMAL PLANE XZ)
G99 (Inches per revolution)
M30
%

cnc_lathe_live_tools

G112 Cartesian to Polar Programming

When using G112, Cutter Radius Compensation is only available in G17 (XY) plane.

Axially Cuting 1.732 Hex using G112:

%
O00018 (G112)
(CUTS 1.732 HEX WITH 0.06 IN. CORNER RAD)
(2.0 ROUND STOCK)
(T1 = 0.5 IN. ENDMILL)
(SET TOOL TO 0.25 RADIUS ON TOOL OFFSET PAGE)

T101
G54 M154 (ENGAGE C-AXIS)
G28 H0 (HOME C-AXIS)
G97 M133 P3000
G98 (INCHES PER MIN)
G17 (SELECT G17 XY PLANE)
G112 (XY-XC INTERPOLATION)
Z0.1 (CLEARANCE PLANE)
G01 Z-0.25 F10.0 (Z FINAL DEPTH)
G00 X1.5 Y0.0 M08

G41 G01 X1.0 Y0.0
X0.9827 Y-0.03
G01 X0.5173 Y-0.836
G02 X0.4653 Y-0.866 R0.06
G01 X-4654 Y-0.866
G02 X-5173 Y-0.836 R0.06
G01 X-0.9827 Y-0.03
G02 X-0.9827 Y0.03 R0.06
G01 X-0.5173 Y0.836
G02 X-0.4654 Y0.866 R0.06
G01 X0.4654 Y0.866
G02 X0.5173 Y0.836 R0.06
G01 X0.9827 Y0.03
G02 X0.9827 Y-0.03 R0.06
G40 G01 X1.35 Y0.0

G113 (CANCEL G112)
G18 (XZ PLANE)
G28 G00 H0 M09
G99 M135
M155 (DISENGAGE C-AXIS)
G53 G00 X0.0
G53 G00 Y0.0
M30
%

B-Axis Turn/Mills

C-axis

The B-axis machine tool combines the turning capabilities of a horizontal/vertical turning machine with the milling and machining capabilities of a five-axis machining center.

Like traditional turn/mill machines, B-axis machine tools provide control over the Z-X (turning) and C (rotary milling) axes. The B-axis head is used as a milling spindle or a turning/boring toolholder, thus enabling the machine to complete all milling and turning with one setup. These machine tools also give users control over the Y-axis for off-center milling operations. However, it is B-axis capability that sets these machines apart. The B axis is defined as rotation about the Y axis, and this fifth axis positioning makes cuts with compound angles possible. B-axis capability gives a machine full support for five-axis index milling and 3D / five-axis simultaneous freeform milling. The B-axis machine is literally one machine doing the work of two because it supports the entire range of milling and turning operations possible, with the advantage of doing it in one setup.

The potential of a B-axis machine for increasing productivity and producing multi-faceted parts in a single setup is a compelling reason for shops to invest the time and money in this type of turn/mill machine tools.

Five-Axis Programming

Most five-axis programs are rather complex and should be written using a CAD/CAM software package such as SolidWorks/MasterCam. It is necessary to determine the pivot length and gauge length of the machine, and input them in these programs.

Create the CAD drawing is the first step in computer aided manufacturing so that its geometry may later be used for creating the machining operations. After a drawing has been created, the next step in CAM is to define the toolpath, or the path that the tool will follow in order to machine the part.

Three-dimensional surface milling is an area where the CAM software really begins to demonstrate its potential. Without CAM software, all but the simplest surface toolpaths would be virtually impossible. The final step in CAM programming is to take all of the defined toolpath data and allow the CAM software to write a CNC program.

Machining simulation that works perfectly in the virtual environment may not work physically without careful planning and consideration. Some of the major factors include choosing adequate fixtures to firmly hold the stock to the jig table, checking to ensure that cutters would not collide with fixtures and jig table, and verifying that the syntax and semantics of the G-code are compatible with the CNC machine at the shop floor.

Conversational-Type Programming

Not all CNC machines must be programmed with G- and M-codes. Some machines have a special type of MCU that allows conversational programming. Conversational programming was developed to simplify the machine programming process. There are many different types of conversational MCU brands, including Southwest Industry's Proto-TRAK machines, Bridgeport's EZ-Trak, Fanuc's FAPT and CAP, and Mazak's Mazatrol controls.

The advantages are that it requires much less programming knowledge, can often be faster for simple features, and can easily be performed at the machine on the shop floor. The disadvantages revolve mostly around the lack of flexibility: the only operations that can be performed are those provided by the manufacturer. It is for these reasons that conversational controls are usually most useful for repair work, prototyping, or low-volume production machines. When high production quantities require highly efficient programs or complex machining scenarios, the versatility of a G- and M-code programming method is usually more suitable.

SOLIDWORKS vs Mastercam

Both Mastercam and SOLIDWORKS can create model geometry and generate NC code. For 3D modeling, SOLIDWORKS is the world’s most widely used design software for a reason. It has a clear advantage for anyone routinely performing the design of products or fixtures.

For CNC programming, Mastercam is the World’s #1 CNC Programming software for a reason. It is powerful and easy to use and supports a wide range of machines and technologies.

SOLIDWORKS CAM is a low-cost option for users whose primary needs are design rather than manufacturing, but Mastercam offers a breadth and depth of features that cannot be matched for machine shops and programmers.