CNC Programming Tutorials Examples G & M Codes

G & M Programming Tutorial Example Code for Beginner to Advance Level CNC Machinist.

Siemens Sinumerik ANG= Angle Command

Siemens Sinumerik ANG= Angle Command

Sinumerik ANG= If the end points for the contour are not directly specified in the machining drawing, it is also possible to use an angle specification ANG=… to determine the…

Sinumerik CYCLE95 with Contour in Calling Program Example

Sinumerik CYCLE95 with Contour in Calling Program Example

;Siemens Sinumerik CYCLE95 first parameter NPP ;can be given as a sepatate routine or ;can be defined inside calling program with Labels ;stock removal contour is defined in the calling…

Sinumerik CYCLE95 Inside Turning Program Example

Sinumerik CYCLE95 Inside Turning Program Example

G54 G53 G0 X610 Z350 T5 D1 G96 S250 M4 ; boring bar CYCLE95(“CONT3”,3,0.05,0.3,0,0.3,0.1,0.12,11,0,0,0) G0 X200 Z100 M30 Contour subprogram: CONT3 G1 X40 Z0 F0.12 X38 Z-2.5 Z-10 X40 Z-12.5…

sinumerik CYCLE95 Facing Program CNC Lathe

Sinumerik CYCLE95 Facing Program CNC Lathe

G54 G53 G0 X610 Z350 T1 D1 G96 S250 M4 ; roughing tool G0 X65 Z0 G1 F0.18 X-1.6 G0 X65 Z5 CYCLE95(“CONT2”,1,0.02,0.05,0,0.3,0.1,0.12,10,0,0,0) G0 X200 Z100 M30 Contour subprogram: CONT2…

Siemens Sinumerik CYCLE95 Program Outside Turning Example

Siemens Sinumerik CYCLE95 Program Outside Turning Example

G54 G53 G0 X610 Z350 T1 D1 G96 S250 M4 G0 X65 Z0 G1 F0.18 X-1.6 G0 X65 Z5 CYCLE95(“CONT1”,3,0.05,0.3,0,0.3,0.1,0.12,9,0,0,0) G0 X200 Z100 M30 Contour subprogram: CONTI: G1 X38 Z2…

Selca CNC Program Example G21 Chamfer

Selca CNC Program Example G21 Chamfer

N1 [PROFILE N2 $1M0X-119.I124.Y-44.2J111. N3 G17 N4 O1 N5 T1 N6 F1000S1200M3 N7 G49I5 N8 Z100R N9 X0Y-40R N10 Z2R N11 Z-10 N12 G42K2 N13 G20X0Y0I29 N14 G13X0Y0J-30K2 N15 E1=G20X0Y0I68…

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 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. 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 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…

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…

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…

Haas G150 Pocket Milling Program Example with a Square Island

Haas G150 Pocket Milling Program Example with a Square Island

(5.0 x 5.0 x 0.500 DP. Square Pocket with Square Island) Main Program % O02010 T1 M06 (Tool is a 0.500” diameter endmill) G90 G54 G00 X2. Y2. (XY Start…

Haas G150 Pocket Milling Program Example

Haas G150 Pocket Milling Program Example

(5.0 x 5.0 x 0.500 DP. Square Pocket) Main Program % O01001 T1 M06 (Tool #1 is a 0.500” diameter endmill) G90 G54 G00 X0. Y1.5 (XY Start Point) S2000…

Haas G150 Pocket milling Program Example with a Round island

Haas G150 Pocket milling Program Example with a Round island

Main Program % O03010 T1 M06 (Tool is a 0.500” diameter endmill) G90 G54 G00 X2. Y2. (XY Start Point) S2500 M03 G43 H01 Z0.1 M08 G01 Z0. F30. G150…

Selca CNC G13 G20 G21 G51 Program Example

Selca CNC G13 G20 G21 G51 Program Example

[G13 Straight line, at a known angle, [ through a point or tangent to a circle [G20 Circle of known center and radius [G21 Linking radius [G51 Offset / rotation…

Fanuc G52 Local Coordinate G15 G16 Polar Coordinate Program Example

Fanuc G52 Local Coordinate G15 G16 Polar Coordinate Program Example

;Fanuc Program Example ;G52 Local Coordinate System ;G15 G16 Polar Coordinate O1453 G91 G28 X0 Y0 Z0 M06 101 M03 S1000 G90 G54 G43 H1 G52 X100 Y100 G00 X0…

Fanuc G15 G16 Polar Coordinate Command Program Example G81 G84

Fanuc G15 G16 Polar Coordinate Command Bolt Circle Program Example

O777 G91 G28 X0 Y0 Z0 M06 T01 M03 S500 G90 G54 G43 H1 G00 Y41 X0 Z5 G81 Z-12 R2 F200 G16 X41 Y150 X41 Y210 X41 Y270 X41…

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…

Selca CNC Programming Example

Selca CNC Programming Example

N1 [PROFILE 11 N2 $1M0X-158.I155.Y-84.6J115. N3 G17 N4 O1 N5 T1 N6 F1000S1200M3 N7 Z100R N8 X0Y-70R N9 Z2R N10 Z-10 N11 G49I5 N12 G41K2 N13 G20X0Y0I-52.5 N14 G21I15 N15…

Selca CNC Program Example Profile

Selca CNC Program Example Profile

N1 [PROFILE 9 N2 $1M0X-116.I119.Y-45.3J105. N3 G17 N4 O1 N5 T1 N6 F1000S1200M3 N7 Z100R N8 X0Y0R N9 Z2R N10 Z-10 N11 G49I2.5 N12 G42K2 N13 E1=G20X25Y-32I-12 N14 E2=G20X-65Y21I-12 N15…

Selca CNC Program Example Complete

Selca CNC Program Example Complete

N1 [PROFILE 6 N2 $1M0X-110.I150.Y-82.4J83.7 N3 G17 N4 O1 N5 T1 N6 F1000S1200M3 N7 G49I1 N8 Z100R N9 X-75Y-75R N10 Z2R N11 Z-10 N12 G42K2 N13 E1=G13X0Y-80J180 N14 E1 N15…

Selca CNC Program Example

Selca CNC Program Example

N1 [PROFILE 5 N2 $1M0X-54.8I205.Y-83.4J82.8 N3 G17 N4 O1 N5 T1 N6 F1000S1200M3 N7 G49I5 N8 Z100R N9 X50Y-80R N10 Z2R N11 Z-10 N12 G42K2 N13 G13Y-70J0 N14 G21I30 N15…

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…

Haas Mill G107 Cylindrical Mapping Program Example

Haas Mill G107 Cylindrical Mapping Program Example

(G170 parameters) (X X-axis command) (Y Y-axis command) (Z Z-axis command) (A A-axis command) (Q Diameter of cylindrical surface) (R Radius of rotary axis) % O0079 (G107 TEST) T1 M06…

Mitsubishi CNC G07.1 Cylindrical Interpolation Program Example

Mitsubishi CNC G07.1 Cylindrical Interpolation Program Example

N01 G28 XZC; N02 T0202; N03 G97 S100 M23; N04 G00 X50. Z0.; N05 G94 G01 X40. F100.; N06 G19 C0 Z0; N07 G07.1 C20.; N08 G41; N09 G01 Z-10….

Example of Fanuc G07.1 Cylindrical Interpolation Program

Example of Fanuc G07.1 Cylindrical Interpolation Program

O0001 (CYLINDRICAL INTERPOLATION ); N01 G00 G90 Z100.0 C0 ; N02 G01 G91 G18 Z0 C0 ; N03 G07.1 C57299 ; N04 G90 G01 G42 Z120.0 D01 F250 ; N05…

Heidenhain Flex K Programming Example Complete

Heidenhain Flex K Programming Example Complete

0 BEGIN PGM FK3 MM 1 BLK FORM 0.1 Z X+0 Y+0 Z-40 2 BLK FORM 0.2 X+100 Y+100 Z+0 3 TOOL DEF 1 L+0 R+5 4 TOOL CALL 1…

Fanuc G07.1 Cylindrical Interpolation Example

Fanuc G07.1 Cylindrical Interpolation Example

O0002 (Cylindrical Interpolation) N15 T0505 N25 M13 (Driven tool ON clockwise) N30 G97 S2000 N32 M52 (Positioning of the spindle C-axis ON ) N35 G07.1 C19.1 (Start of the interpolation…

DOOSAN PUMA Macro-B OD Jaw Program (FANUC Series 31i)

% O8999 (BORE JAWS – !!!DO NOT ERASE!!!) (****** DEFINE JAW DATA ******) #100=5.5 (STARTING DIA X) #101=6.5 (FINAL DIA X) #102=0.1 (DIA DEPTH PER PASS) #103=-3.5 (FINAL DEPTH Z)…

Fanuc Bolt Hole Circle Custom Macro (BHC)

Fanuc Bolt Hole Circle Custom Macro (BHC)

/*Parameters G65 P9100 Xx Yy Zz Rr Ff Ii Aa Bb Hh X: X coordinate of the center of the circle (#24) Y: Y coordinate of the center of the…

Heidenhain Conversational CNC Program Example

Heidenhain Conversational CNC Program Example

0 BEGIN PGM FK2 MM 1 BLK FORM 0.1 Z X+0 Y+0 Z-40 2 BLK FORM 0.2 X+100 Y+100 Z+0 3 TOOL DEF 1 L+0 R+5 4 TOOL CALL 1…

Centroid G65 Macro Program for Slots of varying Depth and Length

Centroid G65 Macro Program for Slots of varying Depth and Length

;The main program would call this macro five times, ;each time specifying the depth and length required. ;macro variables would handle the length in the Y direction ;and depth in…