Lecture-5 - CNC Programming, G and M Codes
Lecture-5 - CNC Programming, G and M Codes
Programming
Week 11
Instructors:
Ms. Syeda Laraib Tariq
Lecturer, Wah Engineering College, UOW, Wah
Email: [email protected]
2
BRIEF INTRODUCTION
• B.Sc. Mechanical Engineering (2013-2017)
University of Sargodha, Sargodha
(CGPA 3.60,Bronze Medalist)
3
My Research Area
• Heat Sinks with Nano-Phase Change Material for Passive Cooling
MY RESEARCH WORK
(Published)
• Akram, M. A., Khushnood, S., Tariq, S. L., Ali, H. M., & Nizam, L. A.
(2019). Vibration Based Gear Fault Diagnosis under Empirical
Mode Decomposition and Power Spectrum Density
Analysis. Advances in Science and Technology Research
Journal, 13, 3.
• Tariq, Syeda Laraib, Hafiz Muhammad Ali, and Muhammad Ammar Akram.
"Thermal applications of hybrid phase change materials: a critical
review." Thermal Science 24.3 Part B (2020): 2151-2169.
5
MY RESEARCH WORK
(Published)
• Khattak, M. A., OMRAN, A. A. B., Kazi, S., Khan, M. S., ALI, H. M.,
TARIQ, S. L., & AKRAM, M. A. (2019). A review of failure modes of
nuclear fuel cladding. Journal of Engineering Science and
Technology, 14(3), 1520-1541.
•The two most common axis types are linear (driven along a straight path)
and rotary (driven along a circular path).
Basic CNC Principles & Coordinates System
•Increments for all base lines are specified in linear measurements, for most
machines the smallest increment is one ten-thousandth of an inch (.0001).
•If the machine is graduated in metric the smallest increment is usually one
thousandth of a millimeter (.001mm).
Disadvantages:
• Costly setup, skilled operators
• Computers, programming knowledge required
• Maintenance is difficult
Types of Machine
• Lathes for metal and plastics
• Used to produce 3D product shapes and moulds for plastic products.
• Milling machine for mould making and surface milling.
• Used to produce dies for
die cutting printed products.
CNC Lathe
• Coordinate System
• Units, incremental or absolute positioning
• Preparatory Codes:
• 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
Optimum machine programming requires consideration of certain machine operating parameters including:
• Positioning control
• Compensations
• Special machine features
Positioning control is the ability to program tool and machine slide movement simultaneously along two or
more axes.
Positioning may be for point-to-point movement or for contouring movement along a continuous path.
Contouring requires tool movement along multiple axes simultaneously.
This movement is referred to as “Interpolation” which is the process of calculating intermediate values
between specific points along a programmed path and outputting those values as a precise motion.
Interpolation may be linear having just a start and end point along a straight line, or circular which requires
an end point, a center and a direction around the arc.
Rules for programming
Block Format
Sample Block
• Restrictions on CNC blocks
• Each may contain only one tool move
• Each may contain any number of non-tool move G-codes
• Each may contain only one feed rate
• Each may contain only one specified tool or spindle speed
• The block numbers should be sequential
• Both the program start flag and the program number must be
independent of all other commands (on separate lines)
• The data within a block should follow the sequence shown
in the above sample block
CAD/CAM
Two computer-based systems which impact the use of CNC technology are computer aided design and
computer aided manufacturing.
A computer aided design, or CAD, system uses computers to graphically create product designs and
models.
These designs can be reviewed, revised, and refined for optimum end use and application. Once finalized,
the CAD design is then exported to a computer aided manufacturing, or CAM, system.
CAM systems assist in all phases of manufacturing a product, including process planning, production
planning, machining, scheduling, management and quality control.
APT Programming Example
Cylindrical Part
F 25
Raw Material
70
F 22.5
F 17.5
Finished Part
20
30
APT Programming Example (Cylindrical
Part)
O0013
N0005 G53
N0010 T0303
N0020 G57 G00 X26.00 Z0.0 S500 M04
N0030 G01 X-0.20 F100
N0040 G00 Z2.0
N0050 X50.0 Z50.0
N0060 T0404
N0070 G57 G00 X22.50 Z2.0 S500
N0080 G01 Z-30.0 F100
N0090 G00 X23.0 Z2.0 S500
N0100 G84 X17.5 Z-20.0 D0=200 D2=200 D3=650
N0110 G00 Z2.0
N0120 X50.0 Z50.0
N0130 M30
APT Program Interpretation
O0013
Program identification number
APT Program Interpretation
O0013
N0005 G53
To cancel any previous working zero
point
APT Program Interpretation
O0013
N0005 G53
N0010 T0303
z
(0,0) +ve
APT Program Interpretation
O0013
N0005 G53
N0010 T0404
N0020 G57 G00 X26.00 Z0.0 S500 M04
N0030 G01 X-0.20 F100
Programming Example
Tool Change
G55 X200 Y80
Program 2
N001 M06 T2
x N002 M03 rpm 400
N003 G01 X-8 Y0 Z0 XYFeed 150
N004 G01 X20 Y15 Z10 XYFeed 150 ZFeed 150
N005 G01 X20 Y15 Z-10 ZFeed 75
N006 G01 X20 Y15 Z10 ZFeed 150
N007 G01 X50 Y15 Z10 ZFeed 150
N008 G01 X50 Y15 Z-10 ZFeed 75
N009 G01 X50 Y15 Z10 ZFeed 150
N010 G01 X50 Y45 Z10 ZFeed 150
N011 G01 X50 Y45 Z-10 ZFeed 75
N012 G01 X50 Y45 Z10 ZFeed 150
N013 M05
N014 M02
Program Interpretation
G55 X200 Y80
Spindle Off
Program Interpretation
G55 X200 Y80
Program 1
N001 M06 T1
N002 M03 rpm 400
N003 G01 X-8 Y0 Z0 XYFeed 150
N004 G01 X-8 Y0 Z-0.5 ZFeed 150
N005 G01 X70 Y0 Z-0.5 XYFeed 75
N006 G01 X70 Y60 Z-0.5 XYFeed 75
N007 G01 X30 Y60 Z-0.5 XYFeed 75
N008 G01 X0 Y40 Z-0.5 XYFeed 75
N009 G01 X0 Y0 Z-0.5 XYFeed 75
N010 G81 R3 E9 N7 Z-0.5
N011 M05
N012 M02
End Program
Program Interpretation
Tool Change
Tool Change
G55 X200 Y80
Program 2
Tool Change
G55 X200 Y80
Program 2
N001 M06 T2
Tool Change
G55 X200 Y80
Program 2
N001 M06 T2
N002 M03 rpm 400
Tool Change
G55 X200 Y80
Program 2
N001 M06 T2
N002 M03 rpm 400
N003 G01 X-8 Y0 Z0 XYFeed 150
Tool Change
G55 X200 Y80
Program 2
N001 M06 T2
N002 M03 rpm 400
N003 G01 X-8 Y0 Z0 XYFeed 150
N004 G01 X20 Y15 Z10 XYFeed 150 ZFeed 150
Tool Change
G55 X200 Y80
Program 2
N001 M06 T2
N002 M03 rpm 400
N003 G01 X-8 Y0 Z0 XYFeed 150
N004 G01 X20 Y15 Z10 XYFeed
150 ZFeed 150
N005 G01 X20 Y15 Z-10 ZFeed 75
Tool Change
G55 X200 Y80
Program 2
N001 M06 T2
N002 M03 rpm 400
N003 G01 X-8 Y0 Z0 XYFeed 150
N004 G01 X20 Y15 Z10 XYFeed 150 ZFeed 150
N005 G01 X20 Y15 Z-10 ZFeed 75
N006 G01 X20 Y15 Z10 ZFeed 150
Tool Change
G55 X200 Y80
Program 2
N001 M06 T2
N002 M03 rpm 400
N003 G01 X-8 Y0 Z0 XYFeed 150
N004 G01 X20 Y15 Z10 XYFeed 150 ZFeed 150
N005 G01 X20 Y15 Z-10 ZFeed 75
N006 G01 X20 Y15 Z10 ZFeed 150
N007 G01 X50 Y15 Z10 ZFeed 150
93