2. CNC PROGRAMMING
• CNC programming is a detailed list of
instructions that need to be executed by the
machine control unit to achieve the final
component shape. CNC programming can be
done by two different ways.
• Manual Part programming
• Computer Assisted Part Programming
3. NC BLOCK:
• NC block is a collection of NC words. An NC word is a collection of address letters & a sequence number. It gives
information about the movement of the tool in X,Y & Z co ordinates, the tool to be used, spindle speed, feed etc.
• A generalized NC block is given below:
• N_ G_ X_ Y_ Z_ R_ F_ S_ T_ M_
• N is the Sequence number. Each block or line starts with a sequence number which identifies the block. It gives an
identifying number for each block of information. It is generally good practice to increment each block number by
5 or 10 to allow additional blocks to be inserted if future changes are required.
• G is the Preparatory functions which are used to set the control for the various machine movements such as
linear movement, circular movement. Preparatory functions preapares the controller to carry the instructions
that are to follow after the G letter.
• X,Y & Z are used to specify the co ordinates along X,Y & Z axes
• . R is the arc radius to be used in circular interpolations.
• F is the Feed Rate in mm/min or mm/rev.
• S is the spindle speed in RPM.
• T is the tool function which specifies the type of the tool & its offset number in automatic tool changer.
• M is the Miscellaneous function used to perform auxillary functions which do not relate to the dimensional
movements of the machine tool or the cutting tool.
•
4. PREPARATORY CODES: ( G Codes)
G-code Function
G00 Positioning rapid traverse
G01 Linear interpolation (feed)
G02 Circular interpolation CW
G03 Circular interpolation CCW
G04 Dwell
G20 Inch unit
G21 Metric unit
G28 Automatic zero return
G32 /
G33
Thread cutting (single motion)
G40 Tool nose radius compensation cancel
G41 Tool nose radius compensation left
G42 Tool nose radius compensation right
G70 Finishing cycle
G71 Stock removal in turning
G72 Stock removal in facing
G73 Pattern repeating
G74 Peck drilling on Z axis / Face grooving
G75 Grooving cycle
G76 Multiple threading cycle
G94 /
G98
Feed per minute
5. G-codes
G40 Tool nose radius compensation cancel
G41 Tool nose radius compensation left
G42 Tool nose radius compensation right
G43 Tool length compensation
G80 Canned cycle cancel
G81 Drilling cycle
G82 Drilling cycle with dwell
G83 Peck drilling cycle / deep drill
G84 Tapping cycle
G85 Boring / Reaming cycle
G86 Boring cycle
G90 Absolute command
G91 Incremental command
G94 Feed per minute
G95 Feed per revolution
G98 Return to initial point in canned cycle
9. CUTTER RADIUS COMPENSATION (CRC)
• G40 Tool nose radius compensation Cancel
• G41 Tool nose radius compensation Left
• G42 Tool nose radius compensation Right
• G40 CUTTER COMPENSATION CANCEL
• N_ G40
• The G40 cancels any cutter compensation that
was applied to the tool during a program and acts
as a safeguard to cancel any cutter compensation
applied to a previous program or G-codes.
10. • G41 CUTTER COMPENSATION LEFT
• N_ G41 X_ Y_ Z_ F_
• The G41 compensates the cutter a specified distance to the left-
hand side of the programmed tool path. It is used to compensate
for excessive tool wear or substitute a tool to profile a part.
• G42 CUTTER COMPENSATION RIGHT
• N_ G42 X_ Y_ Z_ F_
• The G42 compensates the cutter a specified distance to the right-
hand side of the programmed tool path. It is used to compensate
for excessive tool wear or substitute a tool to profile a part.
• N__ G01 G41/42 X__ Y__ D__ F__
11. Necessity of using CRC
• Difficult to calculate cutter center co-ordinates
• If cutter center co-ordinates are used Same diameter of cutter is required to be used
Cutter wear can not compensated
14. MISELLANEOUS CODES: (M codes)
M-codes Function
M00 Optional program stop automatic
M01 Optional program stop request
M02 Program end
M03 Spindle ON clock wise (CW)
M04 Spindle ON counter clock wise (CCW)
M05 Spindle stop
M06 Tool change
M07 Mist coolant ON (coolant 1 ON)
M08 Flood coolant ON (coolant 2 ON)
M09 Coolant OFF
M30 End of program, Reset to start
M98 Sub program call
M99 Sub program end
15. Fundamentals of NC Technology:
15
a. Basic components of an NC system.
An NC system consists of three basic components:
a. A program of instructions
b. A Machine Control Unit
c. Processing Equipment
16. 16
b. NC Co-ordinate systems.
There are two axis systems used in NC, based on the Cartesian co-ordinate system
1. Flat and Prismatic work parts
2. Rotational parts
Flat and Prismatic work parts:
It consists of three linear axes (X, Y and Z) in the Cartesian co-ordinate system,
plus three rotational axes (a, b and c).
These systems are associated with NC Milling and Drilling machines.
17. Axes convention
The tool can be moved to any position in a 3 dimensional cartesian co-ordinate
system.
The Z axis is along the spindle axis. The X and Y axes are perpendicular to Z.
18. Experiment -1 Write a Manual part program for the given contour. Take
diameter of the cutting tool = 5mm, Spindle speed = 2000 rpm, Feed rate =
40 mm/min.
100
80
80
100
19.
20. • O0001
• G21 G90 G99
O0001 /* Program Name
G90 G21 G94 /* Initial G code
M06 T01 /* Select tool or Tool change
M03 S2000 F40 /* Spindle start in CW direction
G00 X0 Y0 Z2 /* Move the tool to origin of the work piece
G01 X7.5 Y12.5 /* Move the tool to 1st location of the work piece
without cutter radius compensation
G01 Z-5 /* Give the depth cut of 10mm in Z direction
G42 X10 /* Cutter radius compensation Right of the work piece
G01 X10 Y10 /* Move the tool to 1st location
G01 X90 Y10 /* Move the tool to 2nd location
G01 X90 Y90 /* Move the tool to 3rd location,
G01 X10 Y90 /* Move the tool to 4th location
G01 X10 Y10 /* Move the tool to 1st location
G40 X17.5 Y7.5 /* Cancel the cutter radius compensation
G00 Z2 /* Remove the depth of cut in Z direction
G28 X0 Y0 Z2 /* Go to Home position
M05 /* Spindle OFF
M30 /* Stop the machine and Restart the program
Location X Y
1 10 10
2 90 10
3 90 90
4 10 90
1 10 10
21. Experiment -2 O0001 /* Program Name
G90 G21 G94 /* Initial G code
M06 T01 /* Select tool or Tool change
M03 S2000 F40 /* Spindle start in CW direction
G00 X0 Y0 Z2 /* Move the tool to origin of the work piece
G01 X7.5 Y12.5 /* Move the tool to 1st location of the work piece
without cutter radius compensation
G01 Z-5 /* Give the depth cut of 10mm in Z direction
G42 X10 /* Cutter radius compensation Right of the work piece
G01 X10 Y10 /* Move the tool to 1st location
G01 X70 Y10 /* Move the tool to 2nd location
G01 X70 Y70 /* Move the tool to 3rd location,
G01 X10 Y70 /* Move the tool to 4th location
G01 X10 Y10 /* Move the tool to 1st location
G40 X17.5 Y7.5 /* Cancel the cutter radius compensation
G00 Z2 /* Remove the depth of cut in Z direction
G28 X0 Y0 Z2 /* Go to Home position
M05 /* Spindle OFF
M30 /* Stop the machine and Restart the program
Location X Y
1 10 10
2 70 10
3 70 70
4 10 70
1 10 10
22. Manual Part Program on Milling Operations:
22
Q) Write a Manual part program for the given contour. Take diameter of the
cutting tool = 5mm, Spindle speed = 2000 rpm, Feed rate = 40 mm/min.
Note: All dimensions are in mm
24. 24
Step 1. Write Manual part program
O0001 /* Program Name
G90 G21 G94 /* Initial G code
M06 T01 /* Select tool or Tool change
M03 S2000 F40 /* Spindle start in CW direction
G00 X0 Y0 Z2 /* Move the tool to origin of the work piece
G01 X22.5 Y7.5 /* Move the tool to 1st location of the work piece
without cutter radius compensation
G01 Z-10 /* Give the depth cut of 10mm in Z direction
G41 Y10 /* Cutter radius compensation left of the work piece
G01 X20 Y10 /* Move the tool to 1st location
G01 X20 Y20 /* Move the tool to 2nd location
G02 X20 Y40 R10 /* Move the tool to 3rd location, circular interpolation
in CW.
G01 X20 Y50 /* Move the tool to 4th location
G01 X60 Y50 /* Move the tool to 5th location
G01 X60 Y40 /* Move the tool to 6th location
G03 X60 Y20 R10 /* Move the tool to 7th location
G01 X60 Y10 /* Move the tool to 8th location
G01 X20 Y10 /* Move the tool to 1st location
G40 X17.5 Y7.5 /* Cancel the cutter radius compensation
G00 Z2 /* Remove the depth of cut in Z direction
G28 X0 Y0 Z2 /* Go to Home position
M05 /* Spindle OFF
M30 /* Stop the machine and Restart the program
Note: All dimensions are in mm
25. 25
Step 2. Assign the blank size
Maximum: X= 100 mm, Y= 100 mm and Z = 10 mm
Minimum : X = 0 mm, Y = 0 mm – OK
Step 3. Assign the Machine
Machine – Fanuc 0M–Select
Step 4. Assign the tool
Tool number – Assign tool – End mill - End mill rough 4 flute – 5.00mm diameter – OK – OK.
Step 5. Compile the program
Syntax – No Error and Warning exist
Step 6. Simulation
Simulate – Start
View – Top view or Isometric view.
26. CADEM SOFTWARES:
1. For Manual Part Programming:
SeeNC Mill
SeeNC Turn
2. For Computer Assisted Part Programming:
Caps Mill
Caps Turn
26
28. Q4) Write a Manual part program for the given contour. Take diameter of the cutting
tool = 5mm, Spindle speed = 2000 rpm, Feed rate = 40 mm/min.
28
32. 32
Q5) Write a Manual part program for the given contour. Take diameter of the cutting tool = 5mm,
Spindle speed = 1200 rpm, Feed rate = 30 mm/min and thickness of the component is 20 mm.
34. 34
Q4) Write a Manual part program for the given contour. Take diameter of the cutting
tool = 10mm, Spindle speed = 1200 rpm, Feed rate = 30 mm/min and thickness of the
component is 20 mm.
Note: All dimensions are in mm
36. 36
Q5) Write a Manual part program for the given contour. Take diameter of
the cutting tool = 5mm, Spindle speed = 1200 rpm, Feed rate = 30
mm/min and Dept of cut is 4mm. Take blank size of 75 X 75 X 20 mm.
Note: All dimensions are in mm
37. M70 - Mirror about +X axis
M71 – Mirror about +Y axis
M80 – Mirror cancel about X axis
M81 – Mirror cancel about Y axis
M98 – Sub program call
M99 – Sub program end
37
+X
-X
- X
+Y
I
II
III IV
O
38. 38
Locati
on
X Y
1 7.5 7.5
2 32.5 7.5
3 7.5 32.5
O0005
G90 G21 G94
M06 T01 (Dia of 5mm End mill cutter)
M03 S1200 F30
G00 X0 Y0 Z2
M98 P00010055
M70
M98 P00010055
M80
M71
M98 P00010055
M81
M70
M71
M98 P00010055
M80
M81
G28 X0 Y0 Z2
M05
M30
O0055
G01 X7.5 Y7.5
G01 Z-4
G01 X32.5 Y7.5
G03 X7.5 Y32.5 R20
G01 X7.5 Y7.5
G01 Z2
M99
M70 - Mirror about +X axis
M71 – Mirror about +Y axis
M80 – Mirror cancel about X axis
M81 – Mirror cancel about Y axis
M98 – Sub program call
M99 – Sub program end
39. “Part Program on Drilling Operations
Presented by:
Dr Yathish Narayana Rao K N
Associate Professor
Dept of Mechancial Engg
SJCIT
39
40. Q1) Write a manual part program for the following figure. Take diameter
of 6mm HSS twist drill , Feed 50 mm/min and Spindle speed 1500 rpm.
40
Note: All dimensions are in mm
43. Canned Cycles:
Cycles are used for stock removal of material from the work piece.
Some of the drilling canned cycles are
1. Drilling Cycle (G81)
Format: G98/G99 G81 R Z F
Where G98 - Return to initial point in canned cycle
G99 - Return to R point in canned cycle
G81 – Drilling cycle code
R – Safe height / R- point (Return point)
Z – Final depth
F – Feed rate in mm/min.
43
44. 44
2. Counter bore cycle (G82)
Format: G98/G99 G82 R Z P F
Where P – Dwell at bottom in sec.
3. Peck drill cycle (G83)
When depth of hole is greater than the diameter of hole
Format: G98/G99 G83 R Z Q F
Where Q– Peck depth in mm.
4. Tapping Cycle (G84)
Right hand tapping
Format: G98/G99 G84 R Z F
Where F = Feed rate in mm/min
= Spindle speed in RPM X Pitch
Note: Spindle direction in RH tapping, CW during In feed, CCW during Out feed.
45. 45
5. Tapping Cycle (G74)
Left hand tapping
Format: G98/G99 G74 R Z F
Where F = Feed rate in mm/min
= Spindle speed in RPM X Pitch
Note: Spindle direction in LH tapping, CCW during In feed, CW during Out feed.
6. Reaming Cycle (G85): G98/G99 G85 R Z F
7. Boring Cycle (G86): G98/G99 G86 R Z F
8. G80 – Canned Cycle Cancel
47. Q1) Write a manual part program for the following figure. Take diameter of 5mm HSS twist drill ,
Reaming=5mm,countr bore =8mmFeed 50 mm/min and Spindle speed 1500 rpm.
47