36
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-of- block (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.

CAM-UNIT-4

Embed Size (px)

Citation preview

PART PROGRAMMING FOR CNC MACHINESNumerical 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 thedesired machining operations. It directs how the tool should move with respect to work piece (or) viceversa. 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 replacedby 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 industriesAssociation (EIA). The sample punched tape is shown in fig. The punched tape is fed through the tapereader once for each component.

There are eight columns of holes as shown in fig. There is one column of sprocket holes in between 3’ and4 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 aparticular row and column position of the tape. The columns of] holes run lengthwise along the tape. Rowpositions run across the tape.In the row of bits, a character is formed. A character is a combination of bits Representing a letter, numberand symbol: A word is. a collection of characters forming part of instruction. The collection of words formsa block. A block of words gives one set of instruction. Each block of information is separated by End-of-block (EOB) symbol in the column.The part program is denoted by the symbol %. It defines the sequence of ONC machining operation. Eachblock 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 ascendingorder. This is useful for the operator to know which sequence of block, is performed by the tool. It consistsof 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 partprogram 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 toolPT1, at first then Ff2 and finally PT3. Locate the part reference point in absolute dimensioning and useincremental 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 threadcutting.

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 byomitting 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 contouringsystem (or) straight line system F200 means a feed rate of 200 mm/mmSpindle Speed (or) Culling speed word (S word (or) $ code)This word indicates the spindle rpm (or) the constant cutting speed in m/minS1000 indicates that sp rotates at 1000 rpm .Thus this code is represented by S followed by the three digitnumber

Tool selection word (T word (or) T code)This code is represented by ‘T’ followed by maximum five digit number. Different cutting tools arcindicated 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—wordThis• 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 Format2. Tab Sequential Format3. Feed block FormatWord Address FormatIn this format, alphabets are called address. The alphabets N, G, XYZ, S, F, T and M are separate addressesgiving standard meanings. The MCU, uses these alphabets for addressing a memory location on it. In thisformat, the block of instruction may be of any length. And the words can be placed in any sequence sincethe letter address will search and identify the corresponding word.The sample word address format is shown here.

Tab sequential FormatIn 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 thesecond word is recognized as preparatory function. Similarly, all the words are read and stored in particularaddresses.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 FormatIn this fixed block format, -the instructions are given in a standard sequence and the block contains a fixednumber 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 blockformat is shown below:

In this format, the first three digits represent the sequence number, the next two digits represent preparatoryfunction, 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 twodigit 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 ProgrammingThe programming consists of the following procedure.

Preparing CNC coordinate drawingsTo 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 thefollowing dimension system.

and Incremental dimensioningThe 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 tobe performed on a particular component, then the programmer has to decide the sequence of operations andthe machines. By this decision he can make a route sheet. The route sheet will give information whether themilling should be done first (or) drilling should be done first.. The shortest and most efficient path can befound 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 machininginstruction. Now, all addresses are added to the sequence of operations. The feed rate, spindle speed andmiscellaneous functions are also added.The sample program manuscript is shown below:

Preparation of punched tape (or) preparing floppy (or) CDIn olden days, using manuscript, a pinched tape in prepared with the help of teletypewriter. Nowadays, theprogram is typed L a computer using key board and the file is saved as a file in hard disk, floppy and also inCD.VerificationBy using the prepared program, we can i the machine and do the operations on wooden block and we cancheck the accuracy of the program. By analysing- the completed wooden work part, we .can decide whetherthe 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 alsoto locate the centre of holes to be drilled and reamed. The plotter drawing will be compared with theoriginal drawing for deviation.Production of componentsThe 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. Assoon a drilling is over, the drill comes out of the hole and goes to next poiat in rapid traverse since there isno machining in between two points.Example 3: Write the part program for the following figure. The Z position is zero at 100 mm above thetable surface.

Procedure1. 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. Set the tool tip at origin B (0, 0, 0) at a height of 60 mm above the work piece corner A.3. 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 givenwithout decimal part).

NO! G92 XQ YO FO <EOB>Set the position ‘A’ of the plate (work piece) under the drill at point B. 092 for positionpreset (or) Datum preset.N02 G71. G90 G94 <EOB071 for Metric, 090 for Absolute dimensioning, 094 for Feed rate in mmNO3 MO3 F16O S1200 <EOB>M03—Spindle start—clockwise, F160—Feed rate 160 mm/m and S 1200 — Spindlespeed at 1200 rpmN04 COO X25 Y30 Z-58 <EOB>000 for rapid traverse to point P 30, — 58)N05 G01 Z—83 <EOB>Drill the hole at point P (i.e. 60 + 20 + 3 = 83 for drill tip)001 for linear traverse

NOB COO Z-58 <EOB>000 for rapid traverse to 2 mm above the plate

N07 COO X50 Y80 <EOB>Move the tool with rapid traverse to point P 80)

N08 G01 Z—83 <EOB>Drill the hole at point P The tool tip is in 60 + 20 + 3 + = 83 mm)

N09 GOO Z—58 <EOB>

Move the tool with 2 mm above the plate

MO GOO X100 Y110 <EOB>Move the tool with rapid traverse to point P (100, 110)

Nil C01 Z-A3 <EOB>Drill the hole at point P

N12 GOO Z-58 <EOB>Move in rapid traverse to 2 mm above the plate

N13 GOO X8O Y20 EOB>Move the tool worth rapid traverse to point P

N14 G01l Z-83 <EOB>Drill the hole at P point

N GOO Z-58 <EOB

Position tool in rapid traverse to 2 mm above the plate

N16 COO XO YO ZO <EOB>Move the tool with rapid traverse to the position B (0, 0, 0)

N17 M02 <EOB>M02 forEnd of ProgramThe values I, J and K can be measured from the centre of the arc with respect to the datum in incrementalmode. The distance of center point of arc from the starting point S will be taken in tennis of I, J and K it Ifor X-axis, J for Y axis and K for Z axis. For turning operations, there are only two axes X and Z. So I andK will be present in program.Example 4: - Write program for preparing the part as shown in fig. Use incremental mode. Given rod dia is4r 20 and length is 40 mm.Part programming for machining along curved surface

NO! G91 <EOB>G91 for incremental dimensioning systemN02 GOO 3 7 <EOBSet the tool in starting position.N03 G01 X-10 F100 <EOB>Facing operation . The tool moves towards centre of the job.

N04 G02 X10 Z—10 10 K— <EOB>G02 for circular interpolation clockwise.

The calculation is as -follows X= 10mm(Maximum width of movement in X direction)I = 0 Vertical distance of centre from previous position. (— 10, 0)K =-10 Horizontal distance of centre from previous position (— 10, 0)N05 COO Z1O <EOB>

N05 COO Z1O <EOB>Rapid travel of tool to initial point A (0, 0) by giving Z = 10mm from the previous positionN06 M02 <EOB>M02 for the end of programNote: The values of I and K arc found as follows:The horizontal and vertical distances of centre of arc with respect to datum point in incremental mode aregiven below. ,

The horizontal and vertical distances of centre of arc with respect to datum pointin incremental mode are given below.Coordinates of the starting point S is (X —.10, Z 0). The centre of arc C, is located at C (X —10, Z —10).So the vertical distance in’ X direction (i.e. from S to C) is 0. So I = 0 [ I is the vertical distance from S(starting point) to C (centre of arc)]

And the horizontal distance in Z direction (i.e. from S to C) is —10. So K=—10mm.[ . K is the horizontal distance from S (starting point) to C (centre of arc)]

Part programming for milling operations:In CNC milling X axis, Y axis arid Z axis as machine, the motion is occurred shown in the following fig.in three axes

The movement of tool in upward vice versa direction (i.e. away from job) is taken as +Z and vice versa.

In this milling operation, the cutter radius compensation should be taken care of.

A suitable dia of cutter is selected and the part program should be written for centre line of the cutter.

The cutter radius compensation will be calculated - by taking difference between programmed cutterdiameter and the actual cutter diameter and it should be entered into the control system. Then the controlsystem will generate a new cutter path.

It is necessary to specify whether the cutter compensation is to the right (or) to the left of the tool whilemachining. The G codes G40, 041 and 042 are used for this purpose.

Example 9: Write a part program to give a finished job as shown in fig using milling operation.Speed 1200 rpm; • Feed 125 mm Depth of • cut =3 mm; Thickness of plate = 3 mmNote: The cutter radius compensation is stored in D02. The top surface of the plate is taken as Z = 0. G42Compensation is applied to shift the programmed cutter path to the right. G40 is to cancel the cutter radiuscompensation.

Subroutines (Macros) (L code)When a repetitive drilling (or) any machining operations have to be done in different places, the subroutineis used to reduce the effort of writing a detailed program for each machining operation.

The subroutine program will be stored in the memory as a separate program so that it can be called by themain program whenever needed. When the last block in the subroutine (M17) is executed, the control willreturn automatically to the main program. The subroutine is usually placed at the end of the main program.Example: Using subroutine, write a part program to get the finished part as shown in fig.10

N1 G90 G71 G17 <EOB>Absolute dimensioning: Metric units: XY planeN2 GO0 X20 Y25 Z5 <EOB>Rapidly Move the tool to point A and 5 mm above the plate surface.N3 L20Call the subroutine programmed to machine the first slot.N4 G00 X100 Y25 <EOB>Move the tool rapidly to the second slot i.e. to point B

N8 GOO X20 Y100 <EOB> Move the tool rapidly to the 4th slot i.e. to point D.

N9 L20 <EOB>Call subroutine program to machine 4th slot starting from D.

N1O GOO Z30 <EOB>Rapid travel upwards by 30mm above the plateN11 M02 <EOB>

End of programL20 <EOB>Subroutine programN1 G91 <EOB>Incremental dimensioning system

N8 G90 EOB>Convert to absolute dimensioning modeN9 M17 <EOB>M17 is for end of subroutine and return to main programExample 11: Write a part program for the finished - component as shown in figure. The point A is taken asreference point (0, 0, 0). Take cutter diameter in 20 mm

N1 G92 X0 Y0 Z0 *[ is given instead of <EOB>]Position preset (or) Datum presetN2 G90 *Absolute dimensionsN3 GO0 X40 Y30 Z2 TO! S3000 M03 - *Rapid traverse to B with clearance Z = 2 mm above the plateN4 G01 Z5 F120 *Tool goes down with depth of 5 mm straight cutting and end milling.N5 * - -Tool proceeds to C— straight cutting end millingNO X80 *Tool proceeds to E— straight cutting end millingN7 G02 Y30 10 eJ—30 *G02 Circular interpolation clockwiseI = 0 .The distance of centre D from E in X direction J = — 30 The distance of centrefrom E in Y direction.Now, the cutter moves through curved profile and reaches F.N8 X30 *Proceeds to BN9 Z2 *Tool moves 2 mm above the plate surfaceN10 G00 Z50 M05 *Rapid travel of tool upwards 50 mm above plate surface and spindle stops.N11 X0 Y0 *Rapid travel to reference point (0, 0)N12 M02End of program

Canned Cycles: [Fixed cycle (or) Standardized cycle]A canned cycle is used to define a series of machining sequences for drilling (or) boring (or) tapping etc.We have seen that a series of motions are repeated a number of times, many of which are common to all thepositions. For example, in case of drilling operation, the drill has to be positioned a little above the hole inrapid traverse, then drill to the required depth with the given feed rate and then the tool has to return to thetop of the hole with some clearance as shown in fig.

The same instructions have to be repeated for each hole. So, for each hole, three ONC blocks have to bewritten for the following actions.

(i) Positioning the drill to the hole location(ii) Lower the tool at programmed feed rate(iii) Lift the tool rapidly to the start p6sition.

The above three actions have to be repeated for drilling other holes also. Therefore, it is necessary to definea canned cycle (or) fixed cycle to repeat all these motions without repeating (writing) same information foreach hole. Refer the following figures: In both figures, -the following actions, Position the drill to the hole location,(ii) Lower the drill at programmed feed rate,(iii) Lift the drill rapidly to start position

are same. The only difference is in the depth of cut. In first case, it is 30 mm and in 2nd case it is 10 mm.Hence, the canned cycle requires a new hole location, depth of cut, feed rate and spindle speed.The canned cycles G81 to G89 ate useful for this purposes and they are stored a subroutines. The Rparameters are necessary to define the variable values necessary to execute canned cycle. The canned cycleG8i to G89 can be cancelled by G80.The following are the important R parameters used in canned cycles.

R01i First depth advanceR02 Reference plane (absolute) (or) start positionR03 final depth (or) Z dR02 is the Reference plane up to which the tool advances rapidly prior to contacting the part surface (or)R02 is the plane up to which the tool returns rapidly after completing the cycle. .R02 can be known as gauge height.

The advantage of the canned cycle can be sensed by writing program without cannedcycle and with canned cycle for the finished component in the following example.

Example 12: Write the part program for the finished component shown in fig. without using canned cycleand with canned cycle.

• means end of block

Pan program for drilling 3 holes without using canned cycle.Ni G90 GOO X20 Y40 Z2 *Rapid travel of tool to position X = 20 mm: Y 40 mm And Z = 2 mm above the plate surfaceG90 for absolute dimensioningN2 GO1 Z—i8 F125 *Straight drilling with depth of cut Z = 18 mm downward to ensure through hole is drilled in 15 mm thickplate. (i.e.) Z = 2 mm clearance + 15 mm thick plate + 1 mm extraN3 G00 Z2 *Rapid travel of tool to position 2 mm above plate surfaceN4 X60 Y80 *Rapid travel of tool to the second hole positionN5 G01 Z—18 F125Drilling with depth of cut Z=-18mmN6 G00 Z2 *Move the tool rapidly to 2 mm above surface7 X100 Y12 *Move the tool rapidly to the third hole positionN8 G01 Z18 F125Drilling with depth of cut Z = —18 mmN9 G00 Z2 *Move the tool rapidly to 2 mm above the plate surface.N10 X0 Y0 Z50 *Move the tool rapidly to (0, 0, 50) positionPart program for drilling 3 holes with canned cyclesNi G8i X20 Y40 Z—l8 R2 Fi25 *G18 for canned cycle which will repeat 3 times. X= 20 mm, Y = 40 mm for first hole positionZ- 18 for depth of cut for drilling.R2 means clearance plane is 2 mm above the plate surface F125 feed rate is mm/minN2 X60 Y80X = 60mm; Y =80mm for 2 hole positionX = 100 mm; Y = 120mm for 3” hole positionN4 G80 X0 YO Z50 *

Cancel the canned cycle and move the tool to a position (0, 0, 50).Using caned cycle, 10 blocks are reduced to .4 blocks in CNC programming. So canned cycle preventsboredom in writing repeated instruction. It avoids mistakes and errors in writing program.The standard canned cycles approved by ISO are giving it below.

Example 13: Write the program using canned cycles for drilling four holes as shown in fig. Drill diameter 6mm; Reference plane, is 2.5 mm above the plate, surface.

Ni G81 X12.5 Y12.5 R2.5 Z—17 ‘83000G81 for canned CycleX = 12.5 mm; Y = 12.5mm for first hole.It = 2.5 mm means clearance plane is ‘2 mm above the plate surfaceZ = —17mm Depth of cut is 17 mm to drill bit through holes M. 12.5 thick plate. Noteis already 2.5 mm above the plate surface ‘ soDrill hole at X’= 12.5 and Y = 75 m (2nd hole)N3 X75 ‘Drill hole at X = 75 and Y = 75 (i.e. 3 hole)N4 Y—75 *Drill hole at X = 75 and Y —75 (hole)N5 GS0 X0’Y *Go to initial position by canceling canned cycle.N6 M02 End of programF125T01 M03*that drill2;5 ÷ 12.5 + 2 mm clearance = 17mmN2 Y75 *

Non-standarised Fixed cyclesIn some particular job, some portions of program have to be repeated and it can not be fitted into thestandardized canned cycle category. The following are the non-standardized cycles.1. Do-Loops2. Parametric subroutines3. MacrosDo-Loops are used for turning and milling operations. When a raw material is to be reduced in size bygiving a series of rough cuts and then finishing cuts, the ‘Do-loops’ are used.Do-Loop is a number of similar operations repeated over a number of times giving increment in each step.It is nothing but a Do-Loop in computer programming.The general format for Db-Loop is as follows:(a) Do n(b) X/Y/Z I (c) END DoDo is the command used to repeat the operations specified in (b). n is the number of times the operationhave to be repeated. X/Y/Z is the information about coordinates for Loop.I is the incremental value for each step.END DO is the end of ‘Do-Loop’ after ‘if number of times the operations are repeated.Parametric SubroutinesParametric subroutine is similar to subroutine only difference is that the job size is different. Refer thefollowing component.Each slot can be machined using same coordinate values according to their sizes.subroutine program by giving various

The components which are similar in shapes but different in. sizes are machined using parametricsubroutine program.This parametric subroutine is also a portion of a programmer, complete in itself, which is stored in thecomputer memory. It is called with required data when required again in a program. It is usually placed atthe end of a programmed.Difference between canned cycles and subroutinesThe canned cycles are more of fixed type and they are used for easy programming of machine features thatare often needed. So canned cycles are more suitable for general situations.But if a part needs some pattern which is to be repeated a number of times, then a subroutine is very muchuseful. -The parametric subroutine is useful for turning, rough cuts, threat cuts, key way milling, drilling etc. wherea sequence of motions are involved.Since the parametric subroutines allow to intake their own cycles with different parametric dimensions atdifferent locations, it is known as ‘user defined canned cycles’Difference between ‘Do-loops’ and ‘Subroutine’The Do-loops are used to repeat some motions (operations) On a component for a fixed number of times.The subroutines are used to repeat some motions (operations) on a component for a variable number oftimes.Macros are also known as ‘parametric subroutines: They are stored in memory (or) macro file used formachining a complete component. A macro has either fixed dimensionsMacros

(or) parametric variables. These macros are very much useful to program for family of parts having sameshape but variable size as shown in the figure.MirroringWhen the part geometries are symmetric in nature, then part program can be written to make use of suchsymmetry. For doing this, the part programmer has to identify the symmetric axis and write only for half ofpart geometry.Then the part program will be repeated by using appropriate mirror imaging codes. The mirroring of imagecan be obtained about X axis, Y axis (or) X and Y. axis.In Macho programming language, the G code 73 is used for mirroring and G code 72 is used to cancelmirroring.

The above part is syminetrical about. X axis. So the part programmer can program for upper part alone andfor machining lower part, just writeNi G73 ex. L..Then all X coordinates vi1l be reversed and the loiter part will be machined.WriteProgrammingComputer Assisted Programming (CAP)In manual part programming, very simple parts are machined, since, it requires a very few number ofinstruction (or) sequence .of operations. But, most of the complex parts can not be machined by manual partprogramming since they require lengthy and tedious calculations. So it is necessary to make use ofcomputer for part programming repetitive and complex calculations involved in mathematically definedcurves and other complicated geometrical shapes. So the complex programs can be generated by computerAssisted Programming (CAP). The part programmer need not learn about the specific coding formats usedin different NC machine tools. Instead, he can learn only high level programming languages like APT,ADAPT, AU.TOMAP, EXAPT, PROMPT. etc which are all ‘English like statements’.The reliability of program is enhanced since the computer makes all calculations. Besides, the computershave facilities for error detection to assist part programmer to produce better part program. The partprogram thing time ‘is greatly reduced by as much as 75%.With the arrival of Computer Assisted Programming (CAP), the programmer is relieved off great burdenand he has to do only the following activities.(i) Define the geometry of the work piece from part drawing(ii) Define the sequence of operations and tool path

(iii) Write APT program [ = Automatically Programmed Tools](iv) Feed (Type) the program to the computer The computer’s in CAP consists of the following:1. Input translation2. Arithmetic Calculation3. Cutter offset compensation4. Post processor.The important Computer Assisted Programming (CAP) languages are given below.1. APT [Programmed Tools]APT is a product of MIT (Massachusetts Institute of Technology in US) developmental work. It is’ the mostwidely used language. It can be used for both positioning as well as contouring programming in up to 5axes. The different version of APT is APTURN for turning operations, APTMIL for milling and drillingoperations and APTPOINT for Point to Point operations.2. ADAPTIt is n ‘Adoption of APT’. Most of these programming languages are based directly on the APT program.This can be used in smaller computer. It was developed by IBM under Air Force contract. It is not as muchpowerful as APT.3. EXAPTIt is the ‘Extended subset of APT’. It is also based on APT and was developed in Germany. EXAPT I isdesigned for drilling and straight cut milling operations.EXAPT II is designed for turning operations.

EXAPT III is designed for limited contouring operations.It has facility to compute optimum feeds and speeds automatically.Similarly the other software’s are given below. UNIAPT, SPLIT, COMPACT II PROMF and CINTURN IIBut, most widely used CNC part programming language is APT wit its derivatives ADAPT, EXAPT,UNIAPT etcAPT Language is the language for computer assisted part programming. APT is like English statements.APT commands the cutting tool through a sequence of machining operations. ft performs all calculations togenerate cutter positions. It is used to control up to five axes.

APT can be used to control a variety of different machining operations. APT uses more than 400 words.There are tour types of APT statements1. Geometry Statements -Geometry statements define the geometric pattern of the work partThese are also called Definitions statements.2. Motion StatementsMotion statements are used to define the path taken by the cutting tool.3. Post processor statementsPost processor statements are used in pacific machine tool and control system. They are used to providedata for feeds and speeds. They are also used to actuate other features of the machine.4. Aux StatementsAuxiliary statements are used to identify’ the part and tool to specify the tolerances and to operate coolantN (or) OFF and so on. These are also known as miscellaneousStatementsLet us see all the above statements one by one in detail.Geometry statementFirst of all, the component geometry must be defined to program in APT. The geometry statements definethe path and locate the points through which the tool has to trace. The geometry statement should be givenbefore the motion statement.The format for geometry statement isSymbol = GebmetryType/Descriptive DataExample = Point / 2, 4, 7Explanation: The symbol. P1 is defined as ‘POINT’ having coordinatesX=2;Y=4andZ=7So the geometric statements comprise of three sections the first section is symbol. The symbol is used toidentify the geometric element. A symbol is combinationof alphabets and numerical. The maximum character should be six. At least one of thesix should be an alphabet. Very important thing is the symbol should not be one of theAPT vocabulary words.

3. By two points and perpendicular to other planePL5 = PLANE/PERPTO, PL4,P1, P2PL5 is a plane perpendicular to plane PL4 passing through P1 and P2.Motion statementsMotion statements have a general format as given belowMotion command Descriptive DataGOTO / P2The above statement consists of two sections.The first section (GOTO) tells tool what to do. The second section (P2) tells, tool where to go. By thismotion statement, the tool is ordered to go to point 2 (P2) which should have defined already in thegeometry statement.The following are three types of motion commands1. Setup commands2. Point-to-Point motion commandsSetup commandThe tool must be given a starting point at the very beginning of the motion.The starting point is- known as target point where the operator positions the too at the a part of the job.

The setup motion command isFROM / TARGThe ‘TARG’ is the target (or) starting point from which others will be referred.FROM / -4, -3, 0I.e. The tool should start from X=—4; Y—3; Z=O. Another way to make statement - FROM / SETPTwhere SETPT is the Starting point.3. Continuous path (contouring) motion commandsAnother way to make this statement is

Point—to—Point Motion Command(1) (XJTOIPJThe motion statement is used to position the tool at a particular point P1 (Eg positions the drill above a holeto be drilled)(ii) GOTOI5, 6, 3This motion statements tells the tool to go to point X = 5 Y = 6 and Z = 3(iii) GODJThis motion statement gives incremental instruction to move the tool in specified direction (in X, on Y (or)Z direction) from its current position. The GODLTA command specifies an incremental move for the tool.In the following example.GODLTA/4, 8, 0,The tool is ordered to move from its current position 4 mm in X direction, 8 mm in Y direction and nochange in Z direction..The GODLTA motion command is very much useful in drilling and related operationsSo, GOTO statement is used to direct the tool to a particular hole location.And GODLTA statement is used to drill the hole as given in the following example.

Contouring Motion StatementContouring motion commands are more complicated because the tool’s position should be continuouslycontrolled throughout its motion. ‘To accomplish this control, the tool is directed along two intersectingsurfaces namely ‘Drive Surface’ and ‘Part Surface’ and the tool motion is stopped by the surface namely‘check surface’ as shown in fig.

Drive SurfaceDrive surface is used to guide the side of the cutter.Part Surface: The bottom of the cutter rides on the part surface. The part surface may or may not be theactual surface of the workpart. The part surface should be defined along with the drive surface to maintainthe continuous path control of the tool.Check SurfaceThis check surface stops the movement of the tool in its current direction. i.e. The forward movement of thetool is stopped by this surface.The APT contour motion statement commands the tool to move along the drive surface and over the partsurface and the movement ends when the tool is at the äheck surface.The six contour motion commands are given below

TO ON PAST and figure.These six commands are mostly used along with one of the four modifiers to define the check surface, drivesurface (or) part surface. The foig modifiers are given belowTANTOThe usage of four modifiers with respect to check surface is shown in following

‘TO’ moves the tool until the tool touches the check surface. ‘ON’ moves the tool until the tool centre is oncheck surface. ‘PAST’ moves the tool just beyond the check surface. ‘TANTO’ moves the tool upto thepoint of tangency between two surfaces, atleast one of which is circular.‘TANTO’ is used for check surface being tangent to the Drive Surface. The format for using modifiers isgiven below –

Any of the surface can be omitted and it is optional.Motion word!Drive surface, modifier, check surfaceExample: GORGTJL1, PAST, L2Meaning: Move on the ri along Li until Past L2 (i.e. until L2 is passed)feed,givenPostprocessor Statements -These postprocessor statements are used to control the operation of the spindle, the and qther features of themachine tool. Some of the postprocessor statements are below.COOLNTION and COOLNTIOFF for switching coolant. ON and OFF.RAPID for rapid traverse for positioning the toolENI to shut down the CNC. machine.FEDRAT—It is used for giving feed rate.SPINDJJ2OdO, CLW means spindile speed is 2000 rpm clockwise.Auxiliary statement Auxiliary statements aie used for cutter size definition, part identification and toolchange etc Some of the auxiliary statements are given belowCUflERJ13 means the diameter of the cutter is 13 mm.FINI means it is adyising the computer to terminate the program.PARTNO is used to identify the workpart.Example 14: Write a program in APT for the finished pan shown in fig.

Solution: The geometry statements &e given beIos by referring the diagram.

$$ All points are th here.SETPT = POINT/O, 35, 2P1 = POINT/40,35,0P2 = POINT/4Q, 170,0P3 = POINT/90, 140,0P4 = POINT/120, 60, 0P5 = POINT/60, 35, 0$$ Define the top and bottom surfaces.TOPSRF = PLMTE/P1, P2, P5BOtSRF = PLANEIPARLEL, TOPSRF, Z LARGE, —25$ [ is a surface parallel to top surface parallel to top surface and bn the lar side of2 y 25 downward)]$$ Define the circles and linesCR1 = CIRCLE/CENTER, PS, RADIUS, 30L2 LINEIP2, LEfl, TPsNTO, CR1 1 CR2]$$ [ The line L2 passes from point P2 and is tangent on the lef*side of arc e

L3 = LINE/P4, RIGHT, TANTO, CR1$$ [ The line L3 passes from point P4 and is tangent on the right side of circle CR1]L4 = LIE/P4,P5L5 = LINE/P5,P1$$ Define the tool, feed and speed.LOADTL/i $$ [ tool No. 1]CUTPERJ2O$$ CU?YER dia is 20 mmFEDRAT/60, MMPM $$ [ rate is 60 thm/min]SPINDL/2500, CLW $$ [ Spindle speed is 2500 rpm cloekwise]$$ Give the motion statements.FROM/SETPT [ Position the tool to initial position]GO/TO, Li, TO, BOTSRF, TO L5$$ [ is the Drive surface along which the tool moves. BOTSRF is the part surface at which the tool end facewill be placed throughout the operation and Lfr is the Check surface for this position]GOLFTIL1,PAST,L2[ Move the tool in the left along the line Li until the line L2 is passed.GO RGT/L2, TANTO, C$$ Move the tool in the right direction along the line L2 until it touches the point of tangency of circle CR1.GO FWD/CR1, TANTO, L3$$ Move the tool in forward direction (in the direction of motion) along, the circle CR1 until the line L3becomes tangent to’ it.GO FWDIL3, PAST, I$$ Move the tool along the line L3 until it passes line L4GO RGT/L4, PAST, LGO RGT/L5, PAST, LiGOTO/SETPTFINIEND.

Example 15: Write a part program for the finished part shown in figure

* Use the milling cuter alid drill. Assume the thickness of the plate is 20 mm. Setpt is at (0, 20, 3) and Z = 0at the surface of the job.Solution: The dlre of motion is defined in the figure and also all points and lines are shown here.

$$ Defining• all points:SETPT = POINT/0, 20,3P1 = POINT/40, 20, 0P2= POINT/70, 8, 0P3 = POINT/100, 20, 0$$ Defining two surfaces:TOPSRF = PLANE/Pi, P P3BOTSEF = PLANE/PAIRLEL, TOPSRF, Z LARGE, 20$$ Defining the three part of circles:CR1 = CIRCLE/CENTER, P1, RADIUS, 10CR2 = CIRCLE/CENTER,P2, RADIUS, 10CR3 = CIRCLE/CENTER,P3, RADIUS, 10$ Defining lines Li, L2, and L3Li = LINE/LEFT,TANTO, CR1, LEFT, TANTO, CR2L2 LINEIRIGHT,TANTO CR2, RIGHT, TANTO, CR3L3 = LINEILEFT,TANTO, CR3, RIGHT, TANTO, CR1$$ Giving Feed and Speed statements:LOADTIJ1CUflERFEDRAT/70, MMPMSPINDL’3000, CLW$$ Giving Motion Statements:FROM/SETPT$$ Define Line Li as Drive surface, BOTTOM SURFACE as pa*tsurfaceGO/TO, Li, TO, BOTSRF, TANTO, CR1GO LVr/L1, TANTO, CR2GO FWD/CR2, TANTO, L2GO FWD/L2, TANTO, CR3GO FWD/CR3,TANTO,L3GO FWD/LS, TANTO, CR1GO FWD/CR1, TANTO, LiGO TO/SETPT$ Drilling operationLOADTL/2CUTFERJ5FEDRAT/50, MMPM

SPINDL(2500, CLW$$ Drilling first holeGOTO/PiGO DOWN/PAST, BOTSRFGO UP/PAST, TOPSRF$$ Drilling second holeGO TO/P2GO DOWN/PAST, EOTSRFGO UP/PAST, TOPSRF$$ Drilling third holeGO TO/PSGO DOWN/PAST, BOTSRFGO UP/PAST, TOPSRF$$ End of jobGOTO/SETPTFIN!END.MACRO STATEMENT IN APTThe sequence of similar (or) identical statements which have to be repeated more often in a part programare best referred by a MACRO Statement in APT so that the lengthy part program is reduced. It is sImilar toa SUBROUTINE in FORTRAN and other Computer Programming languages.