Axes designation Part programming fundamentals
November 6, 2017 N. Vijaya Kumar
Part program writing Word address format Part programming manual (actual machine tool and control)
November 6, 2017 N. Vijaya Kumar
Word address format N035 G01 X120.5 Y55.0 Z-12.0 F150 M03; N035 refers to the block number 35 G01 refers to a preparatory code 1 for linear interpolation X120.5 refers to X coordinate value 120.5 units Y55.0 refers to Y coordinate value 55.0 units Z-12.0 refers to Z coordinate value -12.0 units F150 refers to a feed rate of 150 units/min M03 refers to a miscellaneous code value of 3 that starts the spindle in the clockwise direction ; refers to the end of block November 6, 2017 N. Vijaya Kumar Word address format A Angular dimension around X axis B Angular dimension around Y axis C Angular dimension around Z axis D Angular dimension around special axis or third feed function E Angular dimension around special axis or second feed function F Feed function G Preparatory function November 6, 2017 N. Vijaya Kumar Word address format H Unassigned I Distance to arc centre or thread lead parallel to X J Distance to arc centre or thread lead parallel to Y K Distance to arc centre or thread lead parallel to Z
November 6, 2017 N. Vijaya Kumar
Word address format M Miscellaneous function N Sequence number O Reference rewind stop P Third rapid traverse dimension or tertiary motion dimension parallel to X Q Second rapid traverse dimension or tertiary motion dimension parallel to Y R First rapid traverse dimension or tertiary motion dimension parallel to Z
November 6, 2017 N. Vijaya Kumar
Word address format S Spindle speed function T Tool function U Secondary motion dimension parallel to X V Secondary motion dimension parallel to Y W Secondary motion dimension parallel to Z X Primary X motion dimension Y Primary Y motion dimension Z Primary Z motion dimension
November 6, 2017 N. Vijaya Kumar
Word address format N5 G2 X53 Y53 Z53 U..V..W..I..J.. K..F5 S4 T4 M2 ;
November 6, 2017 N. Vijaya Kumar
Coordinate Function The various word addresses used for specifying coordinates are X, Y, Z, U, V, W, I, J, K, A, B, C, etc. They can be specified using a direct decimal format. N025 T01 M03 S1000 ; N030 G01 X15.450 Y35.540 Z-2.0 F120 ;
N035 X-25.500 Y55.545 ;
N045 X15.450 Y35.540 ;
November 6, 2017 N. Vijaya Kumar
Feed Function Generally the feed rate is specified with F word address and specified in mm per minute. The value specified normally is the speed with which the spindle moves along the specified path. For example, F120 in the above statement means that the feed rate is specified as 120 mm per minute (assuming metric units are used in the program). November 6, 2017 N. Vijaya Kumar Feed Function It is also possible to specify feed using the mm per revolution units, with a special preparatory function. The feed rate specified in any block remains modal. It is possible to change programmed feed by the use of feed rate over switch on the machine tool control panel.
November 6, 2017 N. Vijaya Kumar
Speed Function The spindle speed can be set using the S word address. The number after the S is the speed of the spindle specified directly in revolutions per minute. For example, S1000 in the above statement means that the spindle speed is specified as 1000 revolutions per minute.
November 6, 2017 N. Vijaya Kumar
Speed Function Though this is the normal usage, it is also possible to specify the spindle speed in cutting speed units as meters per minute using a special preparatory function.
November 6, 2017 N. Vijaya Kumar
Tool Function The tool to be used for an operation is to be identified by the T word address. For example, T01 in the above statement means that the tool number 1 is to be placed in the spindle. The tool number is considered as the tool magazine position in the case of machines with automatic tool changers.
November 6, 2017 N. Vijaya Kumar
Tool Function In some cases the tool number may also have to be combined with the tool offset register number, which is described later.
November 6, 2017 N. Vijaya Kumar
Preparatory functions The preparatory functions are denoted by the word address 'G'. This function principally controls the geometric functions of the controller. It generally has two digits, e.g. G01, G42, and G90 as per ISO specifications. Many of the current day controllers have extended this to 3 or 4 digits.
November 6, 2017 N. Vijaya Kumar
Preparatory functions Most of the G codes are modal in nature, so that they need not be repeated in every block. Another point to be noted with these codes is that the G codes are divided into various groups depending upon their functionality. It is expected that only one code from each of the group should be given in any given block. November 6, 2017 N. Vijaya Kumar Preparatory functions It is generally possible to include more than one G address in one block, provided these functions are not mutually exclusive. In GE-Fanuc controls upto 5 G codes can be given in one block. Some other controls have different limits, but generally upto 3 codes in a single block will be permissible.
November 6, 2017 N. Vijaya Kumar
Preparatory functions It should also be noted that some of the G codes remain in force when the control is started or reset. These are termed as default or turn on codes. Though it is a prudent practice, to specify all the necessary G codes while writing the programs, some times it may be possible by the experienced programmers to take advantage of these default codes and reduce the length of the program. November 6, 2017 N. Vijaya Kumar Preparatory functions (Motion group )
*G00 Rapid Positioning
G01 Linear Interpolation G02 Circular interpolation Clockwise G03 Circular interpolation Counter clockwise * Generally specified as default code
November 6, 2017 N. Vijaya Kumar
Preparatory functions (Active plane selection group )
*G17 XY Plane selection
G18 XZ Plane selection G19 YZ Plane selection * Generally specified as default code
November 6, 2017 N. Vijaya Kumar
Preparatory functions Units group *G70 Inch units G71 Metric units
Co-ordinate system group
*G90 Absolute co-ordinate system G91 Incremental co-ordinate system * Generally specified as default code
November 6, 2017 N. Vijaya Kumar
Co-ordinate system group, G90 and G91 The coordinate data can be input into the program either in the absolute or in the incremental system. The absolute coordinate system is indicated by the preparatory function G90. In absolute system, the dimensions are given with respect to a common datum established by the programmer.
November 6, 2017 N. Vijaya Kumar
Co-ordinate system group, G90 and G91
Fig from P N Rao – CAD/CAM Principles and
Applications, Tata McGrawHill November 6, 2017 N. Vijaya Kumar Absolute Programming Suppose the route to be 0-A-B-C in absolute programming system N010 G90 G01 X15.0 Y15.0 F200; Point A N015 X25.0; Point B. Notice no change in Y-axis N020 X45.0 Y10.0; Point C G90 code is modal and will remain in force till it is cancelled by another code from the same group, i.e., G91 for incremental programming.
November 6, 2017 N. Vijaya Kumar
Absolute Programming Suppose the route to be 0-A-C-B then: N010 G90 G01 X15.0 Y15.0 F200; Point A N015 X45.0 Y10.0; Point C N020 X25.0 Y15.0; Point B.
November 6, 2017 N. Vijaya Kumar
Incremental Programming In the case of incremental programming the G-code used is G91. In incremental programming, the actual distance moved by the tool from the current position is programmed. Unlike with G90, the programmed data changes only if the route of the move is altered.
November 6, 2017 N. Vijaya Kumar
Incremental Programming The program for route 0-A-B-C would be: N010 G91 G01 X15.0 Y15.0 F200; Point A N015 X10.0; Point B. Notice no change in Y-axis N020 X20.0 Y-5.0; Point C
November 6, 2017 N. Vijaya Kumar
Incremental Programming When route is changed to 0-A-C-B, then the program will be: N010 G91 G01 X15.0 Y15.0 F200; Point A N015 X30.0 Y-5.0; Point C N020 X-20.0 Y5.0; Point B.
November 6, 2017 N. Vijaya Kumar
Absolute and Incremental Programming While writing NC program in incremental mode, care has to be taken to designate the actual movement of the tool in the positive or negative axis direction. This is true even when the movement of the tool is in the first quadrant, still some of the movements have been identified as negative because the tool is moving in the negative axis direction.
November 6, 2017 N. Vijaya Kumar
Absolute and Incremental Programming
It is generally suggested that a fresh
programmer may stick to programming in absolute system in the beginning. This will help in reducing the possible mistakes in specifying the coordinates. Any error in coordinates in absolute programming will result in only an error in that part, while in the case of incremental programming the error will continue further down in all subsequent blocks. November 6, 2017 N. Vijaya Kumar Units group, G70, G71 The CNC part programs can use either inch units or metric units. The choice will have to be specified in the beginning of the program. The codes used are G70 for inch programming and G71 for mm programming. The program units cannot be changed in between.
November 6, 2017 N. Vijaya Kumar
Units group, G70, G71 In GE-Fanuc controls normally G20 and G21 are used for the units in place of G70 and G71. This can be changed optionally to G70 and G71 using the programmable functions of the control system.
November 6, 2017 N. Vijaya Kumar
Active plane selection group, G17, G18, G19 Some of the functions in NC control can only work in a plane rather than in all the 3 possible co-ordinate axes. This therefore requires the selection of active plane. This can be done by using these codes G17, G18, G19 .
November 6, 2017 N. Vijaya Kumar
XY plane selection for vertical axis milling machines
November 6, 2017 N. Vijaya Kumar
XY plane selection for Horizontal axis milling machines
November 6, 2017 N. Vijaya Kumar
XZ plane selection for vertical axis milling machines
November 6, 2017 N. Vijaya Kumar
YZ plane selection for vertical axis milling machines
November 6, 2017 N. Vijaya Kumar
Absolute Preset, G92 As described earlier, each of the machine tool has a separate machine reference point. However, this point is not very convenient to use as a co-ordinate datum for the part. Most of the NC machine tools allow for a 'Floating Datum' to be fixed anywhere in the machining envelope of the machine tool.
November 6, 2017 N. Vijaya Kumar
November 6, 2017 N. Vijaya Kumar Absolute Preset, G92 As a result, the programmer can choose a convenient position on the part as datum, which may be referred to as 'Program Zero Point'. The same will have to be communicated to the NC controller as datum. N015 G92 X2.0 Y1.0 Z1.0 ;
November 6, 2017 N. Vijaya Kumar
Work piece datums G53 to G56 are the other codes used for setting the programmable datum positions. These would allow for a fixing a number of positions on the machine table whose co- ordinates can be entered into the controller as a permanent memory. When required their positions can be simply called by giving the particular G code in the program. November 6, 2017 N. Vijaya Kumar November 6, 2017 N. Vijaya Kumar Work piece datums This would also be useful for machining a batch of components all of which are located on the machine table each at the positions indicated by G53, G54, etc.
November 6, 2017 N. Vijaya Kumar
Motion group, G00, G01, G02, G03
This is the most important group of
codes used in part programming. Most of the common motions are specified using this set of codes. G00 is normally the turn on code from this list.
November 6, 2017 N. Vijaya Kumar
Rapid Positioning, G00 This is used for moving the tool at a rapid rate (normally the maximum available feed rate such as 8,000 or 40,000 mm/min) along the axes involved for achieving the position programmed. It is not important for this code, the path taken by the tool to reach the programmed point.
November 6, 2017 N. Vijaya Kumar
Rapid Positioning, G00 This is a modal (stays active till cancelled by any other function of its family, i.e., G01, G02, G03) function. It is also the 'turn on mode' (available as soon as the system is switched on or when a new program starts). Referring to Fig. 13-13, from position A, it is required to achieve position B.
November 6, 2017 N. Vijaya Kumar
Rapid Positioning, G00
November 6, 2017 N. Vijaya Kumar
Linear or Straight line Interpolation, G01
This code is generally used when the
material is to be cut using a feed rate. When the motion is desired along a straight line at a given feed rate, this function is used. It is modal.
November 6, 2017 N. Vijaya Kumar
November 6, 2017 N. Vijaya Kumar Circular Interpolation, G02 / G03 When an arc is to be traversed in a plane, the function G02 or G03 is used if the direction of the motion is clockwise or anti-clockwise respectively, looking in the negative direction of the axis perpendicular to the plane.
November 6, 2017 N. Vijaya Kumar
November 6, 2017 N. Vijaya Kumar November 6, 2017 N. Vijaya Kumar Dwell, G04 This is to give a delay in the program. When the G04 code is encountered, the controller stops at that particular point for a specified time mentioned in the block. After that time the controller continues to execute the next block in the program. The delay time is normally mentioned in seconds using the X word address. In some controls, other than X may also be used. November 6, 2017 N. Vijaya Kumar Dwell, G04 N045 G04 X3.0; This calls for a stoppage of the control for a period of 3 seconds. N045 G04 P3000; This calls for a stoppage of the control for a period of 3 seconds.
November 6, 2017 N. Vijaya Kumar
Miscellaneous Functions, M These functions actually operate some controls on the machine tool and thus affect the running of the machine. Generally only one-M code is supposed to be given in a single block. However, some controllers allow for two or more M codes to be given in a block, provided these are not mutually exclusive, e.g., coolant ON (M07) and OFF (M09) cannot be given in one block. November 6, 2017 N. Vijaya Kumar Miscellaneous functions Less number of M codes have been standardized by ISO compared to G codes in view of the direct control exercised by these on the machine tool.
November 6, 2017 N. Vijaya Kumar
Miscellaneous functions M00 Program Stop This would terminate the auto operation of the machine after completing the instructions in the block in which it has been programmed. This is called 'Program stop' and if it is required to continue with the rest of the program, the 'start' button on the console is to be pressed. November 6, 2017 N. Vijaya Kumar Miscellaneous functions M00 Program Stop This is useful for changing the clamp position or to carry out inspection of a particular dimension after a machining cut is taken. This being a pause function, and calls for the attention of the operator, delays the completion of the program and therefore should be avoided as far as possible.
November 6, 2017 N. Vijaya Kumar
Miscellaneous functions M01 Optional stop This is 'Optional stop' and stops the machine, as in the case of M00, only if the "Optional stop" switch on the controller console is 'ON'. This is useful when inspection is to be carried out on some components and not all in a given batch.
November 6, 2017 N. Vijaya Kumar
Miscellaneous functions M02 End of program This is 'End of program' and it causes the stopping of the machine and clearing of all the control registers. Another code M30 also does the same function.
November 6, 2017 N. Vijaya Kumar
Miscellaneous functions M03 Spindle start – clockwise direction This miscellaneous function for machine spindle control for clockwise rotation. This starts the spindle to move in the clockwise direction at the speed set earlier using the S word address. When it is given in a block would be the first code to be executed before all the other codes in a block are acted upon.
November 6, 2017 N. Vijaya Kumar
Miscellaneous functions M04 Spindle start – Counter clockwise direction This miscellaneous function for machine spindle control for counter clockwise rotation. This starts the spindle to move in the counter clockwise direction at the speed set earlier using the S word address. When it is given in a block would be the first code to be executed before all the other codes in a block are acted upon. November 6, 2017 N. Vijaya Kumar Miscellaneous functions M05 Stop the machine spindle It is the miscellaneous function for stopping the machine spindle. When it is given in a block would be the last code to be executed after all the other codes in a block are acted upon.
November 6, 2017 N. Vijaya Kumar
Miscellaneous functions
M06 is for tool change.
M07 is for 'Coolant 1 On' M08 is for 'Coolant 2 On' M09 is for 'Coolant Off'
November 6, 2017 N. Vijaya Kumar
Miscellaneous functions M13 the miscellaneous function for machine spindle control for clockwise rotation and the starting of the coolant simultaneously. This starts the spindle to move in the clockwise direction at the speed set earlier using the S word address. When it is given in a block would be the first code to be executed before all the other codes in a block are acted upon. November 6, 2017 N. Vijaya Kumar Miscellaneous functions M30 is similar to M02. It indicates 'End of tape' and 'tape rewind'. If a paper tape is used, the tape is rewind till the % sign is encountered. For machines working with RAM, the active program comes to the beginning. Many a times M02 and M30 are synonymous in operation in modern day controllers.
November 6, 2017 N. Vijaya Kumar
Program Number Program number is specified by O word address, generally. It is not essential, but useful for storage purposes.