Chapter 4 CNC Programming Milling Program for Numerical

  • Slides: 47
Download presentation
Chapter 4 CNC Programming (Milling)

Chapter 4 CNC Programming (Milling)

Program for Numerical Control Consists • A program for numerical control consists of a

Program for Numerical Control Consists • A program for numerical control consists of a sequence of directions that causes an CNC machine to carry out a certain operation, machining being the most common process. • The program contains instructions and commands. Geometric instructions pertain to relative movements between the tool and the work piece. • Processing instructions concern spindle speeds, feeds, cutting tools, cutting fluids, and so on. • Travel instructions pertain to the type of interpolation and to the speed of movement of the tool or the work table. • Switching instructions concern on/off position for coolant supplies, direction or lack of spindle rotation, tool changes, work piece feeding, clamping, and so on.

Program for Numerical Control Consists • The program contains instructions and commands. • Geometric

Program for Numerical Control Consists • The program contains instructions and commands. • Geometric instructions pertain to relative movements between the tool and the workpiece. • Processing instructions concern spindle speeds, feeds, cutting tools, cutting fluids, and so on. • Travel instructions pertain to the type of interpolation and to the speed of movement of the tool or the work table. • Switching instructions concern on/off position for coolant supplies, direction or lack of spindle rotation, tool changes, workpiece feeding, clamping, and so on.

Manual Part Programming • Manual part programming consists first of calculating the dimensional relationships

Manual Part Programming • Manual part programming consists first of calculating the dimensional relationships of the tool, work piece, and work table, on the basis of the engineering drawings of the part (including CAD), the manufacturing operations to be performed, and their sequence. • A program sheet is then prepared, detailing the necessary information to carry out the particular operation. • The part program is then prepared on the basis of this information. • Manual programming can be done by someone who is knowledgeable about the particular manufacturing process and is able to understand, read, and change part programs.

Computer-Aided Machining Programs • Complex parts are now machined using graphics-based, computer-aided machining programs.

Computer-Aided Machining Programs • Complex parts are now machined using graphics-based, computer-aided machining programs. • A tool path is created in a largely graphic environment that is similar to a CAD program. The machine code (G-Code) is created automatically by the program. • Before production begins, the programs should be verified, either by viewing a simulation of the process on a monitor or by making the part from an inexpensive material (such as aluminum, wood, wax, or plastic), rather than from the actual material specified for the finished part.

Selection Of A Particular CNC Programming Language Ø Selection of a particular CNC programming

Selection Of A Particular CNC Programming Language Ø Selection of a particular CNC programming language depends mainly on the following factors: a. the level of expertise of the personnel in the manufacturing facility; b. the complexity of the part; c. the type of equipment and computers available; d. the time and costs involved in programming.

Procedure For Manual Programming Programmer 1. Study 2. Workshop drawing 3. Definition of work

Procedure For Manual Programming Programmer 1. Study 2. Workshop drawing 3. Definition of work plan 4. Work plan 5. Study work order 6. Tools 7. Clamping devices 8. Choice of clamping devices 9. Set-up form 10. Program sheet 11. Generating the NC program 12. Simulating the NC program

ABSOLUTE AND INCREMENTAL PROGRAMMING ABSOLUTE Specify the relative tool moving position with respect to

ABSOLUTE AND INCREMENTAL PROGRAMMING ABSOLUTE Specify the relative tool moving position with respect to the program zero. INCREMENTAL The tool moving distance from its current position. Computer programs can be written in absolute programming format, incremental programming format, or may use both formats in the same program.

Absolute • Absolute programming specifies a position or an end point from the work

Absolute • Absolute programming specifies a position or an end point from the work piece coordinate zero (datum).

Incremental • Specifies the movement or distance from the point where you are currently

Incremental • Specifies the movement or distance from the point where you are currently located. • Remember, a move to the right or up from this position is always a positive move (+), a move to the left or down is always a negative move (-). Present position becomes the program start position. From the start point, point 1 is one position to the right on the X axis (X+1) and six position up on the Y axis (Y+6). When we move to point 2, point 1 become our start point. Point 2 is 5 position to the right of our present positions to the right of our present position on the X axis (X+5) and 2 positions down on the Y axis (Y-2). Remember, in incremental programming, moves down or moves to the left are negative moves.

Incremental Coordinate Positioning

Incremental Coordinate Positioning

Absolute positioning system have a major advantage over incremental positioning. If the programmer makes

Absolute positioning system have a major advantage over incremental positioning. If the programmer makes a mistake when using absolute positioning, the mistake is isolated to the one location. BUT When the programmer makes a positioning error using incremental positioning, positioning all future positions are affected.

Circular Interpolation G 41 • G 41: Climb milling: • Each tooth engages the

Circular Interpolation G 41 • G 41: Climb milling: • Each tooth engages the material at a definite point, and the width of the cut starts at the maximum and decreases to zero. • The chips are disposed behind the cutter. • The tooth does not rub on the material, and so tool life may be longer. • However, climb milling can apply larger loads to the machine - not recommended for older milling machines, or machines which are not in good condition.

Circular Interpolation G 42 • G 42 : Conventional milling: • The depth of

Circular Interpolation G 42 • G 42 : Conventional milling: • The depth of the cut starts at zero thickness, and increases up to the maximum. • The cut is so light at the beginning that the tool does not cut, but slides across the surface of the material, until sufficient pressure is built up and the tooth suddenly bites and begins to cut. • This deforms the material (at point A on the diagram, left). • The sliding and biting behavior leaves a poor finish on the material.

Word Address Format • This is the format that is used on virtually all

Word Address Format • This is the format that is used on virtually all modern controllers. • With this type of format, each type of word is assigned an address that is identified by a letter code within the part program. • Thus, the letter code specifies the type of word that follows and then its associated numeric data is given. • Word address format has the additional advantage of making it possible to have more than one command of the same type in a single block, something that would be impossible with the other two formats.

Standard method • The American National Standards Institute (ANSI) has established a standard method

Standard method • The American National Standards Institute (ANSI) has established a standard method of specifying word address data for any controller, which has been adopted by most manufacturers. • A typical specification might look as follows: • N 4 G 2 X± 43 Y± 43 Z± 43 R± 43 F± 40 S± 40 T 2 M 2 I 43 J 43 K 43

Commands 1. Preparatory functions. These are used to inform the MCU of the requirements

Commands 1. Preparatory functions. These are used to inform the MCU of the requirements for the machining that is to be carried out and thus to establish the necessary operating conditions. 2. Axis motion commands. These are used to control the amount of relative motion between the cutting tool and the workpiece along each machine axis. 3. Feed and speed commands. These are used to set and control the cutting conditions for individual machining operations. 4. Identification commands. These are used to identify specific entities in the program, such as cutting tools used. 5. Miscellaneous commands. These are used to control various other aspects of the machine’s operation not addressed elsewhere, such as turning the spindle on and off and changing tools.

The sequence of the words in an CNC-block is designated as follows: • •

The sequence of the words in an CNC-block is designated as follows: • • N block numbers G functions X, Y, Z Coordinates I, J, K Interpolation parameter F Feed S Speed T Tool position M Additional functions

Preparatory Functions This is denoted by ‘G’. It is a pre-set function associated with

Preparatory Functions This is denoted by ‘G’. It is a pre-set function associated with the movement of machine axes and the associated geometry. ISO has standardized a number of these preparatory functions also popularly called G codes. The standardized codes are shown below in Table

Some Common G Codes

Some Common G Codes

G-Codes Code Function • G 00 Point-to-point positioning, rapid traverse • G 01 Linear

G-Codes Code Function • G 00 Point-to-point positioning, rapid traverse • G 01 Linear interpolation • G 02 Circular interpolation, clockwise (CW) • G 03 Circular interpolation, anti-clockwise (CCW) • G 04 Dwell

Miscellaneous Commands • Miscellaneous commands are used to control a variety of machine functions

Miscellaneous Commands • Miscellaneous commands are used to control a variety of machine functions that are not covered by the other commands. • The address word M followed by two unsigned digits is used to specify miscellaneous commands. • Examples of functions controlled by miscellaneous commands are turning the spindle on and off, turning coolant on and off, initiating a tool change, clamping and unclamping the workpiece, interrupting and restarting program execution, stopping the program, and rewinding the program. • Generally, miscellaneous commands take effect after execution of the other commands in the block in which they are programmed. • It is usually permissible to program more than one miscellaneous command in a given block provided they do not have conflicting effects. • Many of the M codes have been assigned standardized functions.

Miscellaneous Functions, M • These functions actually operate some controls on the machine tool

Miscellaneous Functions, M • These functions actually operate some controls on the machine tool and thus affect the running of the machine. Generally 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’ (M 07) and ‘OFF’ (M 09) cannot be given in one block. • The number of M codes standardised by ISO is less compared to G codes in view of the direct control exercised by these on the machine tool. • The ISO standard M codes are given in the following table.

 M CODES Code Task Functions M 00 • Programme stop This code is

M CODES Code Task Functions M 00 • Programme stop This code is used to stop a program that is being executed. A programme may contain more than one M 00 code depending on the need to stop at any required position for the purpose of checking movements, dimensions etc. Machine will stop every time this code is displayed or reached. M 01 • Optional Programme Stop This codes performed the same task as the M 00 code but the programmer / machine operator still have a choice of whether to stop or not at the desired stopping position. Selections is done by pressing the Optional Stop Button. If the optional stop button is depressed or not chosen, machine will not stop even when the M 01 code is displayed or reached. M 02 • Programme End This code is placed at the end of a program. This code is also used to stop all axis movement, spindle rotation, coolant pump and also able to cut off the machine power supply automatically. Control will be reset to program start. M 03 • Spindle Clockwise Direction Starts spindle rotation in the clockwise direction. When it is needed to rotate the spindle at 1500 rpm in the clockwise direction, program is written as: M 03 S 1500; M 04 • Spindle Counter-Clockwise Direction Starts spindle rotation in the counter-clockwise direction. Program is written as: M 04 S 1500;

More commonly used M codes

More commonly used M codes

Code Task Functions M 00 Programme stop This code is used to stop a

Code Task Functions M 00 Programme stop This code is used to stop a program that is being executed. A programme may contain more than one M 00 code depending on the need to stop at any required position for the purpose of checking movements, dimensions etc. Machine will stop every time this code is displayed or reached. M 01 Optional Programme Stop This codes performed the same task as the M 00 code but the programmer / machine operator still have a choice of whether to stop or not at the desired stopping position. Selections is done by pressing the Optional Stop Button. If the optional stop button is depressed or not choosen, machine will not stop even when the M 01 code is displayed or reached. M 02 Programme End This code is placed at the end of a program. This code is also used to stop all axis movement, spindle rotation, coolant pump and also able to cut off the machine power supply automatically. Control will be reset to program start. Spindle Clockwise Direction Starts spindle rotation in the clockwise direction. When it is needed to rotate the spindle at 1500 rpm in the clockwise direction, program is written as: M 03 S 1500; Spindle Counter. Clockwise Direction Starts spindle rotation in the counter-clockwise direction. Program is written as: M 04 S 1500; M 03 M 04

M 05 Spindle Stops spindle rotation either in M 03 or M 04. M

M 05 Spindle Stops spindle rotation either in M 03 or M 04. M 06 Tool Change This code is used to change to the tool required for cutting. Program is written as: M 06 T 02; M 08 Coolant Pump “On” To turn on the coolant pump M 09 Coolant Pump “Off” To turn off the coolant pump M 30 Program End Has the same functions as M 02.

M codes standardised by ISO Code Function • • • M 00 M 0

M codes standardised by ISO Code Function • • • M 00 M 0 I M 02 M 03 M 04 M 05 M 06 M 07 M 08 Program stop, spindle and coolant off Optional programmable stop End of program—often interchangeable with M 30 Spindle on, CW Spindle on, CCW Spindle stop Tool change Coolant supply No. 1 on Coolant supply No. 2 on

G Codes (Basics) Code G 00 Task Rapid Traverse. Functions G 00 X 50.

G Codes (Basics) Code G 00 Task Rapid Traverse. Functions G 00 X 50. 0 Y 20. 0 ; A Rapid Movement - G 00 20 B 50 This code is used to move the spindle head or the cutting tool to its destination from one point A, to another point, B with rapid movement of 15000 mm/min. However, this code cannot be used for cutting purposes.

Code G 01 Task Linear Interpolation This code is used when cutting in a

Code G 01 Task Linear Interpolation This code is used when cutting in a straight direction from one point to another. Applies to vertical, horizontal or at an angle (slope) movement. The feed rate, F must be stated in the program. Functions G 01 X 20. 0 F 100. ; Y-10. 0; X 35. 0 Y-20. 0; X 0 Y 0 X 20. Y-10. X 35. 0 Y-20. 0

Code G 02 Task Functions Circular Interpolation. Clockwise G 02 X 25. 0 Y

Code G 02 Task Functions Circular Interpolation. Clockwise G 02 X 25. 0 Y 25. 0 R 5. 0; X 20. 0 Y 20. 0 R 5. 0 X 25. 0 Y 25. 0 This code is used when cutting arcs or circles in the clockwise direction.

Code G 03 Task Circular Interpolation. Counter Clockwise Functions G 03 X 25. 0

Code G 03 Task Circular Interpolation. Counter Clockwise Functions G 03 X 25. 0 Y 25. 0 R 5. 0; X 30. 0 Y 30. 0 R 5. 0 X 35. 0 Y 35. 0 This code is used when cutting arcs or circles in the counter-clockwise direction.

CNC Absolute Programming G 90 Mill Circular Interpolation G 02 G 03 with R

CNC Absolute Programming G 90 Mill Circular Interpolation G 02 G 03 with R G 90 X 200 Y 40 Z 0 G 03 X 140 Y 100 R 60 F 300 G 02 X 120 Y 60 R 50 CNC Incremental Programming G 91 Mill Circular Interpolation G 02 G 03 with R G 91 X 200 Y 40 Z 0 G 03 X-60 Y 60 R 60 F 300 G 02 X-20 Y-40 R 50

Code Task Functions POSITIVE “R” Radius ‘(less than 180 degrees) G 90 G 54

Code Task Functions POSITIVE “R” Radius ‘(less than 180 degrees) G 90 G 54 G 00 X-0. 25 Y-0. 25. 0; G 01 Y 1. 5 F 12. 0; G 02 X 1. 884 Y 2. 384 R 1. 25; R 1. 25 Code Task NEGATIVE “R” Radius ‘(more than 180 degrees) Functions G 90 G 54 G 00 X-0. 25 Y-0. 25. 0; G 01 Y 1. 5 F 12. 0; G 02 X 1. 884 Y 2. 384 R-1. 25; R-1. 25

Code G 04 Task Functions Dwell G 04 X 4. 0 ; (stops for

Code G 04 Task Functions Dwell G 04 X 4. 0 ; (stops for 4 sec. ) Or G 04 P 3000 ; (stops for 3 sec. ) This code is used when it is necessary to stop the cutting movement for a few seconds in order to obtain a better finishing or in the case of drilling, a better hole surface. Even though the axis movement of the cutting tool has stopped, the rotation of the cutting tool remains active. Duration of the stop time can be define by using either X or P.

 OTHER G CODES Code Task Functions G 94 Feed per minute All F

OTHER G CODES Code Task Functions G 94 Feed per minute All F (feed) values are in mm/min Eg. N… G 94 F 400. ; G 95 Feed per revolution All F (feed) values are in mm/rev. Eg. N… G 95 F 0. 5 ; G 97 Revolution s per minute S values are in rev/min Eg. N… G 97 S 2000 ;

 • • • G 17 G 40 G 49 G 80 G 90;

• • • G 17 G 40 G 49 G 80 G 90; G 00 G 90 G 54 X 0. 0 Y 0. 0; M 06 T 09; G 43 Z 10. 0 H 0. 9 M 03 S 1000 D 09; G 01 Z-1. 0 F 300; G 42 X 60. 0; X 85. 0 Y 40. 0; Y 87. 0; X 47. 0; Y 68. 0; G 02 X 37. 0 Y 53. 0 R 15. 0; G 01 X 20. 0 Y 15. 0; X 0. 0; Y 0. 0; Z 350; M 30; N 20 G 17 G 40 G 49 G 80 G 90 - G 17, written in the XY plane - G 40, cutter compensation off - G 49, cancel height offset - G 80, cancel canned cycles - G 90, sets the absolute mode G 41 X 20. 0 Y 15. 0; X 15. 0 Y 53. 0; X 32. 0; G 03 X 47. 0 Y 68. 0 R 15. 0; Y 87. 0; X 85. 0; Y 60. 0; X 60. 0 Y 15. 0; X 0. 0; Y 0. 0; Z 350; M 30;

EXAMPLE The Absolute System = G 90 When using this system, a programmer should

EXAMPLE The Absolute System = G 90 When using this system, a programmer should bear in mind that the distant from one point to another in the X or Y axis must be taken from the reference point and does not depend on the distance of travel. The reference point is where the X, Y and Z coordinates equals zero, ie. X 0 , Y 0 and Z 0 (see example below). Program: G 90; G 01 Y 25. 0; X 60. 0 Y 50. 0; Y 60. 0; X 75. 0; Y 0; X 0; (Absolute System) (Point B) (Point C) (Point D) (Point E) (Point F) (Point G) (Back to Point A)

EXAMPLE The Incremental System = G 91 Reference point is not necessary when using

EXAMPLE The Incremental System = G 91 Reference point is not necessary when using this system. When programming, it refers to the distance of travel either in the X or Y direction or in both. In the X –axis, movement to the right is positive and movement to the left is negative. In the Y-axis, movement upwards is positive and movement downwards is negative (see example below). Program: G 91; G 01 Y 25. 0; X 35. 0 Y 25. 0; Y 10. 0; X 15. 0; Y-60. 0; X-75. 0; (Incremental System) (Point B) (Point C) (Point D) (Point E) (Point F) (Point G) (Back to Point A)

EXAMPLE

EXAMPLE