PART PROGRAMMING FOR CNC MACHINES Numerical control codes — standards — Manual Programming — canned cycles and subroutines — computer Assisted programming — CAD/CAM approach to NC part programming — APT language, machining from 3D models. A part program is a set of instruction providing x, y and z coordinates and other details to perform the desired machining operations. It directs how the tool should move with respect to work piece (or) vice versa. A part program consists of all information necessary to complete the machining of a component. In olden days, the part programs are coded on the punched tape: Nowadays, the punched tapes are replaced by floppy disk and CDs. The punched tape is prepared according to the part program manuscript. The punched tapes are 1 inch wide (25.4 mm). It was standardized by the Electronics industries Association (EIA). The sample punched tape is shown in fig. The punched tape is fed through the tape reader once for each component.
There are eight columns of holes as shown in fig. There is one column of sprocket holes in between 3’ and 4 columns to feed the tape. The coding of the tape is obtained by either the presence (or) absence of a hole in the various positions. This coding system uses the binary digit. A binary digit is called a bit. It has a value 0 (or) 1 to represent absence (or) presence of a hole in a particular row and column position of the tape. The columns of] holes run lengthwise along the tape. Row positions run across the tape. In the row of bits, a character is formed. A character is a combination of bits Representing a letter, number and symbol: A word is. a collection of characters forming part of instruction. The collection of words forms a block. A block of words gives one set of instruction. Each block of information is separated by End-ofblock (EOB) symbol in the column. The part program is denoted by the symbol %. It defines the sequence of ONC machining operation. Each block contains the following, types of words to perform a movement and functions. 1. Sequence Number (N—word (or) N codes) 2; Preparatory functions (G’-words (or) G code) 3. Coordinate words (X, Y, Z words) (or) Dimension words. 4. Speed rate (S word (or) S code) Feed rate (F word (or) F code) Tool selection (T word (or) T code) Miscellaneous function (M word (or) M code) End of Block (EOB/*) 1. Block Number (or) Sequence Number (N words) This sequence number is used to identify the sequence of block of data. It is usually given in ascending order. This is useful for the operator to know which sequence of block, is performed by the tool. It consists of alphabet N followed by ‘0’ to ‘999’. (Eg) N5, N Ni50.... 2. Preparatory functions (G—words (or) G codes) G words are used to prepare the MCU to be ready to perform a specific operation. These .words are used to prepare the machine to perform a particular function like positioning, contouring, thread ‘cutting and machining. The following are the codes of various preparatory functions.
Example 1: Refer the following Fig. Using absolute dimensioning mode and metric units write the part program only for positioning; First of all, position the tool to PT1, PT2, PT3 then and finally PT4.
Example 2: Write the part program for the following figure only for positioning the tool; Position the tool PT1, at first then Ff2 and finally PT3. Locate the part reference point in absolute dimensioning and use incremental dimensioning mode for other dimensions of the part.
Miscellaneous (or) Auxiliary Function (M Code) The functions like coolant on (or) off, spindle rotation start etc are ‘known as miscellaneous functions. The following are important M codes for various miscellaneous functions.
Dimension words (X, Y, & Z words) (or) coordinate words Ø Linear dimension words. Ø X, Y, and Z are used for primary motion. Ø U, V, W are used for secondary motion parallel to X, Y and Z axes respectively. Ø p, q, r are used for another - type of motion parallel to X, Y and Z respectively. (ii) Angular Dimension words: Ø
a, b, and c (or A, B, and C) are used for rotary motion about X, Y, and Z axes respectively. Ø I, J, K is used for position of- arc centre, thread lead parallel to X, Y, Z axes in case of thread cutting. The decimal point is not allowed in this word. So 5.675 mm in X direction will be represented as X 05675. The last three digits of X05675 are used for the decimal part of the number. Some machines a X5675 by omitting leading Zeros. Feed Rate Word (F word (or) F Code) The rate at which the cutting tool (or) cutter travels through the material is expressed in mm/mm (or) mm/rev. The F word is used to program the proper Feed rate. This word is mostly used for contouring system (or) straight line system F200 means a feed rate of 200 mm/mm Spindle Speed (or) Culling speed word (S word (or) $ code) This word indicates the spindle rpm (or) the constant cutting speed in m/min S1000 indicates that sp rotates at 1000 rpm .Thus this code is represented by S followed by the three digit number
Tool selection word (T word (or) T code) This code is represented by ‘T’ followed by maximum five digit number. Different cutting tools arc indicated by different numbers. The Automatic Tool Changers (or) turrets select the appropriate tool when ‘T’ word calls out a particular tool that has to be used for cutting. D—word This• word is used for cutter nose radius compensation and cutter length compensation. Standards in Programming Format: The following are the standard formats used for programming. 1. Word Address Format 2. Tab Sequential Format 3. Feed block Format Word Address Format In this format, alphabets are called address. The alphabets N, G, XYZ, S, F, T and M are separate addresses giving standard meanings. The MCU, uses these alphabets for addressing a memory location on it. In this format, the block of instruction may be of any length. And the words can be placed in any sequence since the letter address will search and identify the corresponding word. The sample word address format is shown here.
Tab sequential Format In this tab sequential Format; the words are given in sequential order. For example, the following block of instruction
can be given an follows:
The MCU reads first Tab and stores the data in the address corresponding to sequence number. Then the second word is recognized as preparatory function. Similarly, all the words are read and stored in particular addresses. If next block contains same X and Y words and other words are changed, then the format become So, only changed words can be given and other unchanged words need not be repeated. Fixed Block Format In this fixed block format, -the instructions are given in a standard sequence and the block contains a fixed number of characters: There are no letter addresses (or) Tab codes and no words are omitted. Even if any
data remains same as in previous block, it should be repeated in the next block also. A sample fitted block format is shown below: In this format, the first three digits represent the sequence number, the next two digits represent preparatory function, next three consecutive 5 digits represent X, Y, and Z coordinates respectively, next three digits — Feed rate, next four digits — speed, Next two for tool number, next two digits tool compensation, next two digit miscellaneous function and last digit for EOB. Different CNC machines have different fixed formats. For example, an CNC lathe has only X and Z word and it does not have Y word. Manual Part Programming The programming consists of the following procedure.
Preparing CNC coordinate drawings To write the program, first to all, we have to convert the Engineering drawing (or) shop drawing into CNC coordinate drawing. This can be done by using any one of the following dimension system.
and Incremental dimensioning The above dimensioning systems have been studied in the last chapter Process Planning: The second step. is to plan the sequence of operations. If so many machining operations have to be performed on a particular component, then the programmer has to decide the sequence of operations and the machines. By this decision he can make a route sheet. The route sheet will give information whether the milling should be done first (or) drilling should be done first.. The shortest and most efficient path can be found and followed by preparing route sheet. Past programming and manuscript: By using route sheet, the programmer can prepare a ‘program manuscript’ manually to give all machining instruction. Now, all addresses are added to the sequence of operations. The feed rate, spindle speed and miscellaneous functions are also added. The sample program manuscript is shown below:
Preparation of punched tape (or) preparing floppy (or) CD In olden days, using manuscript, a pinched tape in prepared with the help of teletypewriter. Nowadays, the program is typed L a computer using key board and the file is saved as a file in hard disk, floppy and also in CD. Verification By using the prepared program, we can i the machine and do the operations on wooden block and we can check the accuracy of the program. By analysing- the completed wooden work part, we .can decide whether the part machined is acceptable or not. In another method, a pen plotter i used to draw the path of the cutter, movement of table on a paper and also to locate the centre of holes to be drilled and reamed. The plotter drawing will be compared with the original drawing for deviation. Production of components The last step is to produce the actual parts. Part programming for PTJ’ (Point to Point) machining: In this PTP, the cutting tool, (or) workpieee moves fast from one point to another point for drilling (or) boring or teaming etc. Once the point is located, the drilithg yperation gets started as per part program. As soon a drilling is over, the drill comes out of the hole and goes to next poiat in rapid traverse since there is no machining in between two points. Example 3: Write the part program for the following figure. The Z position is zero at 100 mm above the table surface.
Procedure 1. First of all, the work piece should be aligned so that the edge AX coincides with I axis. AY coincides with Y axis of the machine. 2. 3.
Set the tool tip at origin B (0, 0, 0) at a height of 60 mm above the work piece corner A. For drilling first hole P the tool should travel through 25 mm in X and 30 mm in Y direction and —83 mm in Z direction (i.e. 60 + 20 + 3). The extra 3 mm is to ensure through hole in the plate, ‘—‘sign for downward direction. Part Program (To avoid confusion, x, y, z values can be given without decimal part).
NO! G92 XQ YO FO Set the position ‘A’ of the plate (work piece) under the drill at point B. 092 for position preset (or) Datum preset. N02 G71. G90 G94 Move the tool worth rapid traverse to point P
N14 G01l Z-83 Drill the hole at P point
N GOO Z-58