CNC Programming Examples & Code

Learn cnc programming with useful g-code example code,CNC programming examples, cnc programs, subroutines and cnc programming cycles. Basic to advance cnc programming examples.

Fanuc CNC Direct programming of profile (angles and round edges) Example

Fanuc CNC Direct Programming of Profile (angles and round edges) Example

O0012; N10 G10 P0 Z-200; N20 T303; (PROFILING) N30 G50 S2200; N40 G96 G99 S230 F0.12 M4 M8 M200; N50 G0 X0 Z3; N60 G1 Z0 ; (P1) N70 ,A90…

CNC Cylindrical interpolation Program Example

CNC Cylindrical interpolation Program Example

O0005; N10 G10 P0 Z-165; N20 T404; N30 G50 S2000; N40 G96 S200 G99 F.2 M4 M8 M200; N50 G0 X69.282 Z2; N60 G1 Z-20; N70 G3 X69.282 Z-60 R40;…

CNC Program Outside Turning with Radius

CNC Program Outside Turning with Radius

O0004; N10 G10 P0 Z-110; N20 T303; N30 G50 S2500; N40 G96 S220 G99 F.2 M4 M8 M200; N50 G0 X30 Z2; N60 G1 Z-22; N70 G2 X40 Z-27 R5;…

CNC Lathe Inside Turning Boring Program Example

CNC Lathe Inside Turning / Boring Program Example

O0003; N10 G10 P0 Z-85; N20 T606; N30 G50 S2000; N40 G96 G99 S180 F.2 M4 M8 M200; N50 G0 X44 Z2; N60 G1 Z0; N70 X40 Z-2 F.15; N80…

CNC School Multiple Radius Arc G02 G03 CNC Lathe Program

CNC School Multiple Radius Arc G02 G03 CNC Lathe Program

N05 G94 M06 T0101 N10 G00 X0 Z0 M04 S600 N15 G01 X30 F30 N20 G03 X40 Z-5 R5 N25 G01 Z-25 N30 G02 X50 Z-30 R5 N35 G01 Z-50…

CNC School Radius Arc G02 G03 CNC Lathe Program Example

CNC School Radius Arc G02 G03 CNC Lathe Program Example

N05 G94 M06 T0101 N10 G00 X0 Z0 M04 S360 N15 G01 X30 F30 N20 G03 X50 Z-10 R10 N25 G01 Z-40 N30 G02 X70 Z-50 R10 N35 G01 Z-100…

CNC School Taper Turning CNC Program Example

CNC School Taper Turning CNC Program Example

N05 G94 M06 T0101 N10 G00 X0 Z0 M04 S600 N15 G01 X30 F30 N20 G01 X80 Z-70 N25 G01 X100 N30 G01 Z-30 N35 G00 X120 N40 G00 Z10…

CNC School Basic CNC Program Example CNC Turning

CNC School Basic CNC Program Example CNC Turning

N05 G94 M06 T0101 N10 G00 X0 Z0 M04 S600 N15 G01 X50 F30 N20 G01 Z-40 N25 G01 X80 N30 G01 Z-60 N35 G01 X100 N40 G01 Z-100 N45…

Cut Screw with Threads On Both Ends (Dowel Screw) using G76 Thread Cycle CNC Lathe Example

Cut Screw with Threads On Both Ends (Dowel Screw) using CNC G76 Thread Cycle

N01 G90 F0.2 S1200 T0101 M04 N10 G00 X30 Z5 N20 G00 X30 Z0 N30 G76 P010160 Q10 N40 G76 X27.6 Z-40 P1200 Q100 F2 (RH THREAD FROM Z0 TO…

CNC Lathe Subprogram Call Multiple Times Example

CNC Lathe Subprogram Call Multiple Times Example

Main Program: N5 G90 F0.2 S1200 T0101 M04 N10 G00 X40 Z0 N20 M98 P37000 (call subprog O7000 three times) N30 G01 W-30 N40 G28 U0 W0 N50 M05 M30…

CNC Program Example using G73 Pattern Repeating Cycle G76 Threading Cycle

CNC Program Example using G73 Pattern Repeating Cycle G76 Threading Cycle

N5 G90 F0.2 S1200 T0101 M04 N10 G00 X30 Z2 N15 G00 Z0 N20 G01 X0 (Facing operation) N21 G00 X30 Z2 N30 G73 U7 R14 (Pattern Repeating Canned Cycle)…

G76 LH (Left hand) Thread Example Program

G76 LH (Left hand) Thread Example Program

N0 G90 F0.5 S1200 T0101 M04 N20 G00 X30 Z2 N40 G71 G71 U0.5 R0.5 (Roughing Cycle) N50 G71 P60 Q110 U0.05 W0.05 N60 G01 X15 Z0 N70 G01 X15…

Fanuc G76 Left hand Thread G75 Grooving Example CNC Lathe

Fanuc G76 Left hand Thread G75 Grooving Example CNC Lathe

N0 G90 F0.2 S1200 T0101 M04 N10 G00 X42 Z2 N21 G71 U1 R0.5 N22 G71 P50 Q90 U0.05 W0.05 N50 G03 X20 Z-10 R10 N60 G01 X24 Z-20 N70…

OD Turning with G73 Pattern Repeating Cycle CNC Lathe Example Program

OD Turning with G73 Pattern Repeating Cycle CNC Lathe Example Program

Main Program: N0 G90 F0.2 S1200 T0101 M04 N10 G00 X42 Z2 N30 M98 P12000 (call subprog O2000 once) N130 G28 U0 W0 N140 M05 M30 Subprogram: O2000; N30 G73…

CNC Lathe Component Machining with G73 G76 Cycles

CNC Lathe Component Machining with G73 G76 Cycles

To determine U= (Max. Dia of wp- min dia of profile)/2 = (35-25)/2 = 5 N0 G90 F0.2 S1200 T0101 M04 N10 G00 X38 Z2 N30 G73 U5 R10 N40…

Basic CNC Lathe Program Exercise for Beginners

CNC Lathe Program Exercise for Beginners G71 Turning Cycle

N0 G90 F0.5 S1200 T0101 M03 N10 G00 X35 Z2 N30 G71 U0.5 R1 N35 G71 P36 Q90 U0.05 W0.05 N36 G01 X20 Z0 N50 G01 X20 Z-15 N60 G02…

CNC Turning Exercise using G71 Turning Cycle

CNC Turning Exercise using G71 Turning Cycle

N0 G90 F0.5 S1200 T0101 M03 N10 G00 X30 Z2 N11 G71 U0.5 R0.5 N12 G71 P30 Q80 U0.05 W0.05 N30 G01 X20 Z0 N40 G01 X20 Z-20 N50 G01…

CNC Mill Program Exercise Side Milling Drilling Slot Milling

CNC Mill Program Exercise Side Milling Drilling Slot Milling

05007 N001 G71 G90 (Set dimension type mm, set absolute co-ordinate system) N002 G92 X-15.0 Y-15.0 Z0.0 T01 F100 S1200 (Set reference point -15, -15, 0. Tool T01 side milling…

CNC Lathe Program OD Turning Drilling ID Boring with G71 G74

CNC Lathe Program OD Turning Drilling ID Boring with G71 G74 G01

% O0111 (EX.NO.1); (BILLET DIA38.0*L36.0); N1 (OPN OD PROFILE TURNING); N2 G28 U0.0 W0.0; N3 G92 S2500; N4 G96 S180 M03; N5 T0000; N6 T0101; N7 G00 X40.0 Z1.0; N8…

Drilling Brass 40mm Deep Using G74 Drilling Cycle CNC Turning Program

Drilling Brass 40mm Deep Using G74 Drilling Cycle CNC Turning Program

G97 S1446 M03 G00 T0101 G00 X0. Z2. G74 R2. G74 Z-40. Q5000 F0.1 G00 Z5. M05 T0100 G28 W0. G28 U0. M30

Contour Turning using G71 Turning Cycle CNC Lathe Example

Contour Turning using G71 Turning Cycle CNC Lathe Example

G90 G21 G18 G55; T0400 M06 S2000 M03; G00 Z0.0; X31.0; G01 X30 F60; G71 U0.5R0.2; G71 P2 Q3 ; N2 G01 X0.0; X14.14 Z-7.07; Z-17.07; X19.14; Z-54.76; X25.4; N3…

Contour Turning using G72 Facing Cycle CNC Lathe Example Program

Contour Turning using G72 Facing Cycle CNC Lathe Example Program

G90 G21 G18 G55; T0400 M06; S2000 M03; G00 Z0.0; X31.0; G01 X30 F60; G72 W0.5 R0.2; G72 P2 Q3 ; N2 G01 Z-40.69; G03 X 23.92 Z-37.69 R3; G02…

Component Grooving Parting with G75 Cycle CNC Lathe Program

Component Grooving Parting with G75 Cycle CNC Lathe Program

G90 G20 G18 G55; T0400 M06; S2000 M03; G00 Z0.0; X1.200; G01 X1.150 F3; G71 U0.020 R0.010; G71 P2 Q3 ; N2 G01 X1.025; Z-2.420; N3 X1.150; G28 X0.0; G28…

CNC Lathe Programming Example Radius Dimensioning

CNC Lathe Programming Example Radius Dimensioning

% Albero N010 G00 X150 Z200 T0101 M06 N020 G92 S2400 N030 G96 G95 F0.3 S300 M04 M08 N040 X50 Z-2 N050 G01 X-0.5 N060 G00 Z0 N070 X41 N080…

Mori Seiki DuraTurn Programming Example G01 (Chamfering rounding)

Mori Seiki DuraTurn Programming Example G01 (Chamfering/rounding)

O0001; N1; G50 S1500; G00 T0101; G96 S200 M03; X30.0 Z20.0 M08; G01 Z0 F1.0; X0 F0.2; G00 X20.0 Z1.0; G01 Z−20.0, C1.0; X40.0 , R1.0; Z−40.0 , R2.0; X60.0…

NUMS 322T CNC Program Example

NUMS 322T CNC Program Example

PR. 66 TAE/500 TAE-32N 01/1006.00 MOC. 3 POZYCJA BAZY : X=200Z=300 %%% N001 G95 S035 M04 N002 G00 X1600 Z-18400 T0101 /N003 G01 X-6000 F200 M08 /N004 G00 X4000 Z23100…

NUMS 322T CNC Program Example Complete

NUMS 322T CNC Program Example Complete

PR. 67 TAE/500 TAE-32N 01/1006.00 MOC. 4 POZYCJA BAZY : X=200Z=300 %%% N001 G95 S030 M04 N002 G00 X1600 Z-18500 T0101 /N003 G01 X-6000 F200 M08 /N004 G00 X4000 Z23200…

NUMS 322T CNC Program Example

NUMS 322T CNC Program Example

PR. 64 TAE/500 TAE-32N 01/1006-00 MOC.1 POZYCJA BAZY : X=200 Z=400 %%% N001 G95 S035 M04 N002 G00 X1663 Z-28200 T0101 N003 G01 X-27830 F250 M08 N004 X-40300 S045 N005…

NUMS 322T Programming Example

NUMS 322T Programming Example

PROGRAM 65 TAE 32 / 500 TAE 32 01.1006.00 MOCOWANIE 2. POZYCJA BAZY :X – 200Z – 300 %%% N001 G95 S035 M04 N002 G00 X1650 Z-18300 T0101 N003 G01…

Steel Nut

% 0 :1508(151-508,NUT,STAND-OFF) (REV,6) (HARDINGE,T42) (PPC,11/11/13) (T0101, STOCK FEED) (T0303, 3/4″ 90DEG SPOT DRILL) (T0404, I DRILL) (T0202, 5/16-24,BOTTOMING TAP) (T0606, 55 DEG,.008 RAD, OD TURN) (T0626, 55 DEG,.008 RAD,…

Siemens Sinumerik CNC Program Example

Siemens Sinumerik CNC Program Example

%MPF128 N0005 G95 G96 S120 M41 M4 N0010 G00 X135 Z19 T1 D1 N0015 G1 X121 Z26 F.25 M8 N0020 G0 X188 N0025 Z14 N0030 G1 X186 N0035 X184 Z15…

SINUMERIK 810T CNC Program Example Disk Machining Part II

SINUMERIK 810T CNC Program Example Disk Machining Part II

%MPF127 N0005 G95 G96 S100 M41 M4 N0010 G00 X205 Z28 T5 D5 N0015 G1 X55 F.25 M8 N0020 G00 X205 Z29 N0025 Z26 N0030 G1 X55 N0035 G0 X198…

SINUMERIK 810T CNC Program Example Disk Machining

SINUMERIK 810T CNC Program Example Disk Machining

%MPF126 N0005 G95 G96 S100 M40 M4 N0010 G0 X205 Z30 T1 D1 N0015 G1 X30 F.25 M8 N0020 G00 X198 Z31 N0025 G1 Z16 N0030 G0 X200 Z31 N0035…

Socket with Thread Fanuc 21i CNC Program Exercise

Socket with Thread Fanuc 21i CNC Program Exercise

( CONTROL FANUC 21I) ( PART – CYLINDER D102.000 L121.000) ( G54 X+000.000 Z+0240.000) O11 N10 G40 G00 N20 G99 N30 M5 N40 M9 N60 T0101 (LEFT CORNER TOOLCL-SDJCL-2020 L…

CNC Mill Program Using G81 G83 G84 G85

CNC Mill Program Using G81 G83 G84 G85

% O0001(PROGRAM#) (PROGRAM NAME – PART1) (SAMPLE PART) N1( 1” FLAT ENDMILL TOOL ) T1 M6 M1 N100 G0 G90 G54 X-1. Y0. S3056 M3 G43 H1 Z.1 M8 T2…