General 1- Composition of a part programs. 2- Block Configuration. 3- Part programming Block format: N G X(u) Y(w) Z F M S T N (block number): • Each block of information must be allocated a number. • Ex: N0010, N0020, • It is recommended that the blocks are programmed in increments of 10 to allow for further block insertion. G (code for preparatory function): • A G code is a command to the control unit to perform some specific task or function. • G code is made from the G address letter and a two digit number: G00, G01 • Some G codes remain active till replaced or cancelled. These are called modal (retained) G codes. • G code from group 0 are non-modal. XYZ (position co-ordinate data): • These letters refer to movement along the designated axes. • Use XYZ when absolute mode is intended. • Use U,W when incremental mode is intended. F (feed function): • The movement of the tool at a specified speed for cutting is called the feedrate. • The feedrate is defined using the F address letter followed by a numerical value: F256 • Feedrates can be specified as either millimetre or inches movement per minute or revolution. • Incorrect feedrates may result in damage to the cutting tool or the work piece. M.nazmi ‹#› M code (miscellaneous functions): • are (non-standard) commands to the control unit to perform special tasks. • M codes are defined using the M address letter and a two digit number EX: M03 spindle forward S (spindle speed function): • The rotational speed of the tool with respect to the work piece being cut is called the spindle speed. • Four digit number following the S code specifies the speed in RPM. • When a move command and a S code is specified in the same block a simultaneous execution of the command is performed. T (tool function): • A tool from the ATC is selected using the address letter T followed by a number in ATC magazine position. • To command a tool change the M06 code would precede the number of the “new” tool required. Ex: M06 T01 4- Tool Movement Point-to-Point This is a rapid traverse movement that moves the slide to the next position required. Axes movements are not co-ordinated with each other so care must be taken to avoid collision with clamps. This is used for tool positioning and no cutting should be undertaken. Line Motion (Linear interpolation) Tool moves along the specified straight line with a given feed rate. Line motion is used when the tool is to cut in a straight line under coordinated axis movement. Contouring This involves programming that is similar to line motion in that the next position is specified and a feed rate is given but an arc movement is achieved. M.nazmi ‹#› 5- SAFETY De to the great cutting forces that these machines are capable of producing and the increased feed rates over conventional machines, great care must be taken at all times as any fault in the program may have disastrous effects on the machine and the operator. Safety Rules: •Make sure you know how to stop the machine in case of an emergency. •Make sure that the machine guards are in position when machining. •If you suspect something is going wrong, STOP the machine immediately. •Isolate the machine before any adjustments. •Do not attempt to use the machine until you are sure you can use it correctly. •Part programs should be proved prior to machining using a dry run or computer simulation. 6- Program Proving M.nazmi ‹#› Methods of checking/verification Graphical simulation: computer graphics are used to simulate the workipece and the cutting tool movements. Any errors in the program will be highlighted prior to the program being entered into the machine and therefore the programmer is able to edit/correct his program. M.nazmi ‹#› Dry Run: this method of program proving is done on the machine tool but the component or billet to be cut is not installed. As the tool or cutter moves in air the operator looks to see that the cutting tool will not collide with proposed clamping and fixture arrangements or the part. A dry run can be done in single step mode which means that the part program can be run block by block under the control of the operator. All CNC machine controllers have this facility. DATUM: •Machine datum: defines the zero point of all axes which is fixed by the manufacturer. We can use zero offset facility to move this datum. •Program/work datum is specified by the programmer when the program is written. All subsequent measurements are then made relative to this new “program” datum. Z X M.nazmi ‹#› Co-Ordinate Dimensioning: There are two types of co-ordinate dimensioning systems used in CNC programming: •Incremental: where next position measurements are taken relative to the current position. - an error made in one dimension will effect subsequent measurements - if a dimension changes then the rest of dimension will have to be changed •Absolute: Dimensions are always measured from the same datum position therefore there are no build-up or accumulation of errors between dimensions. X Y 2 1 3 4 5 6 Incremental Absolute X U Y 1 2 3 4 5 6 1 2 3 4 5 6 M.nazmi ‹#› W N0000 G00 X00.0 Y00.0 Z00.0 M.nazmi ‹#› F0000 M00 S0000 T00; G&N programming for CNC lathe 6- Absolute and Incremental Co-ordinates • The addresses X and Z within a program relate to a co-ordinate position from the workpiece datum. X axis • The address U and W within a program relate to the individual axis movements required to reach the new position, from the last position reached by the tool. The address U refers to the X axis and the address W refers to the Z axis. Dia 30 Z axis Dia 20 50 • Four different ways can be used to write a block within a program: Absolutes/ absolutes Incremental/incremental Absolutes/incremental Incremental/absolutes M.nazmi ‹#› G01 X30 Z-50; G01 U10 W-50; G01 X30 W-50; G01 U10 Z-50; List of G Codes (Turning machine) G00 G01 G02 G03 G04 G20 G21 G28 G40 G41 G42 G50 G70 G71 G72 G73 G74 G75 G76 G81 G90 G92 G94 G96 G97 G98 G99 positioning (rapid traverse) liner interpolation (feed) circular interpolation CW circular interpolation CCW dwell inch data input metric data input reference point return tool nose radius compensation cancel tool nose radius compensation left tool nose radius compensation right work coordinate change/Max spindle speed setting finish cycle stock removal in turning –X stock removal in facing-Z pattern repeating Peck drilling in Z axis Grooving in X axis multiple thread cutting cycle deep hole drilling diameter cutting cycle A (outer/inner) thread cutting cycle cutting cycle B (end face cycle) assessed surface speed control Assessed surface speed control cancel feed per minute feed per revolution M.nazmi ‹#› G Codes G00 /Rapid positioning & traverse (modal) • Executes a non cutting movement at a rapid feedrate to a specific coordinate position in the working area (absolutes mode) or a certain distance from previous position (increment mode). • The two axes move completely independent off each other at the maximum feedrate along a non vector path. Dia. X 30 2.0 P1 Non vector movement G00 X30 Z2 Z 0.0 2.0 G00 Z2 X30 G00 is modal G01 /Linear interpolation (modal) • The G01 executes a cutting movement following a straight line at a set feedrate. G01 X(or U) Z(or W) F • The feedrate value programmed into the G01 command is the actual feedrate along the proposed tool path, not the feed rates of the slide. • On two axis movements, the machine controller will calculate the separate feedrates for both the X and Z slides, enabling the actual vector feedrate to equal that stated in the G01 command. • The coordinates can be programmed in absolutes values as X and Y, or incremental values as U and W. • The coordinates may be programmed in mixed modes.to M.nazmi ‹#› Absolute: G01 Z-25 F0.1; X40 -Z50; P3 P2 25 Dia P1 25 50 40 Dia Incremental: G01 W-25 F0.1; U15 W-25; Mixed: G01 W-25 F0.1; X40 W-25; Feedrate values are modal. G02/G03 circular interpolation (modal) • G02 executes a cutting movement following a clockwise circular path at a set feedrate. • G03 executes the cutting movement following an anticlockwise circular path at a set feedrate. • When using absolute position, X & Z values are the dimensions of the end point of the arc in relation to the datum position of the component. • In incremental mode, U & W are the distance the tool moves from the start position of the arc. This can either be a plus value or a minus value depending on the direction of the movement relative to the start position. G02 G02 X Z R +/-U +/-W R End Absolute Incremental R G03 X Z R G03 U W R G02 X30 Z-30 R F Start +X G02 X30 W-20 R F +Z 30 Dia 20 10 M.nazmi ‹#› When you do not know the radius: A case for I and K To program an arc when only the arc center is given use the address letter I and K. • I relates to the address X and is the incremental value and direction from the start point of the arc in the X axis to the arc center. • K relates to the address Z and is the incremental value and direction from the start point of the arc in the Z axis to the arc center. Center of ARC +X I +Z End Absolute G02 X Z I K F; Incremental G02 U W I K F; Start K Finish Start I Z G04 /Dwell G04 X-- (Integer time in seconds) G04 X10 G04 U- (Real time in seconds) G04 X10.5 G04 P-- (time in milliseconds) G04 P2500 • • • • Used to enter a set time delay into the program. No decimal points can be used with address P Dwell is performed at the start of the block in which it is programmed. G04 is non-modal M.nazmi ‹#› G20-G21 / Inch-Metric Data input unit • The machine controller can be programmed in either inch unit input or metric unit input. G20 G21 Imperial/Inch Metric/Millimeter lowest value 0.0001 lowest value 0.001 • Do not switch between G20/G21 during a program • The offsets must be set according to the units of measurement being used. Offsets !!!!!!!!!!!????!! • There are two parameters that are different from tool to tool. These are radius and length. 40 100 100-40-10 50 60 100-60-10 10 • The offset compensation table is a useful means of overcoming this problem. G28 /Reference point return G28 X(U) Y(W) • The reference point is a fixed position on the machine to which the tool can be moved. (home position) • G28 instructs the tool to automatically move to this reference point. • X/Y/ can be used to indicate an intermediate point through which the tool will pass before continuing to the reference point. M.nazmi ‹#› • G28 moves are performed at rapid traverse rates (non-vector tool path) Reference Point Collision Point P2 G28 U0 W0 P1 when no intermediate points are required U&W are set to zero. P3 P2 Reference Point P1 Dia 80 G28 X100 Z-40 To avoid this collision the tool is sent on a path through the intermediate point P2. 40 G50 / 1- Clamping maximum spindle speed. 2- Coordinate system setting. 3- Coordinate system shift. 1- Clamping maximum spindle speed. G50 S____ • The value in word address S specifies the maximum spindle speed measured in RPM. • this command can be used in conjunction with G96 (Constant surfaces speed control) to clamp the spindle speed to the given value. 2- Coordinate system setting. • This command can be used to specify a user coordinate value to register as the current position of the tool. The tool will think it is at the specified coordinates although it has not actually moved. M.nazmi ‹#› 20 40 30 10 20 0 10 20 10 10 20 30 40 +Z G50 X10 Z10 3- Coordinate system shift. • If incremental word addresses are used to specify the values then this command shifts the coordinate axes by the specified values. 40 30 20 20 10 10 0 10 20 30 40 10 20 +Z G50 U10 W10 G71 / Stock removal in X axis. • G71 is a canned cycle that generates the roughing cuts needed to make a component profile. R R = retract escaping B amount. F= feedrate for roughing. U1= depth of cut in X axis (Radius value) U2=finishing allowance in X axis (sign & Mag) W=finishing allowance in Z axis (sign & Mag) F U1 r F Programmed Path U2 A W M.nazmi ‹#› Prior to writing this command the tool is positioned at the start point. The sequence of tool moves are as follows: A- roughing cycle. 1- From the start position, the tool moves a distance U2 along the X axis and W along the Z axis at a rapid feed rate. 2- the tool moves the distance U1 along the X axis towards the billet centerline at a feed rates corresponding to the G code in the ns block. 3- the tool moves along the Z axis towards the spindle. The feedrate used is a stated in the second block of G71. 4- at this point the tool retracts in the X and Z axis away from the work at an angle of 45 degrees at a rapid traverse. feedrates. The amount R is stated in the first block of the G71. 5- the tool then retracts along the Z axis at a rapid feedrate until it reaches the start point of that same diameter. 6- from this point the above cycle is repeated until the programmed shape between ns and nf has been roughed out. 7- after all the roughing passes are completed a singled roughing profile pass is performed at G71stated feedrate. when this single pass is complete the tool will retract to the original starting position of the G71. B-finishing cycle. 8- if the next block contains G70 the same tool will be used to perform the finishing pass at feedrate and spindle speed contained between ns and nf. • should a different tool be required to perform the finishing pass: a) The block after nf would instruct the machine to move to a tool change position. b) The next block would instruct the machine to change to the tool required for the finishing pass. c) The next block would move the tool back to the original G71 starting position. d) At this point the finishing pass block would be read into the machine and executed. N ns …………F…..; ……….; F …….; S …….; Any F or S commands between ns to nf block N nf ……………….; numbers will only be effective on the finishing pass. G71 command is written in the following format: G71 U(1) R__; G71 P ns Q nf U(2) W_ F_; M.nazmi ‹#› Move commands are specified between program block numbers ns to nf. 9- When the finishing pass ends the tool will retract to original G71 start position. • In canned cycle G71 only an X axis move is permitted in the first block of the finished profile. • Only G00, G01, G02, G03 and G04 can be programmed between ns and nf blocks. 12 38 Dia 30 35 30 Dia 25 Dia 20 Dia 1.5 Chamfer 1 Rad 3 Rad N0050 N0060 N0070 N0080 N0090 N0100 N0110 N0120 N0130 N0140 N0150 N0160 N0170 N0180 G00 X38 Z2; start & finished position G71 U1.5 R0.5; P80 Q170 U2 W0.1 F0.15; G01 X16 F0.3; (ns) Z0.5; X20 Z-1.5 F0.05; Z-30 F0.075; X23; G03 X25 Z-31 R1; G01 X30 Z-65; Z-74; G02 X36 Z-77 R3; G01 X38.5; (NF) G70 P80 Q170; Finish pass G70 /Finishing Cycle G70 Pns Qnf • After part profile rough cutting has been competed using G71-G72-G73 codes the G70 can be used to perform a finishing pass/cut. • ns = the sequence number of the start block for the finishing pass. • nf = the sequence number of the last block for the finishing pass. • When the finished pass is ended the tool returns to the position it was originally at before G70 was commanded. • F and S between the sequence numbers ns and nf will be effectively in the G70 operation. M.nazmi ‹#› 20 Dia 1.5 Rad 32 Dia 15 N0070 N0080 N0090 N0100 N0110 N0120 N0130 N0140 N0150 N0160 N0170 N0180 15 1.5 Chamfer 15 G00 X16 Z2; G71 U1.25 R0.5; G71 P100 Q170 U-1.5 W0.07 F0.075; G01 X36 F0.3; Z0.5; X32 Z-15 F0.05; Z-15 F0.07; X20 Z-30; Z-43.5; G03 X17 Z-45 R1.5 F0.05; G01 X15.8; G70 P100 Q170; G72 /Stock removal in Z axis • similar to G71except that the cut is applied in the Z axes. G72 W(1) R__; G72 Pns Qnf U__ W(2) F__; F= feedrate. A r= rapid traverse. W1= depth of cut. U= finishing cut allowance in X axis. R=escaping amount. ns= sequence number of the first block of the programmed finished shape. nf= sequence number of the last block of the programmed finished shape. Programmed U= distance and direction of the finished Path allowance in the X axis. W(2)= finishing cut allowance in Z axis. F=feedrate for roughing. M.nazmi ‹#› W1 F r R U B W(2) • Only a Z axis move is allowed in the ns block. • If the finishing pass is required to block G70 Pns Qnf is placed after the G72 command has been completed. U 80 Dia N0050 N0060 N0070 N0080 N0090 N0100 N0110 N0120 N0130 N0140 N0150 N0160 60 Dia 60 Dia 40 Dia 10 10 10 20 Dia 20 10 G00 X81 Z2; G72 W2 R0.5; G72 P80 Q150 U0.5 W1 F0.1; G00 Z-60; G01 X80 F0.2; X60 W10 F0.075; W10; X40 W10; W20; X180 W11; W1; G70 P80 Q150; M.nazmi ‹#› G75 / grooving cycle. • G75 permits grooving in the X axis. Q G75 R(1); G75 X(U) Z(W) P__ Q__ R(2) F__; P X(U) R1 peck return amount. X(U) the diameter of the depth of the groove. Z(W) the width of the groove. P stepover in the X axis measured in microns. Q pecking debt in the Z axis measured in microns. R(2) R(1) z(w) • The retract amount R(2) at the base of the groove may be impossible unless a clearance amount has been provided. If no clearance amount has been left the R(2) value must be set to zero or omitted from the block. 3mm wide grooving tool Star position X52 Z-10.5 20 Dia 50 Dia N0060 N0070 N0080 N0090 N0100 N0110 40 G00 X52 Z-8; G01 X20 F0.075; G00 X52; W-2.5; G75 R0.5; G75 X20 Z-40 P5000 Q2500 R0.5 F0.075; M.nazmi ‹#› 5 G90 /outer diameter cutting cycle • The command G90 performs the one pass cutting cycle where the cut is applied in the x axis. • G90 is modal. W X/2 U/2 P4(R) P3(F) G90 X(U)_ Z(W)_ F_; P1(R) P2(F) • In this example both U and W are minus. Z • G90 can also be used to cut tapers. G90 X(U) Z(W) R_ F_; P4(R) P1(R) U/2 P3(F) W • To sign of R depends on the direction of path P1. In this example İt is entered as a minus value. Z 25 Dia 8 20 Dia 40 Dia 20 25 M.nazmi ‹#› N0060 N0070 N0080 N0090 N0100 N0110 G00 X41 Z2; G90 X35 Z-45 F0.1; X30; X25 Z-25; X20; X20 R-3.512; X/2 R P2(F) G94 /end face turning cycle W U/2 P1(R) P4(r) P2(F) • This command performs a one pass face cutting cycle. • The cut is applied in the Z axis. • G94 can also be used for cutting taper profiles. X P3(F) G94 X(U) Z(W) F_ Z • If repetition of the move is required only the values that changed needs to be entered into the next block. W P2(F) G94 X(U) Z(W) R_ F_ R X To sign of R depends on the direction of path P1. In this example It is entered as a minus value. P3(F) U/2 P1(R) R 60 Dia 5 5 5 M.nazmi ‹#› 20 Dia 10 Dia Z N0060 N0070 N0080 N0090 N0100 N0110 N0120 N0130 N0140 N0150 N0160 N0150 G00 X61 G94 X20 Z-5; Z-7.5; Z-10; Z-12.5; Z-15; G00 X21 Z-2.5; Z-5; G94 X10 Z-11 R-6; Z2; Z-2.5 F0.1; Z5; Z-7.5 R-2.5; Spindle speed • this spindle speed specified by the word address S in any block of a program may be interpreted in two ways depending on the mode selected. these are: G96 / constant surface speed • • • • • • The spindle speed is calculated so that the surface speed is always the specified value (in S) in relation to the tool position. The units used will depanned on whether the machine is operating using metric or Imperial measurements. G96 units can therefore be meters pair minutes, or feet per min. When using G96, the work datum point must be set so that the center of rotation meets the Z axis. G50 code defining clamping off maximum spindle speed must be used in conjunction with G96, so as not to overrun the safe maximum spindle speed off the chuck. G96 is modal. G97 / spindle speed in Rev Per Minute • • G96 S___; G97 S__; Once G97 is entered all subsequent spindle speeds are defined in revolution per minutes. G97 is the default mode at power up. G98 / Fee per Minute G98 F__; • This command allows a feedrate written in the units, millimeters per minute or inches per minute to be entered into the machine controller. • G98 is modal therefore if a change to the feedrate is required within a program, only the F value needs to be entered. • G98 is the default condition at power up. G99 / Per Revolution Feed G99 F__; • G99 results in feed rate of millimeters or inches per revolution depending on the previously selected units. • G99 is modal M.nazmi ‹#› M Codes: M?? • Miscellaneous functions, called M codes, are used by the CNC control to command on/off signals to the machine functions. • The functions allocated are constant in most CNC machines however some can vary from one make of the machine to the next. • Only one M code can be programmed within each block. M00 M01 M02 M03 M04 M05 M06 M08 M09 M10 M11 M13 M14 M25 M26 M30 M38 M39 M40 M41 M98 M99 program stop optional stop end of program spindle forward (clockwise) spindle reverse (counter clockwise) spindle stop automatic tool change coolant on coolant off chuck open chuck close spindle forward and coolant on spindle reverse and coolant on tailstock quill extend tailstock quill retract program stop and reset door open door close parts catcher extend parts catcher retract sub program call sub program end and return Main prog. Sub prog. 1 Sub prog. 2 O0001 N0020 N0030 N0040 N0090 N0100 N0110 O1000 N0020 N0030 N0040 N0090 N0100 N0110 O2000 N0020 N0030 N0040 N0090 N0100 N0110 ……; ……; M98 P1000; ……; ……; M30; M.nazmi ‹#› ……; ……; M98 P2000; ……; ……; M99; ……; ……; ……; ……; ……; M99; 7- G&N programming for CNC Milling Machine DATUM: •Machine datum: Sometimes referred to as the zero datum defines the zero point of all axes which is fixed by the manufacturer. We can use zero offset facility to move this datum. •Program datum is specified by the programmer when the program is written. All subsequent measurements are then made relative to this new “program” datum. Z Y X M.nazmi ‹#› Co-Ordinate Dimensioning: There are two types of co-ordinate dimensioning systems used in CNC programming: •Incremental: where next position measurements are taken relative to the current position. - an error made in one dimension will effect subsequent measurements - if a dimension changes then the rest of dimension will have to be changed •Absolute: Dimensions are always measured from the same datum position therefore there are no build-up or accumulation of errors between dimensions. Y X 2 1 3 4 5 6 Incremental Absolute X X Y 1 2 3 4 5 6 1 2 3 4 5 6 M.nazmi ‹#› Y 2 holes on CL, 8 Dia x 10 deep 20 12 147 20 8 8 25 8 98 11 N0000 G00 X00.0 Y00.0 M.nazmi ‹#› Z00.0 F0000 M00 S0000 T00; O0001 N0010 G21; metric measure [BILLET X98 Y147 Z36;size of work piece [TOOLDEF T3 D8 Z20; define tool [EDGEMOVE X0 Y0 Z0; force billet datum to be at workpiece datum / for simulation set X datum to 20 / this means we have room to move to the left the billet N0015 M6 T3; pick tool N0020 G90; Go home - absolute N0040 G00 X-4 Y4 Z-25; 1st move N0050 M03 S1500; Spindle on N0060 G01 X94 F120; 2nd cut N0070 Y143; 3nd cut N0080 X-4; make sure no corner remains N0090 Y139; N0100 X93; 4rd cut complete N0110 G00 Y140; N0120 X4; ready for last cut N0130 G01 Y4; last cut round / N0140 G00 Z10; lift clear N0150 X49 Y20; position over 1st hole N0150 G01 Z-10; N0160 G00 Z10; N0170 Y127; Over 2nd hole N0180 G01 Z-10; N0190 G00 Z10; Retract / N0200 Y73.5; Over the slot center N0210 G01 Z-5; N0220 G91; incremntal N0230 X30; N0240 X-60; N0250 G00 z10; N0260 G90; N0270 M02; N0280 M30 M.nazmi ‹#› G00 /Rapid positioning & traverse G00 X10 Y20 Z30 • Executes non cutting movement (point-to-point) at a rapid feed rate. • Axis co-ordinate moves can be absolute or incremental • G00 freezes tool radius compensation and axis movement are independent of each other. • G00 is modal G01 /Linear interpolation • • • • G90 G01 X100 Y50 F170 Executes cutting movement along a straight line at a given feed rate Axis co-ordinate moves can be absolute or incremental G01 is modal F is modal and is specified as inches per minute (G20) or millimeters per minute (G21) G02-G03 /Circular interpolation •G02 (CW) and G03(CCW) executes a cutting movements in circular path. •There are four ways to program a CW/CCW circular path: G90 G02/03 X-- Y-- R-- F-- [can use G91] arc end point in X&Y (absolute/incremental). R length of arc radius. F feed rate. G90 G02/G03 X-- Y-- I-- J-- F-- [can use G91] I-- J-- defines the signed distance of the arc start point from the centre point of the arc. •For arcs exceeding 180 degree the radius value R-- must be specified as negative. •When X or Y are omitted the arc end point is located at the same position as the arc start point and the arc center is commanded by I or J, an arc of 360 degree is assumed. M.nazmi ‹#› G04 /Dwell G04 X-- (time in seconds) G04 P-- (time in 1 milliseconds) G04 X1.5 G04 P2500 • Used to enter a set time delay into the program. • No decimal points can be used with address P • Dwell is performed at the start of the block in which it is programmed. • G04 is non-modal G20-G21 /Data input unit G20 G21 Imperial/Inch Metric/Millimeter lowest value 0.0001 lowest value 0.001 • Do not switch between G20/G21 during a program G28 /Reference point return G28 X-- Y-- Z-• the reference point is a fixed position on the machine to which the tool can be moved. (home position) • X/Y/Z can be used to indicate an intermediate point through which the tool will pass before continuing to the reference point. • G28 is non-modal G40-G41-G42 /Cutter compensation • G41/42 the tool is positioned on the left/right hand side of the part (programmed path) as seen following the direction of movement from behind the tool. • G40 cancels cutter compensation • The radius of the tool (amount compensated by) should have been set in the machine controller. M.nazmi ‹#› G40-G41-G42 /Cutter compensation • G41/42 the tool is positioned on the left/right hand side of the part (programmed path) as seen following the direction of movement from behind the tool. • G40 cancels cutter compensation • The radius of the tool (amount compensated by) should have been set in the machine controller. • A start-up or ramping on block must be used to allow the tool time to change from moving along he programmed path line to following either side of the path line. Therefore: G41/42 must be contained in the block or specified in the previous block and A G01 is specified in the block and the distance of the linear move must be greater than the tool compensation • The tool offset store in the table must not be 00 G02 or G03 can not be specified in the start-up block G40/41/42 are modal G40 can only be performed in a block in which a linear move (G00-G01-G28) is performed 2 holes on CL, 8 Dia x 10 deep 20 12 147 20 8 8 25 8 98 11 M.nazmi ‹#› Caned cycles (G73-G89) simplifies the program by replacing a number of complex machine sequence blocks with just one block. G98 - initial point return G99 - R point level return G81 /Drilling- spot boring G90/G91 G98/G99 G81 X-- Y-- Z-- R-- K-- F--; G90 G81 X10 Y30 Z-17 R2 F75; G91 G99 G81 X10 Y6 Z-10 R-8 K4 F100; • • • • • Rapid position to XY (initial level) Rapid traverse to R point level Feed to depth Z Rapid traverse to initial Z level (G98) or R point (G99). K defines the number or repeats G90-G91-G42 /Absolute/incremental data format XY R G98 XY G98 R G99 G99 Z=0 Z=0 Z Z • Z defines the distance from the R point to the bottom of the hole in incremental mode or the position of the hole bottom in absolute mode. • R defines the distance from the initial level to the R point level in incremental mode or the position of the R point level in absolute mode. M.nazmi ‹#› G82 /Drilling- counter boring G90/G91 G98/G99 • • • • • • G82 X-- Y-- Z-- P-- R-- K-- F--; Rapid position to XY (initial level) Rapid traverse to R point level Feed to depth Z Dwell for value P Rapid traverse to initial Z level (G98) or R point (G99). K defines the number or repeats G80 /Canned cycle cancel • The data specified (ZPQR) is retained until it is either changed or the canned cycle cancelled. G73 /high speed peck drilling G90/G91 G98/G99 • • • • • • • G73 X-- Y-- Z- Q-- R-- F--; Move rapid to XY Move rapid to R Feed to a depth of Q Retract a small distance Re-feed to a further depth of Q Retract and repeat till Z is reached Retract to R or initial level as specified G 83/deep hole peck drilling • • • • • • • Rapid position to XY Move rapid to R Feed to a depth of Q Retract rapid to R Rapid traverse back to within 1mm depth of Q cut Feed to a further depth of Q Retract to R and repeat till a depth of Z is reached G 84 /Tapping G74 /Counter Tapping G76 /Fine Boring G 85-G86-G89 /Boring G 87 /Back boring M.nazmi ‹#› G170 - G171 /circular pocket canned cycle • The canned cycle required two blocks G170&G171 • There are three ways to program these canned cycles G170 R0 P0 Q3 X0 Y0 Z- nI0 J0 K-24; rough cut no allowance G171 P75 S3000 R75 F250 B J; For 1st block • R defines the position of the tool to start cycle • P =0 means a roughing cycle • Q defines the peck (vertical cut) increment • XY defines the hole centre • I defines the side finish allowance • J defines the base finish allowance • K defines the radius of the pocket (- means CCW) For 2nd block • P defines the cut width percentage • S roughing spindle speed • R roughing feed in Z • F roughing feed in XY • B finished spindle speed (ignored when P=0) • J finish feed (ignored when P=0) • When the tool has finished cutting the tool retracts 1mm in the Z axis, moves to the centre of the circular pocket at rapid traverse, retracts again in the Z axis. G170 R0 P0 Q3 X0 Y0 Z-- I0.5 J0.1 K-24; rough cut WITH G171 P75 S3000 R75 F250 B3500 J200; finishing allowance G170 R0 P1 Q3 X0 Y0 Z-6 I0.5 J0.1 K-24; One step finishing cycle G171 P75 S3000 R75 F250 B3500 J200 • I&J are ignored when P=1 • S&R&F must be entered but ignored for finishing cycle M.nazmi ‹#› G172 - G173 /Rectangular pocket canned cycle • The canned cycle required two blocks G170&G171 G172 I-50 J-50 K0 P0 Q3 R0 X-25 Y-25 Z-6; Roughing cut G173 I0 K0 P75 T1 S3000 R75 F250 B3500 J200 Z5; For 1st block • I defines the pocket X length (+ CW/ - CCW) • J defines the pocket Y length • P=0 roughing cycle • Q defines Z peck increment • R defines the absolute Z R point • XYZ absolute position of the pocket corner points For 2nd block • I pocket side finish allowance (=0 when P=0) • K Pocket base finish allowance (=0 when roughing) • P is the cut width percentage • T is the pocket tool • S roughing spindle speed • R roughing feed for Z • F Rouging feed for X and Y • B finish spindle speed • J finish feed • Z safety Z above R. G172 I-50 J-50 K0 P0 Q3 R0 X-25 Y-25 Z-6; rough cut WITH finish G173 I0.5 K0.1 P75 T1 S3000 R75 F250 B3500 J200 Z5; G172 I-50 J-50 K0 P1 Q3 R0 X-25 Y-25 Z-6; One step finishing cycle G173 I0.5 K0.1 P75 T1 S3000 R75 F250 B3500 J200 Z5; M.nazmi ‹#› G90 /Absolute command Active when machine is first switched on G91 /Incremental command G94 /Feed per minute (G29) F6= 6 inches/min (G21) F150= 150 mm/minute G95 /Feed per revolution of spindle List of G Codes (Milling machine) G00 G01 G02 G03 G04 G20 G21 G28 G40/G41/ G73-G89 G73 G74 G76 G80 G81 G83 G84 G85 G86 G87 G89 G90 G91 G94 G95 G98 G99 G170-G173 positioning (rapid traverse) liner interpolation (feed) circular interpolation CW circular interpolation CCW dwell inch data input metric data input reference point return Canned cycles High speed peck drilling Counter tapping Fine boring Canned cycle cancel Drilling – counter boaring Deep hole peck drilling Tapping Boring Boring Peck boring Boring Absolute zero command Incremental command feed per minute feed per revolution Return to initial level Return to R point Cirular/Rect pockets M.nazmi ‹#›