0% found this document useful (0 votes)
87 views

5.CNC Part Programming Notes

deploma machanical notes 3 rd year . CNC part programing notes

Uploaded by

yashnawale66
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views

5.CNC Part Programming Notes

deploma machanical notes 3 rd year . CNC part programing notes

Uploaded by

yashnawale66
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 26

5.

CNC part programming (16 Marks)

5.1 Machine Zero (Home Position)

 The machine zero is a fixed point set by the machine manufacturer. Usually it cannot be
changed. Any tool movement is measured from this point. The controller always
remembers tool distance from the machine origin.
 The position on the machine which is specified by the manufacturer and with respect to
which all other point are defined is called as machine zero.

For Lathe Machine

For Milling
Work piece zero (Program zero)

 It is the position of cutting tool on the work piece (with respect to the wok piece).
It can be selected anywhere on the work piece.
 Generally it is the left corner near the operator of the work piece in case of milling. In
case of turning, it is in the front face and at the center of the cylindrical work piece (i.e.
extreme right position away from the chuck).
 This position is specified by the part programmer and may vary for different program.
 The entire program is written with respect to the work piece zero position.
 After the work piece mounted on the table, the work piece zero is to be informed to the
controller by setting offset through the control panel.

5.2 CNC Part Programming:-

A Program:

 A program consists of a series of blocks and normally contains a complete set of coded
instructions required to completely machine a part or a predetermined portion of a part.
 The program contains all the instructions and information necessary for the computer to
command the machine to perform specified functions, ultimately resulting the complete
machining of a part.

Part Programming:

 The shape, size and dimensional accuracy of a desired component depends mainly upon
how accurately the program is prepared.
 The part program is actually a set of instructions about the processing steps to be
sequentially performed on the workpiece.
 The part program is preceded by the design/development procedures viz. designing of the
component, detailed drawing and process planning.
 A group of commands given to the CNC for operating the machine is called the program.
It consists of:
1. Information about part geometry
2. Motion statements to move the cutting tool
3. Cutting speed
4. Feed
5. Auxiliary functions such as coolant on and off, spindle direction

Programming format and structure:-


 N codes- specify program line number to executed by the MCU

 G codes- Initial machining setup and establishing operating conditions

 Axis Codes: X,Y,Z - Used to specify motion of the slide along X, Y, Z direction

 Feed and Speed Codes: F and S- Specify feed and spindle speed

 Tool codes: T – specify tool number

 Miscellaneous codes – M codes For coolant control and other activities

5.3 ISO G and M Code


Table of Important G codes

 G00 Rapid Transverse


 G01 Linear Interpolation
 G02 Circular Interpolation, CW
 G03 Circular Interpolation, CCW
 G17 XY Plane,G18 XZ Plane,G19 YZ Plane
 G20 Inch units
 G21 Input in mm
 G80 Cancel canned cycles
 G81 Drilling cycle
 G82 Counter boring cycle
 G83 Deep hole drilling cycle
 G90 Absolute positioning
 G91 Incremental positioning

Table of Important M codes

 M00 Program stop


 M01 Optional program stop
 M02 Program end
 M03 Spindle on clockwise
 M04 Spindle on counterclockwise
 M05 Spindle stop
 M06 Tool change
 M08 Coolant on
 M09 Coolant off
 M10 Clamps on
 M11 Clamps off
 M30 Program stop, reset to start

5.4 Simple part programming for turning.


1. Prepare a program to machine work piece as shown in fig on a lathe (S-08, S-11)
Point X Co- Z Co-
ordinate ordinate
P0 0.00 2.00
P1 0.00 0.00
P2 60.00 0.00
P3 80.00 - 40.00
P4 90.00 - 40.00
P5 90.00 -65.00
P6 95.00 -65.00

Program Description
N10 G28 U 0.00 W 0.00; Return to machine reference position
N20 G90 G21 G95; Absolute positioning Input in mm, feed mm/rev,

N25 M06 T01: Tool change and tool no 1

N30 M03 S800 M08; Spindle on clockwise , spindle speed 800 rpm,
Coolant on
N40 G00 X0.00 Z 2.00 Rapid travel at X0 Z 2, (P0)
N50 G01 X0.00 Z0.00 F0.2; Linear interpolation at X0 Z0,feed rate
0.2mm/rev. (P1)
N60 X60.00 Z0.00; Move to X60 Z 0 .(P2)
N70 X80.00 Z -40.00; Move to X80 Z-40. (P3)
N80 X90.00; Move to X90. (P4)
N90 Z -65; Move to Z-50. (P5)
N100 X95; Move to X95. (P6)
N110 G00 G28 U0.00 W0.00; Rapid, return to reference position
N120 M05 M09; Spindle stop, coolant off
N130 M30; Program end

2. Calculate the cutting parameters and prepare process sheet for the component shown in
Fig.No.1 with neat diagram. All the dimensions are in mm.
Given: Raw material - Aluminum, Stock Size – Dia.14 X 42 length, Feed ( f ) = 0.2 mm/rev.,
Cutting Speed (V) = 90 m/min., Consider work zero (W) as per Fig. No. 1.

Given Data:
V = 90 m/min., f = 0.2 mm/rev., D = 14 mm, Depth of cut, dc = 1 mm, Length of Cut, l= 25 mm
Cutting Parameters:
Spindle Speed: V = πDN/1000
N = 2043 rpm.
Feed: f = 0.2 mm/rev.
Depth of Cut: dc = 1 mm

Part Program
3. Prepare a part program to machine the workpiece shown in Fig. on CNC lathe.
Assuming S=1500 rpm and Feed= 0.2 mm /rev
Point X Co- Z Co-
ordinate ordinate
P0 0.00 2.00
P1 0.00 0.00
P2 20 -10
P3 20 -30
P4 30 -50
P5 30 -100
P6 40 -100

Program Description
N10 G28 U 0.00 W 0.00; Return to machine reference position
N20 G90 G21 G95; Absolute positioning, Input in mm, feed mm/rev,
N30 M06 T01: Tool change and tool no 1
N40 M03 S1500 M08; Spindle on clockwise , spindle speed 1500 rpm,
Coolant on
N50 G00 X0.00 Z 2.00; Rapid travel at X0 Z 2, (P0)
N60 G01 X0.00 Z0.00 F0.2; Linear interpolation at X0 Z0,feed rate
0.2mm/rev. (P0 to P1)
N70 G03 X 20 Z-10; Anticlockwise circular interpolation, (P1to P2)
N80 G01 X20 Z-30 ; Linear interpolation (P2 to P3)
N90 G01 X30 Z-50; Linear interpolation (P3 to P4)
N100 G01 X30 Z-100 Linear interpolation (P4 to P5)
N110 G00 X40 Z-100 Rapid interpolation (P5 to P6)
N120 G28 U0.00 W0.00 Return to machine reference position
N130 M05 M09; Spindle off , Coolant off
N140 M30; Program end

5.5 SIMPLE PART PROGRAMMING FOR MILLING

1. Prepare a part program for machining component as shown in Fig. No. 1. Use following
data: cutting speed: 1200 rpm, feed : 60 mm/min, thickness of component 3 mm, Tool
reference position is 4 mm above the surface of the workpiece. Assume suitable data if
any.

Cutting speed: 1200 rpm, feed: 60 mm/min


Thickness of component 3 mm,
Tool reference position is 4 mm above the surface of the workpiece

Point X Co- Y Co-


ordinate ordinate
P1 -10 0
P2 0 0
P3 0 50
P4 10 60
P5 60 60
P6 60 10
P7 50 0

Program Description
O 1234 Program Number
N10 G28 U 0.00 V0.00 W 0.00; Return to machine reference position
N20 G90 G21 G94, G40; Absolute positioning, Input in mm, feed
mm/min, cutter diameter compensation
cancel
N30 M06 T01: Tool change and tool no 1
N40 M03 S1200; Spindle on clockwise , spindle speed 1200
rpm
N45 G41 D01; Cutter radius compensation left (G41),
value stored in D01
N50 G00 X-10 Y0 Z 4; Rapid travel of cutter to position 1
N60 G00 X0 Y0; Rapid travel of cutter to position 2
N70 G01 Z -3 M08 F 60; Cutter position (2) moves depth 3 mm in Z,
coolant on, feed 60 mm/min
N80 G01 Y50; Cutter travel at position - 3
N90 G02 X10 Y60 R10 F60; Circular interpolation clockwise, Cutter
travel at position 4
N100 G01 X60 Y60; Cutter travel at position 5
N110 G01 Y10; Cutter travel at position 6
N120 G01 X50 Y0; Cutter travel at position 7
N130 G01 X0 Y0; Cutter travel at position 2
N140 G01 Z 4; Tool moves positive 4 upward
N145 G40; Cutter compensation cancel
N150 G28 U0.00 V 0.00 W0.00; Return to machine reference position
N160 M05 M09; Spindle off , Coolant off
N170 M30; Program end

2) Write CNC programme for milling a component as shown in fig. no. 2 with
end mill of 20 mm diameter, thickness of plate 10 mm, feed 90 mm/min,
spindle rpm 450. Assume suitable data if necessary.
Point X Co- Y Co-
ordinate ordinate
P1 -10 -10
P2 0 0
P3 0 40
P4 40 40
P5 40 80
P6 105 80
P7 120 65
P8 120 15
P9 105 0

Program Description
O 3678 Program Number
N10 G28 U 0.00 V0.00 W 0.00; Return to machine reference position
N20 G90 G21 G94, G40; Absolute positioning, Input in mm, feed
mm/min, cutter diameter compensation
cancel
N30 M06 T01: Tool change and tool no 1
N40 M03 S450; Spindle on clockwise , spindle speed
450rpm
N45 G41 D01; Cutter radius compensation left (G41),
value stored in D01=10 mm
N50 G00 X-10 Y-10 Z 4; Rapid travel of cutter to position 1
N60 G00 X0 Y0; Rapid travel of cutter to position 2
N70 G01 Z -10 M08 F 90; Cutter position (2) moves depth 10 mm in
Z, coolant on, feed 90 mm/min
N80 G01 Y40; Cutter travel at position 3
N90 G01 X40; Cutter travel at position 4
N100 G01 Y80; Cutter travel at position 5
N110 G01 X 105 Y80; Cutter travel at position 6
N120 G02 X120 Y65 R15; Circular interpolation clockwise G02, Cutter
travel at position 7
N130 G01 Y15; Cutter travel at position 8
N140 G02 X105 Y0 R15; Circular interpolation clockwise G02, Cutter
travel at position 9
N150 G01 X0 Y0; Cutter travel at position 2
N160 G01 Z4; Tool moves positive 4 upward
N170 G40; Cutter compensation cancel
N180 G28 U0.00 V 0.00 W0.00; Return to machine reference position
N190 M05 M09; Spindle off , Coolant off
N200 M30; Program end

3) Write a part program to machine the part given in fig in a CNC milling machine.

Assumption-

N=1000 RPM F=400 mm/min D=6 mm Z=3


Point X Co- Y Co-
ordinate ordinate
P1 0 0
P2 67.5 0
P3 67.5 30
P4 57.5 45
P5 0 45
P6 0 60
P7 82.5 60
P8 82.5 0

Program Description
O 9999 Program Number
N10 G28 U 0.00 V0.00 W 0.00; Return to machine reference position
N20 G90 G21 G94, G40; Absolute positioning, Input in mm, feed
mm/min, cutter diameter compensation
cancel
N30 M06 T01: Tool change and tool no 1
N40 M03 S1000; Spindle on clockwise , spindle speed
1000rpm
N50 G41 D01; Cutter radius compensation left (G41),
value stored in D01=3 mm
N60 G00 X0 Y0 Z3; Rapid travel of cutter to position 1
N70 G00 X67.5 Y0 Z3; Cutter position moves at point (2)
N80 G01 Z-3 M08 F400; Cutter position (2) moves depth 3 mm in Z,
coolant on, feed 400 mm/min
N90 G01 Y30; Cutter travel at position 3
N100 G03 X52.5 Y45 R15; G03-Circular interpolation anticlockwise,
Cutter travel at position 4
N110 G01 X 0 Y45; Cutter travel at position 5
N120 G01 Y60 ; Cutter travel at position 6
N130 G01 X82.5 ; Cutter travel at position 7
N140 G01 Y0; Cutter travel at position 8
N150 G01 X67.5; Cutter travel at position 2
N160 G01 Z 3; Tool moves positive 4 upward
N170 G40; Cutter compensation cancel
N180 G28 U0.00 V 0.00 W0.00; Return to machine reference position
N190 M05 M09; Spindle off , Coolant off
N200 M30; Program end

5.6 Importance of Canned cycle, Subroutine, Macro and Do loops, Macros

1. Canned cycle-

 When the same operation has to be repeated for number of times then the program
becomes lengthy, time consuming, tedious and uses more computer memory space.
 All these factor are eliminated by the use of canned cycle.
 Canned cycle written in the main program, but it reduces the length of program.
 The canned cycle may be defined as a set of instruction stored in the memory of the
system, to perform a fixed sequence of operations.
 Canned cycle is used for repetitively and common used machining operations. And it is
stored under the G code.
 It s used for repetitive operation where material is to be cut in multiple passes.
 It reduces the length of program and its complexity,
 Canned cycles should be cancelled after their use by using G80.
G81- For Drilling Cycle
G71- stock removal in turning
G78-Threading cycle
G85-Boring cycle.

2. Subroutine (Subprogram)-

 When the identical machining operation is to be performed repeatedly then the general
methods of program will be lengthy, time consuming, tedious and uses more computer
memory space.
 In such case subroutine is a powerful time saving technique.
 The subprogram is stored at the end of main program and can be called at any time and
for any number of times during the execution of main program.
 In order to call the subroutine in the main program, the miscellaneous code M98 is used
and the block of instruction is as shown below:-
N35 M98 P95 L1;
M98-instucts the controller to jump to subroutine
P95- tells the controller that 95 (example) is the program number
L1 instructs the controller to execute the subroutine one time.

 In order to end the subroutine and return back to the main program a miscellaneous code
M99 is used.
3.Do -loops

 Whenever an operation is to be repeated over a number of times, a Do loop comes into


picture.
 Instead of writing the same blocks of instruction for different co-ordinates, a do loop is
used to write the program. It repeats a series of instructions in a single block for the
specified number of times.
 Thus a do loop reduces the time required to write a program, the number of blocks and
also the memory required.
 A do loop statements is given in the main program itself. The do loop code has the
following format-
G25 P ___Q______L_____
G25-Signals the start of a loop
P-Specifies the beginning block number of the loop.
Q- Specifies the ending block number of the loop.
L- Specifies the number of times to perform the loop.
N002 G00 G40 G80 G90 G94;

N201 T01 M06;

N202 G00 X10 Y10. S3500 M03;


N203 G43 Z0. H01 M08;
N204 G81 X10 Y10 Z-5. F70;

(BEGIN LOOP)

N205 G25 P206 Q206 L9;


N206 G91 X10;
N207 G80 M09;
N208 G00 G91 G30 Z0. M05;
N209 G30 X0. Y0.

N211 M30;
4. Macros-

 Macro programming is the similar of NC conventional programming where we use the


numerical value with variable.

 G65 is use to activate macro variable programs.

 CNC Macro variables types

 Local variable (#1 to #33)

 Common variables (#100 to #199)

 Permanent Common variables (#500 to # 550)

 System variable (#1000 to #9999)

Use of Macro

• Arithmetic and algebraic calculations

• Trigonometric calculations

• Variable data storage

• Logical operations

Example-1
Example-2

5.7 Tool compensation


 In CNC Machines, the tools and cutters used are of different sizes. Therefore, these must
be a method to compensate for varied lengths of tools and varied radius of the cutters.

1) Tool length compensation (G43)


 Most of the CNC machines use multiple tools and length of each tool in
different. Therefore, the programmer has to account of for the individual tool
length while programming the Z-dimension.
 The distance of a given tool tip from the surface of the workpiece is known as
tool length offset “H”.
 The tool length offsets H01, H02, H03, etc for different tools are determined
from the tool length and stored in the tool register.
 Format- G43 Z__ H___
G44 Z__ H__;

Where-
G43-Positive tool length compensation/offset
G44-Negative tool length compensation/offset
G49- Tool length compensation/offset Cancel
H_-Tool length offset number.

 Need and Importance of tool Compensation/Offset-


a) To specify tool each toll’s length.
b) To specify radius of tool
c) To assign program zero.
2) Tool radius Compensation

 Tool radius compensation is a function of the CNC controller to automatically shift the
tool from cutter center line to the cutter edge along the programmed cutter path.
 A part program is developed for the exact size of the cutter to be used on machine.
But during actual machining, if a smaller diameter cutter is selected, it will result in a
larger workpiece. Similarly a larger diameter cutter will result smaller workpiece.
 It is therefore necessary to compensate for the different diameter cutter by using cutter
radius compensation.

 Compensation is done by offsetting the tool path by the distance equal to the radius of the
cutter.
 This value is entered into the memory of the control system under the address of D01,
D02 etc.
 Format- G41 X__Y___D___;
G42 X__Y___D___;

Where- G40 – Cancel tool Radius offset


G41- Tool radius Compensation left
G42- Tool radius Compensation right
5.8 Explain need of virtual CNC machine simulators

Need of Virtual CNC Machine Simulator:-

[1] Manufacturing process can be defined and verified in early stage


[2] Allows designers to conduct machining process planning, generating tool path
[3] Easy to visualize the process and simulate operations
[4] Automatically calculate machining time
[5] The tool path generated can be converted into CNC codes
[6] Editing in the program is easy sue to prior information
[7] Errors can be found out easily
[8] Provides analysis features

Computer-Aided Manufacturing Software


 Fusion 360.
 Solid Edge.
 HSM.
 Solid Works CAM.
 CAM Works.
 NX CAM.
 Gibbs CAM.
 Power Mill.
 Master cam

You might also like