NC Programming IML 332E: 332E: NC Programming Each NC program includes the following: 1. A declaration of the program number 2. Statements defining the origin of the coordinate system and the kind of coordinates (incremental or absolute) used to describe the the tool position or be seen from this example program 3. Statements defining operations, other than tool movements, to be performed by the NC machine, such as turning the coolant and spindle on or off, setting the spindle speed and feed rate, and changing or selecting tool(s) 4. Statements defining the movement and position of the tool 5. Statements defining operations to be performed by the control "Stop reading and execution," "Stop reading and execution and d mill at at initial memory," and "Call a subprogram" 1 A Sample NC Program IML 332E: 332E: NC Programming 2 1 NC Coordinate Systems IML 332E: 332E: NC Programming Assume: Directions are assigned as if the tool is moving w.r.t. the workpiece. 3 Setting origin of the Coordinate System: System: G50 (Turning (Turning)) & G92 (Milling (Milling)) IML 332E:: NC Programming IML 332E NC Programming 4 2 N-Code Words Milling IML 332E: 332E: NC Programming 5 N-Code Words Lathe IML 332E: 332E: NC Programming 6 3 G-Codes 1 Milling IML 332E: 332E: NC Programming 7 G-Codes 1 Lathe IML 332E: 332E: NC Programming 8 4 M-Codes Milling IML 332E: 332E: NC Programming 9 Setting up Coordinate System: G28 & G92 IML 332E: 332E: NC Programming 10 5 Rapid Positioning: G00 IML 332E: 332E: NC Programming G00XxYyZz G91G00XxYyZz G00UuWw where x, y, and z are the coordinates of the destination point. (milling , incremental) (turning, incremental) 11 Linear Interpolation: G01 IML 332E: 332E: NC Programming G01XxYyZzFf where x, y, and z are the coordinates of the destination point and f is the feed value in mm/min or in/min. G91G01XxYyZzFf (milling , incremental) G01XxZzFf G01UuWwFf (turning, absolute) (turning, incremental) 12 6 Circular Interpolation: Interpolation: G02 &G03 IML 332E: 332E: NC Programming In the XX-Y plane: G17G02XxYy RrFf Ff G17G02XxYyRr G17G03 XxYyIiJj IiJjFf Ff G17G03XxYy In the YY-Z plane: G19G02YyZz RrFf Ff G19G02YyZzRr G19G03 YyZzJjKk JjKkFf Ff G19G03YyZz In the ZZ-X plane: G18G02XxZz RrFf Ff G18G02XxZzRr G18G03 XxZzIiKk IiKkFf Ff G18G03XxZz where G17, G18 and G19 define XX-Y, ZZ-X and YY-Z planes, respectively. G02 and G03 define rotation in CW and CCW directions x, y, z denote coordinates of the destination point i, j, k denote incremental coordinates from the center of the initial initial tool position. R denotes radius of the circle Complete Circle: G02G17IiJj G03G17IiJj G02G18IiKk G03G18IiKk G02G19JjKk G03G19JjKk 13 Circular Int.: G02 &G03 IML 332E: 332E: NC Programming 14 7 G02 & G03 IML 332E: 332E: NC Programming 15 G02 & G03 IML 332E: 332E: NC Programming 16 8 Dwelling at the current position: position: G04 IML 332E: 332E: NC Programming G04Xn G04Pn G04Un (lathe only) - Cutter stops at current location for n seconds - Automatic deceleration and acceleration - G04 makes a sharp corner. 17 Tool Radius Compensation IML 332E: 332E: NC Programming G40: Cancel G41: Left HS comp. G42: Right HS comp. D: Radius offset code 18 9 Tool Radius Compensation - 2 IML 332E: 332E: NC Programming G10PpRr causes to input an offset value of r into offset register # p. 19 Tool Radius Compensation - 3 IML 332E: 332E: NC Programming Prevention of UnderUnder-cutting 20 10 Tool Nose Vectors (Lathe) IML 332E: 332E: NC Programming Different cutter compensation vectors must be applied with different types of cutting tools. G40: Cancel G41: Left HS G42: Right HS T: Offset code 4 digits, the first 2 digits define the turret position (tool #); the last 2 digits define the offset number 21 Tool Offsets: Lathe IML 332E: 332E: NC Programming 22 11 Cyclic Operations (Milling) IML 332E: 332E: NC Programming G80: Cancel cycle function ...Default function (when power is turned on) G81: Spot drilling cycle G82: Counter boring cycle G83: Peck drilling cycle G84: Tapping cycle G85: Boring cycle G86G86-G89: Special boring cycle Retreating Motions: G98: tool returns to the initial point level G99: tool returns to the R point level G90 & G91 modes possible 23 Spot Drilling: G81 IML 332E: 332E: NC Programming G81XxYyZzRrFfLl’ G81XxYyZzRrFfLl’ x, y: coordinates of the hole z: coordinate of the hole bottom r: z coordinate of the point R f: Feed rate l’: # of times the subroutine to be repeated When l’l’ is omitted, default value for l’l’ is 1. 24 12 G81 Example IML 332E: 332E: NC Programming 00001; N1G90G 90G92X 92X-4.Y 4.Y0Z3.M 3.M03S 03S35; N2G91G 0.9R4.Z-0.9R 81X4.Z 99G81X 91G99G 2.9F 2.9F2.0L 2.0L4; N3Y3.L 3.L2; N4X-4.L 4.L3; N5Y-3.; N6G00Z 00Z2.9; N7G8lX 8lX3.0Z 3.0Z-1.2R 1.2R-0.9; N8X6.0; N9G90G 90G00X 00X-4.Y 4.Y0Z3.M 3.M05; N10M 10M30; 25 IML 332E: 332E: NC Programming 26 13 Peck Drilling: G83 IML 332E: 332E: NC Programming G83XxYyZzQqRrFfLl’ G83XxYyZzQqRrFfLl’ x, y: coordinates of the hole z: hole depth r: z coordinate of the point R q: depth of cut for each peck drill f: Feed rate l’: # of times the subroutine to be repeated When l’l’ is omitted, default value for l’l’ is 1. 27 Boring Cycle: G85 IML 332E: 332E: NC Programming G85XxYyZzRrFfLl’ G85XxYyZzRrFfLl’ x, y: coordinates of the hole z: hole depth r: z coordinate of the point R f: Feed rate l’: # of times the subroutine to be repeated When l’l’ is omitted, default value for l’l’ is 1. 28 14 Turning: Cycle Motion: G90 IML 332E: 332E: NC Programming G90XxZzIiFf G90UuWwIiFf x/2, z: coordinates of the destination point u/2, w: incremental coordinates of the destination point from the the start point i: incremental coordinates measured from B to point A f: feed rate 29 Example: IML 332E: 332E: NC Programming 30 15 Facing Cycle: G94 IML 332E: 332E: NC Programming 31 Thread Cutting Cycle: G92 IML 332E: 332E: NC Programming 32 16 Example: Cutting M24x3 Thread IML 332E: 332E: NC Programming The following program will cut the thread shown in Fig. 22-28. Seven threading cycles (statements N31 to N37) are needed here to to cut the thread. …………. …………. ....G21.... ..… ..… N31G92X23.0ZN31G92X23.0Z-40.0F3.0* N32X22.3* N33X21.8* N34X21.4* N35X21.1* N36X20.8* N37X20.752* …………. …………. * means end of block 33 Repetitive Turning Cycle: G71 IML 332E: 332E: NC Programming G71PpQqUuWwDdFfSsTt Np... Np... ……. ……. ……. ……. Nq… Nq… G70PpQq ……. ……. 34 17 Cycle Operations in Lathe: G72 IML 332E: 332E: NC Programming G72PpQqUuWwDdFfSsTt Np... Np... ……. ……. ……. ……. Nq… Nq… G70PpQq ……. ……. 35 TRENDS Application of G71 IML 332E: 332E: NC Programming 36 18 Patterns Repeating: G73 IML 332E: 332E: NC Programming 37 Patterns Repeating: G73 IML 332E: 332E: NC Programming 38 19 Repetitive Threading Cycle: G76 IML 332E: 332E: NC Programming 39 Codes Specifying Miscellaneous Functions & SUBPROGRAMS IML 332E: 332E: NC Programming M Code (Miscellaneous Function Code) M98P 98PpLl’ (call a subprogram numbered with p and l’l’ number of times) M99P (last statement of a subprogram, p line number to return in the 99Pp main program, 4 digits) S Code (Spindle Speed) T Code (Tool # or Turret position) 40 20
© Copyright 2024