lectures notes of computer aided manufacturing
TRANSCRIPT
![Page 1: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/1.jpg)
1
Modern University For Technology and Information
Mechanical Engineering Department
Lectures Notes of
Computer Aided
Manufacturing
MENG 304
Prepared By Asoc.Prof. Omar Koura
![Page 2: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/2.jpg)
2
Vision
The vision of the Faculty of Engineering at MTI university is to be a
center of excellence in engineering education and scientific research in
national and global regions. The Faculty of Engineering aims to prepare
graduates meet the needs of society and contribute to sustainable
development.
Mission
The Faculty of Engineering MTI university aims to develop
distinguished graduates that can enhance in the scientific and
professional status, through the various programs which fulfill the needs
of local and regional markets. The Faculty of Engineering hopes to
provide the graduates a highly academic level to keep up the global
developments.
![Page 3: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/3.jpg)
3
Lecture Note 1 : Computer Numerical Control (CNC)
➢ Introduction
• CNC stands for computer numerical control.
• CNC uses numerical data to control various types of machines:
- Machine tools:
o Turning centers
o Machining centers o Drilling o Grinding machines
- Forming machines:
o Punching machines o Blanking machines o Sheet metal works
- Laser cutting machines
- Robots
- Electronic assembly systems
➢ Difference between Manual and Automated machine tools
Machine tools are machines that can remove material in the form of chip from a raw
material using a cutting tool with certain form and specification.
The cutting is produced as the machine is generating relative motions between the raw
material and the cutting tool. Hence, to manufacture any part on manually operated
machine tool, the components shown in figure 1.1 must be available.
Fig 1.1: Production components on Manual machine
5-Operator
1-Raw material
2-Cutting tools
7-Measuring equipment 6-Handling equipment
3-Operation sheet
4-Machine tool
Product
![Page 4: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/4.jpg)
4
➢ Production components on Manual machine
1. Raw material
2. Appropriate cutting tools
3. An operation sheet that contains the sequence of operations, the required tool type
and the cutting conditions that will be followed to produce the product. Some users
do not consider this item to be necessary as they rely upon the experiences and skill
of the operator, but, even if the same operator is used and if he is highly skilled, no
guarantee that when producing several parts.
4. A machine that holds the raw material, holds the tools, and can produce the relative
motions between both the raw material and the tools (rotational motion, translation
motions) to provide the feed, cutting speed & depth of cut.
5. Operator that carries out the following main functions: -
• Read the operation sheet line by line,
• Analyze and process mentally the contents of each line.
6. Handling equipment if the raw material is quite heavy to handle it manually
7. Measuring instruments to check the resulted dimension
However, if the operator’s functions are carried out by some controlling mechanical,
hydraulic and/or electrical elements, then the machine is an automated machine tool. It,
also follows that the form and format of the process sheet that holds the sequence of
operation and cutting conditions should be changed to suit the unit that will read the
instruction given in the newly formatted program carrier, figure 1.2. If the FORMAT
of the data fed to the machine through reading the program carrier is written in an Alfa
– Numerical instruction and the machine utilizes a computer to process the instructions,
then it is a Computerized Numerical Control Machine Tool. (CNC).
Fig 1.2: Production components on Automated machine
5-Control system
1-Raw material
2-Cutting tools
Measuring equipment Handling equipment
3-Part Program
4-Machine tool
Product
![Page 5: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/5.jpg)
5
➢ Advantages of CNC
The main advantages are: -
• Efficiency.
• Accuracy where CNC machines provide an extraordinarily high level of
accuracy.
• Productivity as wasted motion is cut out of the CNC operations program.
• CNC machines provide consistent, dependable, and repeatable performance.
• Less downtime and reduced part-handling time.
• No need to route parts to other machines, since one CNC machine can conduct
multiple operations
• CNCs provide great manufacturing flexibility, speedy changeovers, and
improved efficiency.
• Less rejected parts and this is an important issue, since rejection of partly/fully
manufactured parts does not mean material losses, but also labor cost,
depreciation of machine cost.
![Page 6: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/6.jpg)
6
Lecture Note 2: Component of CNC Machine Tool
CNC machine is an integration of so many engineering systems. Figure 2.1 shows the
main components of CNC Machine Tool. It mainly consists of:-
Fig 2.1 : Main components of CNC machines
1. Mechanical components
This covers all mechanical components (bed, columns, slides, ball screws,
turrets, table, carriages, saddles, spindle and bearing, linear and torque
transmission elements, tool changer mechanisms, chip removal mechanisms and
guards) in the CVC machines.
2. Lubricating System
It covers all the lubricating systems for the slides of the machine, ball screws
supporting bearings, spindle bearings, table components, indexing turret
components and tool Changer components.
3. Hydraulic System
It covers the hydraulic systems needed for the counterbalance systems,
automatic tool changer and hydraulic actuators.
CNC
System
Mechanical
Systems
Lubricating
System
Hydraulic
System
Coolant
System
Electrical
Panel
1. CPU
2. SCU
3. OCP
4. MCP
5. PLC
6. OPD
CPU Central Processing Unit
SCU Servo Control Unit
OCP Operating Control Panel
MCP Machine Control Panel
PLC Programmable Logic Controller
OPD Other Peripheral Devices
![Page 7: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/7.jpg)
7
4. Coolant System
Some CNC machines are equipped with two types of coolant systems; one is
continuous flooding of coolant and the other is a spraying system.
5. Electrical Systems
The main function of the electrical panel is to provide the different systems by
regulated stepped down voltages. It houses the relays, circuit breakers, push
buttons, switches, contactors, overload protectors, ……. etc
6. CNC Systems
As illustrated in CNC System mainly consists of:-
• Central Processing Unit (CPU)
It is the brain of the system. Its main function is to retrieve the
stored input data from the Memory in the form of the part program,
works with the Speed Control Unit to decode the data, transform
the decoded data into position and velocity signal. It receives, also,
the actual position and produces a corrective action.
Again, it calculates errors in the system such as lead screw pitch
error, tool wear, backlash, …. etc and develop a compensating
signal to correct the situation. It carries out several safety checks
and energies the shutting down of the system when necessary.
• Servo Control Unit (SCU)
The Servo control unit receives the decoded position and velocity
signals from the CPU and generates command values which are fed
to the Servo Drive Units. The later are coupled with the axes and
spindle motors.
• Programmable logic controller (PLC)
It is the controller which replaced the old, wired relays in the early NC
machines. It is responsible for the implementation of all the logics to the
system.
• Operator control panel (OCP)
It is the user interface with the different systems.
Figure 2.2 shows an operator control panel. The operator control panel provides the
user interface to facilitate a two-way communication between the user, CNC system
and the machine tool. OCP mainly consists of:-
![Page 8: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/8.jpg)
8
Fig 2.2: Operator control panel
• The display unit displays all related information of the CNC system, such as:-
• Information on the block being executed and its sequence number, the
actual position, feed rate, rotational speed, active G and M
• Actual position value, set or actual difference, current feed rate,
spindle speed
• Alarm messages
If something is not in the correct order alarm must be communicated to
the operator. This is in the form of alarm messages.
• Soft key designations
• All types of entered data, machine data …… etc
• Indicators to indicates:-
• Feed hold status which means that the motion of slides are inhibited
• Program in action which means that the program is being executed and in
progress
• Zero set which means that the reference zero is set and the slide is at this
zero
• Tool compensation which means that the CPU is considering the
compensation
• The slides are in motion
• Alphabetic – Numeric keyboard
This is very similar to a computer keyboard. It is used for editing the part
program, tool data, machine parameters …. It has:-
• Alphabetic characters (A, B, C, ……., Z)
• Numeric (0, 1, 2, 3, ……9)
• Other characters (+, -, *, /, $, £, ……)
Display Unit Alphabetic –
Numeric
Keyboard
Indicators
Cursor Movement
pages
Editing keys
F
I
L
E
S
![Page 9: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/9.jpg)
9
• Cursor Movements Buttons
Those Buttons are used to move the cursor one character right or left or line up
or line down.
• Pages Buttons
Those move the cursor to the start of the part program, or to the end of the part
program, or one page up , or one page down.
• Editing Keys
Editing keys which shifts the cursor one word, delete a word, delete a
block…… etc
• File Keys
Those keys are used to store a part program , survey the different part programs
stored in the memory, delete a file………etc
Machine Control Panel This panel, fig 2.3, is the interface between the operator and the hardware of the
machine.
It is used to set the machine in the proper status before running any part program. Its
main function is to:-
• Establish the zero position of each slide
• Setting the workpieces
• Setting the tools and cutters
• Loading and checking the tool offsets
• Testing the part program through executing it block by block
• Running the program
• Selecting the Mode of operation :-
o Manual Mode
o Manual Data Input (MDI) Mode
o Automatic Mode
o Block by Block Mode
o Zero (Reference) Mode
o Drafting Mode
o Parameters Mode
The Panel contains :-
o Emergency Button (EM). It shuts down all Power, Inhibit all
movements ……
o ON/OFF switch of the Machine Control Panel (switch no. 1).
o Cycle Start “S” is used when starting the execution of the part program
o Feed Hold/start “H” which inhibit the feed motion of the slides
o Set of Indicators for :-
▪ Emergency Button is ON
![Page 10: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/10.jpg)
10
▪ Feed Hold is ON
▪ Lubrication is ON
▪ Machine is at Zero Position
▪ Cycle is running
o Buttons for the different Modes of Operation which are:-
Fig 2.3 : Machine Operating Panel
• Manual Mode (MM) in which all manual operation can be carried out when
pressing Push Button “MM”; such as:-
• running and stopping of spindle speed motor (Push Buttons No. 2),
• running of coolant pump (Push Buttons No. 3).
• indexing of turret (Push Buttons No. 4).
• moving any slide (Push Buttons No. 5). The movement of any slide is
carried out by pressing the corresponding push Button (e.g. +X or –X or
+Z ……). The feed rate or the rotational speed can be pre-entered through
the push Button No. 6. The movement of the slide at the maximum
traverse rate is obtained when pressing the Push Button “R” together with
the any of the axis Push Button. Jogging the axis is resulted by setting the
selector No. 7 to the Jogged value (10, 1, 0.1, 0.01, 0.001 mm) and then
pressing any of the axis Push Button.
• Speed Override selector No. 8 is used to change the programmed speed
by ± 100% of its value. This provides the possibility to increase or
decrease the cutting speed value online while cutting without actually
changing the programmed value.
ON/OFF
OFF OFF
ON ON CW
CCW
+Y
-Y
+X -X
+Z
-Z
EM
6 7 8 9
5
2 3 4
R
1
MM AM BM MDI ZM DM PM
S
H
![Page 11: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/11.jpg)
11
• Feed Override selector No. 9 is used to change the programmed feed by
± 100% of its value. This provides the possibility to increase or decrease
the feed rate value online while cutting without changing the
programmed value.
• Automatic Mode (AM)
In this mode the machine is ready to execute the part program continuously. As soon as
the Cycle Start Button “S” is pressed, the machine works on the first block. While
cutting in one block, the following block in the part program is transferred from the
buffer memory to the CPU for processing ready to be executed as soon as the current
block is finished. The execution stops if the Hold/Start Button “H” . This causes the
freezing of the slide movements . On re-pressing “H” the execution commences
working again .
.
• Block Mode (BM)
In this mode the machine executes the part program block by block. It stops between
the two blocks until the cycle start Button is pressed. This allows the operator to test
the part program.
• Manual Data Input Mode (MDI)
In this mode editing of part program and working with the file directories are possible.
• Zero Mode (ZM)
Sometimes this is known as Reference Module. It is used to set the Zero Datum of the
coordinates (X, Y, Z) of the part program.
• Drafting Mode (DM)
In this module the part program may be checked by tracing the tool path on the screen.
This can be done offline or online.
• Parameter Mode (PM)
Some CNC Machines require certain values to be introduced to the controllers, such
as:-
• Soft travelling Limits for the axes which terminate the movement of the slide
if it reached certain value. This is used as an extra safety if the hardware
limits failed to function.
• Configuration values between the machine and its peripherals
• Tool tables
Figure 2.4 shows an integrated panel for both the operator and the machine.
![Page 12: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/12.jpg)
12
Fig 2.4 : Operator and machine panel
• Other peripheral devices (OPD)
Those are the external devices that are linked with the CNC machines such as
communicating equipment, external computer unit, tape reader, …. etc
Difference between Open and Closed loop control systems
Automatic control is being used on a wide scale in the engineering circles . To
have a control system certain component must exist:-
- An input target value such as request to move the table to the position at 50
mm or to run the main motor at a speed of 200rpm or This is converted as an
input desired signal that corresponds exactly to the input target value.
- A controlling system-controlled element which is the part that we need to
control such as the sliding table of a machine
- The controlling elements that issue the desired command signal
- The controlled element moves to almost the required value, since the received
signal is distorted by the disturbance signal initiated from the environmental
noise, vibration, friction, inertia of moving parts.
This system is known as Open loop control system, figure 2.5.
Fig 2.5: Block diagram for open loop control system
Operator control
panel
Machine Control
Panel
Required input Target
Controlling system
Desired input signal
Correct Controlled signal
Controlled element
Disturbance signal
Distorted Controlled signal
![Page 13: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/13.jpg)
13
To avoid this lack of accuracy two other elements are introduced:-
- A measuring device to measure the achieved position and feedback the signal of
the achieved position to an error detector.
- An error detector that compares the input desired signal with the received signal
from the measuring device and issues an error signal (the resultant of both) to the
servo running the controlled element.
This system is known as Close loop control system, figure 2.6.
Fig 2.6: Block diagram for closed loop control system
Disturbance signal
Required input Target
Controlling system
Desired input signal
Error signal
Controlled
element
Measured signal
Error detector
Measuring system
![Page 14: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/14.jpg)
14
Lecture Note 3: Axes and Format
Axes nomenclature and designation
International ISO standards defined the terminology used with the CNC axes. It
consists of the definition of Linear (main , secondary, and auxiliary) axes and
rotational (main and auxiliary) axes.
Linear axes
In CNC machines more than one element is allowed to move along a linear
axis. In the gantry machine with two milling heads,
figure 3.1, the following linear motions exit:-
• Each head slides along the gross rail
• The spindle of each head moves up and down in a normal direction to the
table
• The gantry moves in the direction indicated along the table
• The cross rail moves up and down in the same direction as the direction of the
spindles
To order a particular drive to operate, it is necessary to define the motion of
that drive. For this reason a standard has been issued to define the axes.
Fig 3.1: Gantry machine with two milling heads
The standard has defined that CNC machines can have up to 3 sets of
linear motions.
The first set is given the name of “the main axes” as its origin in the
nearest to the main spindle of the machine. Those are given the notation X,
Y and Z.
![Page 15: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/15.jpg)
15
The next to it is the set of the secondary axes. Those are given the
notation U, V and W.
The far set of axes from the main spindle is the auxiliary set. Those are
given the notation P, Q and R.
The axes in each set are parallel which mean that U and P are parallel to X ,
V and Q are parallel to Y and W, R are parallel to Z. But the standard has
indicated that no junior axis will be named in a machine except if its senior
is present. Applying this to the gantry machine, if head 2 is the main unit,
then head 1 is the nearest to it (secondary unit) and the cross rail with the
gantry is the auxiliary unit. It follows that head 2 will move in a lateral
and vertical directions, head 1 will move in a lateral and vertical directions,
the cross rail will move in lateral direction and the gantry will move along
the table.
Each of those direction must be defined as a name and sense of direction.
The standard defined the axis in the following sequence:-
• Axis Z must be defined first, and it is the axis of the main spindle
irrespective of being vertical or horizontal. If a machine has no
spindle (as in shaper), the Z axis is defined as the normal to the
machined surface when the machine is set at zero tilt.
• X axis is defined second and it must be horizontal. If the Z axis
happens to be horizontal, The second horizontal axis is the X axis. If
the Z axis happens to be vertical, the X axis is the horizontal with the
longer traverse.
• The Y axis is determined automatically after defining Z and X axes.
• The sense of the motion along the Z axis follows the safety rule
which states that if the tool is running away from the work holding
place the sense is positive and vice versa.
• The senses of the other two axes are defined using the thumb rule,
figure 3.2. Pointing at positive direction of Z axis results in positive
X and positive Y.
Linear motion Rotation
Fig 3.2: sense of motions
![Page 16: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/16.jpg)
16
As an application to the gantry machine, head 2 will has X, Y and Z as its
motion axes. But head 2 is allowed to move only in two di rections (Y and
Z). Thus axis X is not used with the main unit. Same directions are given to
head 1. Thus they will be given V and W, leaving U unused. The cross rail
is designed to move laterally, so it will be given R. The gantry is designed
to move in a direction along the table, so it should have been given P, but
as the notation of the senior axis is not used, so it will be given X. Thus if
an order is given Y3 Z-5 R9 then head 2 will move in the positive
direction 3 mm and down towards the workpiece 5 mm, while the cross rail
will move away from the workpiece surface 9 mm.
Rotational axes
The standard defined 5 rotations about five axes. A, B and C are rotations
about X, Y and Z axes respectively. The other two (E and F) are arbitrary.
They can be rotated about any other axis. The sense is as given in figure
3.2, when looking to the positive direction of the X axis and using the
right-hand rule, the rotation of “A” will be positive. The same is for
rotations B and C.
1. CNC Programming
The objective of this part is to understand how to program CNC machines. This
includes the following items.
a. What is the part program?
b. The format of CNC part program and its structure.
• Define the function of N codes.
• Define the function of G codes.
• Define the function of coordinate codes.
• Define the function of F and S codes.
• Define the function of T codes. data.
• Define the function of M codes.
c. Describe a toolpath.
What Is the Part Program?
A part program is an ordered sequence of commands that describes all the operations
performed by the machine. These commands use codes that combine numbers and
letters.
A part program is like computer software, with a very specific purpose.
Manufacturing of each workpiece requires its own part program. These programs are
then stored in the CNC machine or on computer disks.
![Page 17: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/17.jpg)
17
Steps followed to create a part program
1. The first step is to select the correct work holder.
2. The part programs
➢ Table of Contents
3. determine the location of the program zero, which acts as the starting point for the
program. Figure 3.3 compares the location of program zero on the mill and the
lathe.
4. From this starting point, the part programmer records the sequence of cutting
operations.
Fig 3.3 Common location for program zero on the lathe.
5. Finally, the programmer adds instructions for the machine
a. Common location for program zero on the mill.
b. Cutting speeds, tool changes, etc.
6. Checking the correctness of the part program through:
a. Dry run the program.
b. Preview the toolpath on the machine screen
![Page 18: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/18.jpg)
18
Program structure
Main program Subroutines
➢ Program Blocks and Addresses
A part program is nothing more than a long column of lines containing numbers and
letters. Each letter and number pairing acts as an instruction for the CNC.
A part program is made up of blocks. Figure 3.4 shows two blocks of a sample part
program. One block is equivalent to one line of the program. An actual part program
might contain hundreds of blocks. Within each block, there is a series of words. Each
word is the pairing of an address letter and a number.
The order of the words is very important. One after another, the words of a block tell
the machine what operation to perform, where to perform it, and how fast (or slow)
to perform it.
Fig 3.4: Part programs consist of blocks, words, address
/ P1200
O10…… *
….
…
…
O120 …..M99*.
/ P1210
O10…… *
….
…
…
O120 …..M99*.
N001 G02 … *
N005 X……… *
.
N90 P1200 M98 *
N95 G….
N150 Y….. *
N200 P1200 M98*
N205 G.. Z.. *
.
N300 P1210 M98*
N305 …. *
.
N500 … M30 *
![Page 19: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/19.jpg)
19
➢ Block Numbering
Every program block starts with an N code. The N code acts as the name or title of a
block, figure 3.5.
Fig 3.5: Block number
The purpose of these codes is to help the part programmer organize the program
blocks. A programmer can also find a block by searching for its N code number.
G Codes
In many program blocks, G codes follow the N codes. These
codes tell the computer what operation should be performed. Each
G code contains up to two numbers, and each number matches a
operation or command.
In Figure 1, the first G code, G00, tells the machine that it should rapidly position the
tool at a certain location. The second G code, G01, tells it to move the tool along a
linear path at a certain feed rate. In every shop, G00, G01, and other codes have the
same.
The following table summarizes the most general ones. function Meaning Format
G0 Rapid motion N... G00 X... S...
G1 Linear motion N... G01 X... Z... F... S... M...
G2 Clockwise arc N... G02 X... Z... R... F... S... M...
G3 Counterclockwise arc N... G03 X... Z... R... F... S... M...
G17 X-Y plane
G18 X-Z plane
G19 Y – Z plane
G40 Cancel compensation
G41 Inward compensation
G42 Outward compensation
G45 Length compensation
G53 Suppress Zero shift
G54 Zero offset N... G50 X... Y...
G70 Inch system Differs from M/C to another
G71 Metric system Differs from M/C to another
G80 Cancel fixed cycle
![Page 20: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/20.jpg)
20
G75 -
G79 and
G81 –
G89
Fixed cycles
G90 Absolute coordinate
G91 Relative coordinate
G93 Unit of feed is mm/rev Differs from M/C to another
G94 Feed is mm/min Differs from M/C to another
G95 Unit of speed is rpm Differs from M/C to another
G96 Speed in m/min Differs from M/C to another
Fanuc G-Code List (Lathe)
G code Description
G00 Rapid traverse
G01 Linear interpolation
G02 Circular interpolation CW
G03 Circular interpolation CCW
G04 Dwell
G09 Exact stop
G10 Programmable data input
G20 Input in inch
G21 Input in mm
G22 Stored stroke check function on
G23 Stored stroke check function off
G27 Reference position return check
G28 Return to reference position
G32 Thread cutting
G40 Tool nose radius compensation cancel
G41 Tool nose radius compensation left
G42 Tool nose radius compensation right
G70 Finish machining cycle
G71 Turning cycle
G72 Facing cycle
G73 Pattern repeating cycle
G74 Peck drilling cycle
G75 Grooving cycle
![Page 21: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/21.jpg)
21
G76 Threading cycle
G92 Coordinate system setting or max. spindle speed setting
G94 Feed Per Minute
G95 Feed Per Revolution
G96 Constant surface speed control
G97 Constant surface speed control cancels
Fanuc G-Code List (Mill)
G code Description
G00 Rapid traverse
G01 Linear interpolation
G02 Circular interpolation CW
G03 Circular interpolation CCW
G04 Dwell
G17 X Y plane selection
G18 Z X plane selection
G19 Y Z plane selection
G28 Return to reference position
G30 2nd, 3rd, and 4th reference position return
G40 Cutter compensations cancel
G41 Cutter compensation left
G42 Cutter compensation right
G43 Tool length compensation + direction
G44 Tool length compensation – direction
G49 Tool length compensation cancel
G53 Machine coordinate system selection
G54 Workpiece coordinate system 1 selection
G55 Workpiece coordinate system 2 selection
G56 Workpiece coordinate system 3 selection
G57 Workpiece coordinate system 4 selection
G58 Workpiece coordinate system 5 selection
G59 Workpiece coordinate system 6 selection
![Page 22: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/22.jpg)
22
G68 Coordinate rotation
G69 Coordinate rotations cancel
G73 Peck drilling cycle
G74 Left-spiral cutting circle
G76 Fine boring cycle
G80 Canned cycle cancels
G81 Drilling cycle, spot boring cycle
G82 Drilling cycle or counter boring cycle
G83 Peck drilling cycle
G84 Tapping cycle
G85 Boring cycle
G86 Boring cycle
G87 Back boring cycle
G88 Boring cycle
G89 Boring cycle
G90 Absolute command
G91 Increment command
G92 Setting for work coordinate system or clamp at maximum spindle speed
G98 Return to initial point in canned cycle
G99 Return to R point in canned cycle
![Page 23: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/23.jpg)
23
CNC G codes
G00 - Positioning at rapid speed; Mill and Lathe G01 - Linear interpolation (machining a straight line); Mill and Lathe G02 - Circular interpolation clockwise (machining arcs); Mill and Lathe G03 - Circular interpolation, counter clockwise; Mill and Lathe G04 - Mill and Lathe, Dwell G09 - Mill and Lathe, Exact stop G10 - Setting offsets in the program; Mill and Lathe G12 - Circular pocket milling, clockwise; Mill G13 - Circular pocket milling, counter clockwise; Mill G17 - X-Y plane for arc machining; Mill and Lathe with live tooling G18 - Z-X plane for arc machining; Mill and Lathe with live tooling G19 - Z-Y plane for arc machining; Mill and Lathe with live tooling G20 - Inch units; Mill and Lathe G21 - Metric units; Mill and Lathe G27 - Reference return check; Mill and Lathe G28 - Automatic return through reference point; Mill and Lathe G29 - Move to location through reference point; Mill and Lathe (slightly different for each machine) G31 - Skip function; Mill and Lathe G32 - Thread cutting; Lathe G33 - Thread cutting; Mill G40 - Cancel diameter offset; Mill. Cancel tool nose offset; Lathe G41 - Cutter compensation left; Mill. Tool nose radius compensation left; Lathe G42 - Cutter compensation right; Mill. Tool nose radius compensation right; Lathe G43 - Tool length compensation; Mill G44 - Tool length compensation cancel; Mill (sometimes G49) G50 - Set coordinate system and maximum RPM; Lathe G52 - Local coordinate system setting; Mill and Lathe G53 - Machine coordinate system setting; Mill and Lathe G54~G59 - Workpiece coordinate system settings #1 t0 #6; Mill and Lathe G61 - Exact stop check; Mill and Lathe G65 - Custom macro call; Mill and Lathe G70 - Finish cycle; Lathe G71 - Rough turning cycle; Lathe G72 - Rough facing cycle; Lathe G73 - Irregular rough turning cycle; Lathe G73 - Chip break drilling cycle; Mill G74 - Left hand tapping; Mill G74 - Face grooving or chip break drilling; Lathe G75 - OD groove pecking; Lathe G76 - Fine boring cycle; Mill G76 - Threading cycle; Lathe G80 - Cancel cycles; Mill and Lathe G81 - Drill cycle; Mill and Lathe G82 - Drill cycle with dwell; Mill G83 - Peck drilling cycle; Mill G84 - Tapping cycle; Mill and Lathe G85 - Bore in, bore out; Mill and Lathe G86 - Bore in, rapid out; Mill and Lathe G87 - Back boring cycle; Mill G90 - Absolute programming G91 - Incremental programming G92 - Reposition origin point; Mill G92 - Thread cutting cycle; Lathe G94 - Per minute feed; Mill G95 - Per revolution feed; Mill
![Page 24: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/24.jpg)
24
G96 - Constant surface speed control; Lathe G97 - Constant surface speed cancel G98 - Per minute feed; Lathe G99 - Per revolution feed; Lathe
CNC M Codes
M00 - Program stop; Mill and Lathe M01 - Optional program stop; Lathe and Mill M02 - Program end; Lathe and Mill M03 - Spindle on clockwise; Lathe and Mill M04 - Spindle on counter clockwise; Lathe and Mill M05 - Spindle off; Lathe and Mill M06 - Tool change; Mill M08 - Coolant on; Lathe and Mill M09 - Coolant off; Lathe and Mill M10 - Chuck or rotary table clamp; Lathe and Mill M11 - Chuck or rotary table clamp off; Lathe and Mill M19 - Orient spindle; Lathe and Mill M30 - Program end, return to start; Lathe and Mill M97 - Local sub-routine call; Lathe and Mill M98 - Sub-program call; Lathe and Mill M99 - End of sub program; Lathe and Mill
List of G-codes commonly found on FANUC and similarly designed controls for milling and turning[edit]
Code Description Milling
( M ) Turning
( T ) Corollary info
G00 Rapid positioning M T
On 2- or 3-axis moves, G00 (unlike G01) traditionally does not necessarily move in a single straight line between start point and end point. It moves each axis at its max speed until its vector quantity is achieved. Shorter vector usually finishes first (given similar axis speeds). This matters because it may yield a dogleg or hockey-stick motion, which the programmer needs to consider, depending on what obstacles are nearby, to avoid a crash. Some machines offer interpolated rapids as a feature for ease of programming (safe to assume a straight line).
G01 Linear interpolation M T
The most common workhorse code for feeding during a cut. The program specs the start and end points, and the control automatically calculates (interpolates) the intermediate points to pass through that yield a straight line (hence "linear"). The control then calculates the angular velocities at which to turn the axis leadscrews via their servomotors or stepper motors. The computer performs thousands of
![Page 25: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/25.jpg)
25
calculations per second, and the motors react quickly to each input. Thus the actual toolpath of the machining takes place with the given feed rate on a path that is accurately linear to within very small limits.
G02 Circular interpolation,
clockwise M T
Very similar in concept to G01. Again, the control interpolates intermediate points and commands the servo- or stepper motors to rotate the amount needed for the leadscrew to translate the motion to the correct tool tip positioning. This process repeated thousands of times per minute generates the desired toolpath. In the case of G02, the interpolation generates a circle rather than a line. As with G01, the actual toolpath of the machining takes place with the given feed rate on a path that accurately matches the ideal (in G02's case, a circle) to within very small limits. In fact, the interpolation is so precise (when all conditions are correct) that milling an interpolated circle can obviate operations such as drilling, and often even fine boring. Addresses for radius or arc center: G02 and G03 take either an R address (for the radius desired on the part) or IJK addresses (for the component vectors that define the vector from the arc start point to the arc center point). Cutter comp: On most controls you cannot start G41 or G42 in G02 or G03 modes. You must already have compensated in an earlier G01 block. Often, a short linear lead-in movement is programmed, merely to allow cutter compensation before the main action, the circle-cutting, begins. Full circles: When the arc start point and the arc end point are identical, the tool cuts a 360° arc (a full circle). (Some older controls do not support this because arcs cannot cross between quadrants of the cartesian system. Instead, they require four quarter-circle arcs programmed back-to-back.)
G03 Circular interpolation,
counterclockwise M T Same corollary info as for G02.
G04 Dwell M T
Takes an address for dwell period (may be X, U, or P). The dwell period is specified by a control parameter, typically set to milliseconds. Some machines can accept either X1.0 (s) or P1000 (ms), which are
![Page 26: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/26.jpg)
26
equivalent. Choosing dwell duration: Often the dwell needs only to last one or two full spindle rotations. This is typically much less than one second. Be aware when choosing a duration value that a long dwell is a waste of cycle time. In some situations it won't matter, but for high-volume repetitive production (over thousands of cycles), it is worth calculating that perhaps you only need 100 ms, and you can call it 200 to be safe, but 1000 is just a waste (too long).
G05 P10000 High-precision contour
control (HPCC) M
Uses a deep look-ahead buffer and simulation processing to provide better axis movement acceleration and deceleration during contour milling
G05.1 Q1. AI Advanced Preview
Control M
Uses a deep look-ahead buffer and simulation processing to provide better axis movement acceleration and deceleration during contour milling
G06.1 Non-uniform rational B-spline (NURBS)
Machining M
Activates Non-Uniform Rational B Spline for complex curve and waveform machining (this code is confirmed in Mazatrol 640M ISO Programming)
G07 Imaginary axis
designation M
G09 Exact stops check,
non-modal M T The modal version is G61.
G10 Programmable data
input M T
Modifies the value of work coordinate and tool offsets
G11 Data write cancel M T
G17 XY plane selection M
G18 ZX plane selection M T
G19 YZ plane selection M
G20 Programming in inches M T Somewhat uncommon except in USA and (to lesser extent) Canada and UK. However, in the global marketplace,
![Page 27: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/27.jpg)
27
competence with both G20 and G21 always stands some chance of being necessary at any time. The usual minimum increment in G20 is one ten-thousandth of an inch (0.0001"), which is a larger distance than the usual minimum increment in G21 (one thousandth of a millimeter, .001 mm, that is, one micrometer). This physical difference sometimes favors G21 programming.
G21 Programming
in millimeters (mm) M T
Prevalent worldwide. However, in the global marketplace, competence with both G20 and G21 always stands some chance of being necessary at any time.
G28
Return to home position (machine zero, aka machine reference
point)
M T
Takes X Y Z addresses which define the intermediate point that the tool tip will pass through on its way home to machine zero. They are in terms of part zero (aka program zero), NOT machine zero.
G30
Return to secondary home position (machine
zero, aka machine reference point)
M T
Takes a P address specifying which machine zero point to use if the machine has several secondary points (P1 to P4). Takes X Y Z addresses that define the intermediate point that the tool tip passes through on its way home to machine zero. These are expressed in terms of part zero (aka program zero), NOT machine zero.
G31 Feed until skip function M Used for probes and tool length measurement systems.
G32 Single-point threading, longhand style (if not
using a cycle, e.g., G76)
T
Similar to G01 linear interpolation, except with automatic spindle synchronization for single-point threading.
G33 Constant-pitch threading M
G33 Single-point threading, longhand style (if not
using a cycle, e.g., G76)
T Some lathe controls assign this mode to G33 rather than G32.
G34 Variable-pitch threading M
![Page 28: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/28.jpg)
28
G40 Tool radius
compensation off M T
Turn off cutter radius compensation (CRC). Cancels G41 or G42.
G41 Tool radius
compensation left M T
Turn on cutter radius compensation (CRC), left, for climb milling. Milling: Given righthand-helix cutter and M03 spindle direction, G41 corresponds to climb milling (down milling). Takes an address (D or H) that calls an offset register value for radius. Turning: Often needs no D or H address on lathes, because whatever tool is active automatically calls its geometry offsets with it. (Each turret station is bound to its geometry offset register.)
G41 and G42 for milling has been partially automated and obviated (although not completely) since CAM programming has become more common. CAM systems let the user program as if using a zero-diameter cutter. The fundamental concept of cutter radius compensation is still in play (i.e., that the surface produced will be distance R away from the cutter centre), but the programming mindset is different. The human does not choreograph the toolpath with conscious, painstaking attention to G41, G42, and G40, because the CAM software takes care of that. The software has various CRC mode selections, such as computer, control, wear, reverse wear, off, some of which do not use G41/G42 at all (good for roughing, or wide finish tolerances), and others that use it so that the wear offset can still be tweaked at the machine (better for tight finish tolerances).
G42 Tool radius
compensation right M T
Turn on cutter radius compensation (CRC), right, for conventional milling. Similar corollary info as for G41. Given righthand-helix cutter and M03 spindle direction, G42 corresponds to conventional milling (up milling).
G43 Tool height offset
compensation negative M
Takes an address, usually H, to call the tool length offset register value. The value is negative because it will be added to the gauge line position. G43 is the commonly used version (vs G44).
G44 Tool height offset
compensation positive M
Takes an address, usually H, to call the tool length offset register value. The value is positive because it will be subtracted from the gauge line position. G44 is the seldom-used version (vs G43).
![Page 29: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/29.jpg)
29
G45 Axis offset single
increase M
G46 Axis offset single
decrease M
G47 Axis offset double
increase M
G48 Axis offset double
decrease M
G49 Tool length offset
compensation cancel M Cancels G43 or G44.
G50 Define the maximum
spindle speed T
Takes an S address integer, which is interpreted as rpm. Without this feature, G96 mode (CSS) would rev the spindle to "wide open throttle" when closely approaching the axis of rotation.
G50 Scaling function cancel M
G50 Position register
(programming of vector from part zero to tool tip)
T
Position register is one of the original methods to relate the part (program) coordinate system to the tool position, which indirectly relates it to the machine coordinate system, the only position the control really "knows". Not commonly programmed anymore because G54 to G59 (WCSs) are a better, newer method. Called via G50 for turning, G92 for milling. Those G addresses also have alternate meanings (which see). Position register can still be useful for datum shift programming. The "manual absolute" switch, which has very few useful applications in WCS contexts, was more useful in position register contexts, because it allowed the operator to move the tool to a certain distance from the part (for example, by touching off a 2.0000" gage) and then declare to the control what the distance-to-go shall be (2.0000).
G52 Local coordinate system
(LCS) M
Temporarily shifts program zero to a new location. It is simply "an offset from an offset", that is, an additional offset added onto the WCS offset. This simplifies programming in some cases. The typical example is moving from part to part in a multipart setup. With G54 active, G52 X140.0 Y170.0 shifts program zero 140 mm over in X and 170 mm over in Y. When the part "over there" is done, G52 X0 Y0 returns program zero to normal G54 (by reducing G52 offset to nothing). The same result can also be achieved (1) using multiple WCS origins, G54/G55/G56/G57/G58/G59; (2) on newer controls, G54.1 P1/P2/P3/etc. (all the way up to P48); or (3) using G10 for programmable data input, in which the program can write new offset values to the offset registers.[8] The method to use
![Page 30: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/30.jpg)
30
depends on shop-specific application.
G53 Machine coordinate
system
M T
Takes absolute coordinates (X,Y,Z,A,B,C) with reference to machine zero rather than program zero. Can be helpful for tool changes. Nonmodal and absolute only. Subsequent blocks are interpreted as "back to G54" even if it is not explicitly programmed.
G54 to G59 Work coordinate systems (WCSs)
M T
Have largely replaced position register (G50 and G92). Each tuple of axis offsets relates program zero directly to machine zero. Standard is 6 tuples (G54 to G59), with optional extensibility to 48 more via G54.1 P1 to P48.
G54.1 P1 to P48
Extended work coordinate systems
M T
Up to 48 more WCSs besides the 6 provided as standard by G54 to G59. Note floating-point extension of G-code data type (formerly all integers). Other examples have also evolved (e.g., G84.2). Modern controls have the hardware to handle it.
G61 Exact stop check, modal M T Can be canceled with G64. The non-modal version is G09.
G62 Automatic corner
override M T
G64 Default cutting mode
(cancel exact stop check mode)
M T Cancels G61.
G68 Rotate coordinate
system M
Rotates coordinate system in the current plane given with G17, G18, or G19. Center of rotation is given with two parameters, which vary with each vendor's implementation. Rotate with angle given with argument R. This can be used, for instance, to align the coordinate system with a misaligned part. It can also be used to repeat movement sequences around a center. Not all vendors support coordinate system rotation.
G69 Turn off coordinate
system rotation M Cancels G68.
G70
Fixed cycle, multiple repetitive cycle, for finishing (including
contours)
T
G71
Fixed cycle, multiple repetitive cycle, for
roughing (Z-axis emphasis)
T
G72
Fixed cycle, multiple repetitive cycle, for roughing (X-axis
emphasis)
T
G73
Fixed cycle, multiple repetitive cycle, for
roughing, with pattern repetition
T
![Page 31: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/31.jpg)
31
G73
Peck drilling cycle for milling – high-speed (NO
full retraction from pecks)
M
Retracts only as far as a clearance increment (system parameter). For when chip breaking is the main concern, but chip clogging of flutes is not. Compare G83.
G74 Peck drilling cycle for
turning T
G74
Tapping cycle for milling, lefthand
thread, M04 spindle direction
M See notes at G84.
G75 Peck grooving cycle for
turning T
G76 Fine boring cycle for
milling M
Includes OSS and shift (oriented spindle stop and shift tool off centerline for retraction)
G76 Threading cycle for
turning, multiple repetitive cycle
T
G80 Cancel canned cycle M T
Milling: Cancels all cycles such as G73, G81, G83, etc. Z-axis returns either to Z-initial level or R level, as programmed (G98 or G99, respectively). Turning: Usually not needed on lathes, because a new group-1 G address (G00 to G03) cancels whatever cycle was active.
G81 Simple drilling cycle M No dwell built in
G82 Drilling cycle with dwell M
Dwells at hole bottom (Z-depth) for the number of milliseconds specified by the P address. Good for when hole bottom finish matters. Good for spot drilling because the divot is certain to clean up evenly. Consider the "choosing dwell duration" note at G04.
G83 Peck drilling cycle (full retraction from pecks)
M Returns to R-level after each peck. Good for clearing flutes of chips. Compare G73.
G84 Tapping cycle, righthand
thread, M03 spindle direction
M
G74 and G84 are the righthand and left hand "pair" for old-school tapping with a non-rigid toolholder ("tapping head" style). Compare the rigid tapping "pair", G84.2 and G84.3.
G84.2 Tapping cycle, righthand
thread, M03 spindle direction, rigid toolholder
M
See notes at G84. Rigid tapping synchronizes speed and feed according to the desired thread helix. That is, it synchronizes degrees of spindle rotation with microns of axial travel. Therefore, it can use a rigid toolholder to hold the tap. This feature is not available on old machines or newer low-end machines, which must use "tapping head" motion (G74/G84).
G84.3
Tapping cycle, lefthand
thread, M04 spindle direction, rigid toolholder
M
See notes at G84 and G84.2.
![Page 32: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/32.jpg)
32
G85 boring cycle, feed
in/feed out M
• Good cycle for a reamer.
• In some cases good for single-point boring tool, although in other cases the lack of depth of cut on the way back out is bad for surface finish, in which case, G76 (OSS/shift) can be used instead.
• If need dwell at hole bottom, see G89.
G86 boring cycle, feed
in/spindle stop/rapid out M
Boring tool leaves a slight score mark on the way back out. Appropriate cycle for some applications; for others, G76 (OSS/shift) can be used instead.
G87 boring cycle, backboring M
For backboring. Returns to initial level only (G98); this cycle cannot use G99 because its R level is on the far side of the part, away from the spindle headstock.
G88 boring cycle, feed
in/spindle stop/manual operation
M
G89 boring cycle, feed in/dwell/feed out
M G89 is like G85 but with dwell added at bottom of hole.
G90 Absolute programming M T (B)
Positioning defined with reference to part zero. Milling: Always as above. Turning: Sometimes as above (Fanuc group type B and similarly designed), but on most lathes (Fanuc group type A and similarly designed), G90/G91 are not used for absolute/incremental modes. Instead, U and W are the incremental addresses and X and Z are the absolute addresses. On these lathes, G90 is instead a fixed cycle address for roughing.
G90 Fixed cycle, simple cycle, for roughing (Z-axis emphasis)
T (A) When not serving for absolute programming (above)
G91 Incremental
programming M T (B)
Positioning defined with reference to previous position. Milling: Always as above. Turning: Sometimes as above (Fanuc group type B and similarly designed), but on most lathes (Fanuc group type A and similarly designed), G90/G91 are not used for absolute/incremental modes. Instead, U and W are the incremental addresses and X and Z are the absolute addresses. On these lathes, G90 is a fixed cycle address for roughing.
G92 Position register
(programming of vector from part zero to tool tip)
M T (B)
Same corollary info as at G50 position register. Milling: Always as above. Turning: Sometimes as above (Fanuc
![Page 33: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/33.jpg)
33
group type B and similarly designed), but on most lathes (Fanuc group type A and similarly designed), position register is G50.
G92 Threading cycle, simple
cycle T (A)
G94 Feedrate per minute M T (B) On group type A lathes, feedrate per minute is G98.
G94 Fixed cycle, simple cycle, for roughing (X-axis emphasis)
T (A) When not serving for feedrate per minute (above)
G95 Feedrate per revolution M T (B) On group type A lathes, feedrate per revolution is G99.
G96 Constant surface speed
(CSS) T
Varies spindle speed automatically to achieve a constant surface speed. See speeds and feeds. Takes an S address integer, which is interpreted as sfm in G20 mode or as m/min in G21 mode.
G97 Constant spindle speed M T
Takes an S address integer, which is interpreted as rev/min (rpm). The default speed mode per system parameter if no mode is programmed.
G98 Return to initial Z level in
canned cycle M
G98 Feedrate per minute
(group type A) T (A)
Feedrate per minute is G94 on group type B.
G99 Return to R level in
canned cycle M
G99 Feedrate per revolution
(group type A) T (A)
Feedrate per revolution is G95 on group type B.
G100 Tool length
measurement M
List of M-codes commonly found on FANUC and similarly designed controls for
milling and turning[edit]
Some older controls require M codes to be in separate blocks (that is, not on the
same line).
Code Description Milling
( M )
Turning
( T ) Corollary info
M00 Compulsory stop M T
Non-optional machine always
stops on reaching M00 in the
program execution.
M01 Optional stop M T Machine only stops at M01 if
operator pushes the optional
![Page 34: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/34.jpg)
34
stop button.
M02 End of program M T
Program ends; execution may
or may not return to program
top (depending on the
control); may or may not reset
register values. M02 was the
original program-end code,
now considered obsolete, but
still supported for backward
compatibility. Many modern
controls treat M02 as
equivalent
to M30. See M30 for
additional discussion of
control status upon executing
M02 or M30.
M03
Spindle on
(clockwise
rotation)
M T
The speed of the spindle is
determined by the address S,
in either revolutions per
minute (G97 mode; default)
or surface feet per minute or
[surface] meters per minute
(G96 mode [CSS] under
either G20 or G21).
The right-hand rule can be
used to determine which
direction is clockwise and
which direction is
counterclockwise.
Right-hand-helix screws
moving in the tightening
direction (and
right-hand-helix flutes
spinning in the cutting
direction) are defined as
moving in the M03 direction
and are labelled "clockwise"
by convention. The M03
direction is always M03
regardless of local vantage
point and local CW/CCW
distinction.
![Page 35: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/35.jpg)
35
M04
Spindle on
(counterclockwise
rotation)
M T See comment above at M03.
M05 Spindle stop M T
M06 Automatic tool
change (ATC) M
T
(some-times)
Many lathes do not use M06
because the T address itself
indexes the turret.
Programming on any machine
tool requires knowing which
method that machine uses. To
understand how the T address
works and how it interacts (or
not) with M06, one must study
the various methods, such as
lathe turret programming,
ATC fixed tool selection,
ATC random memory tool
selection.
M07 Coolant on (mist) M T
M08 Coolant on (flood) M T
M09 Coolant off M T
M10 Pallet clamp on M For machining centers with
pallet changers
M11 Pallet clamp off M For machining centers with
pallet changers
M13
Spindle on
(clockwise
rotation) and
coolant on (flood)
M
This one M-code does the
work of both M03 and M08. It
is not unusual for specific
machine models to have such
combined commands, which
make for shorter, more
quickly written programs.
M19 Spindle
orientation M T
Spindle orientation is more
often called within cycles
(automatically) or during
setup (manually), but it is also
available under program
control via M19. The
abbreviation OSS (oriented
spindle stop) may be seen in
reference to an oriented stop
within cycles.
The relevance of spindle
orientation has increased as
![Page 36: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/36.jpg)
36
technology has advanced.
Although 4- and 5-axis
contour milling and
CNC single-pointing have
depended on spindle position
encoders for decades, before
the advent of widespread live
tooling and mill-turn/turn-mill
systems, it was not as often
relevant in "regular"
(non-"special") machining for
the operator (as opposed to the
machine) to know the angular
orientation of a spindle as it is
today, except in certain
contexts (such as tool change,
or G76 fine boring cycles with
choreographed tool
retraction). Most milling of
features indexed around a
turned workpiece was
accomplished with separate
operations on indexing
head setups; in a sense,
indexing heads were
originally invented as separate
pieces of equipment, to be
used in separate operations,
which could provide precise
spindle orientation in a world
where it otherwise mostly
didn't exist (and didn't need
to). But as CAD/CAM and
multiaccess CNC machining
with multiple rotary-cutter
axes becomes the norm, even
for "regular" (non-"special")
applications, machinists now
frequently care about stepping
just about any spindle through
its 360° with precision.
M21 Mirror, X-axis M
M21 Tailstock forward T
M22 Mirror, Y-axis M
M22 Tailstock
backward T
![Page 37: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/37.jpg)
37
M23 Mirror OFF M
M23 Thread gradual
pullout ON T
M24 Thread gradual
pullout OFF T
M30
End of program,
with return to
program top
M T
Today, M30 is considered the
standard program-end code,
and returns execution to the
top of the program. Most
controls also still support the
original program-end
code, M02, usually by treating
it as equivalent to
M30. Additional
info: Compare M02 with
M30. First, M02 was created,
in the days when the punched
tape was expected to be short
enough to splice into a
continuous loop (which is why
on old controls, M02 triggered
no tape rewinding).[10] The
other program-end code, M30,
was added later to
accommodate longer punched
tapes, which were wound on
a reel and thus needed
rewinding before another
cycle could start.[10] On many
newer controls, there is no
longer a difference in how the
codes are executed—both act
like M30.
M41 Gear selects –
gear 1 T
M42 Gear selects –
gear 2 T
M43 Gear selects –
gear 3 T
M44 Gear selects –
gear 4 T
M48 Feedrate override
allowed M T
MFO (manual feedrate
override)
M49 Feedrate override
NOT allowed M T
Prevent MFO (manual
feedrate override). This rule is
![Page 38: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/38.jpg)
38
also usually called
(automatically) within tapping
cycles or single-point
threading cycles, where feed
is precisely correlated to
speed. Same
with SSO (spindle speed
override) and feed hold
button. Some controls can
provide SSO and MFO during
threading.
M52 Unload Last tool
from spindle M T Also empty spindle.
M60 Automatic pallet
change (APC) M For machining centers with
pallet changers
M98 Subprogram call M T
Takes an address P to specify
which subprogram to call, for
example, "M98 P8979" calls
subprogram O8979.
M99 Subprogram end M T
Usually placed at end of
subprogram, where it returns
execution control to the main
program. The default is that
control returns to the block
following the M98 call in the
main program. Return to a
different block number can be
specified by a P address. M99
can also be used in main
program with block skip for
endless loop of main program
on bar work on lathes (until
operator toggles block skip).
![Page 39: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/39.jpg)
39
➢ X, Y, and Z Codes - U, V and W codes - P, Q and R codes
After the G code, the X code, Y code, and Z code tell the machine
where to go. Referring to Figure 3.6, the cutting tool would rapidly position itself at
the location marked X3.0, Y-2.5, Z-1.0 first. Then, move along a straight line until it
reached the X12.0, Y2.0 location. The Z-axis location remains the same.
Fig 3.6: X, Y & Z
➢ F and S Codes
F code and S code tell the machine "how fast to do it." These codes are
used to set the feed and speed for the machine as it
performs a cutting operation that in figure 3.7 and figure 3.8.
Fig 3.7. Feed and speed on the mill. Fig 3.8. Feed and speed on the lathe.
In the program blocks shown in Figure 3.9, the first block does not contain F or S
codes. The rapid positioning of the tool does not require a specific speed or feed.
However, once the cutting tool begins to contact the workpiece in the second block,
F and S codes are needed to set the feed and speed rates.
![Page 40: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/40.jpg)
40
Fig 3.9: F and S codes
➢ T and M Codes
The last spaces in a program block are reserved for T codes and M codes. T codes tell
the computer to choose a specific tool, and M codes might tell the computer a
miscellaneous command in figure 3.10.
Fig 10: T and M
The following table summarizes the most general ones.
Function Meaning Remarks
M0 Compulsory stop Program stops
M1 Optional stop M2 End of program
M3 Clockwise rotation CW rotation of the spindle
M4 Counter clock. Rotation CCW rotation of the spindle M5 Stop spindle
M6 Change tool M7 Run coolant
M9 Stop coolant
M20 cancel mirror image Differs from M/C to another M21 mirror image around X-axis Differs from M/C to another
M22 mirror image around Y-axis Differs from M/C to another
M24 mirror image around X and Y – axes Differs from M/C to another M30 End of program-rewind Differs from M/C to another
M98 Call subroutine Differs from M/C to another M99 End subroutine Differs from M/C to another
![Page 41: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/41.jpg)
41
Exercise 1: write the part program for manufacturing the part in fig 1. The material is a
block 87 x 68 x 10 mm made of St 50. The feed used is 50 mm / min, the rotational
speed is 300 rpm, the depth of cut not to exceed 5 mm and the tool is 12 mm end mill
fitted in turret face no 2, with its tip adjusted at z = 0
Steps:
1. Fix the zero datum of the part. Assume
2. Determine the direction of motion. Assume anti-clock wise
3. Determine the corresponding points at which the equation of the curve changes
4. Decide upon the type of motion between each two corresponding points
5. Write the part program. It consists of 4 sections:
a. Identifying blocks b. Preparatory blocks
c. Main motion blocks d. End block
/ Part no 1 – Base plate Part Program name
N005F50 S300 M3 runs the spindle 300 rpm clockwise & be
ready
to move with feed rate 50 mm/min
30.25
15.13
20.11 60.00
15R
25R
23.01 42.1
20.38
X axis
X axis
Y axis
Z axis 40
10 60
Machine surface
![Page 42: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/42.jpg)
42
N010 G0 Z0 Go with fast traverse to level Z = 0
N015 X0 Y0 T2 M6 Go with fast traverse to the location X = 0 &
Y = 0, then change to tool no. 2
N020 Z-39 move the head fast towards the table to level
Z = -39 mm
N025 G1 Z-53 M7 Runs the coolant, then move the head with
feed
50 mm/min towards the table to level Z
= -53 mm
N030 X38.01 Move on a straight line with the same feed to
location X = 38.01 mm
N035 X80.11 Y20.38 Move on a straight line with the same feed to
location X = 38.01 & Y = 20.38 mm
N040 Y35.38 Move on a straight line with the same feed to
location Y = 35.38 mm
N045 G3 X55.11 Y60.38 R25 F20 Move on a counter-clock arc with
feed
20 mm/min to location X = 55.11 & Y
= 60.38
With a radius R = 25
N050 G1 X20.11 F50 Move on a straight line with feed
= 50 mm/min
To location X = 20.11 mm
N055 X0 Y30.13 Move on a straight line with the same feed to
location X = 0 & Y = 30.13 mm
N060 Y15 Move on a straight line to location
Y = 15 mm
N065 G2 X15 Y0 R15 F20 Move on a clockwise arc with feed
20 mm/min to location X = 15 & Y = 0 with
a radius R = 15
N070 G1 Z-39 F50 M9 Move the head up to level Z = -39 mm with a
Feed rate F = 50 mm/min, then stop the
coolant
N075 G0 Z0 Go with fast traverse to level Z = 0
N080 X0 Y0 M5 Go with fast traverse to the location X = 0 &
Y = 0, then stop spindle
N085 M30 End of program
![Page 43: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/43.jpg)
43
Lecture Note 4: Offsetting the cutter left or right
➢ Introduction
• Two different G-Codes to apply cutter compensation depending on the direction
of the cut.
• When the material is to the left of the cutter, we use G41 and when it is to the
right, we use G42.
• G40 is used to turn it off.
• Ways to apply cutter compensation
➢ There are three different ways that cutter compensation.
• G42 P5.0; By using a 'P' value, the machine will offset the cutter by a defined
amount (5mm). This technique is usually used on small CNC machines without
a built-in tool table
• G42 X5.0; By using an 'X' value, it means the same thing.
• G42; On machines with a built-in tool table within their control system, cutter
compensation is just applied using a simple G42 (or G41) command
Larger industrial machinery normally uses this style of defining the radius of the tool
as the tooling information is entered into the tool table during the setup of the machine.
During the tool call line of our program, the machine pulls all the tooling information
into its memory and G42 is used to let the machine know that we wish to use cutter
compensation. No other information is needed.
Example 1
![Page 44: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/44.jpg)
44
G41 G40 Cutter Radius Compensation Example
N5 G00 G54 G64 G90 G17 X20 Y-20 Z50
N10 S450 M03 F250 D01 (12.5 MM DIA)
N20 Z5
N25 G01 Z0
N30 Z-5
N35 G41 X0 Y0
N40 X-48
N45 X-68 Y72
N50 X-28
N55 Y44
N60 X12 Y32
N65 X0 Y0
N70 G40 X20 Y-20
N75 G00 Z50
N80 Y100
N85 M30
Finished Part
After machining process completion, component will look like
Cutter Radius Compensation Example Finished Part
Explanation of CNC G-Code
G00 : Rapid traverse.
G54 : Zero Offset no. 1.
G90 : Absolute dimensioning system.
G17 : X-Y plan selection.
G41 : Cutter radius compensation activation (left hand side movement)
G40 : Cutter radius compensation de-active
S : Spindle speed
F : Axis motion feed
M : Cutter rotation (3=clockwise, 4=anti-clockwise)
D : Tool offset no
![Page 45: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/45.jpg)
45
Lecture Note 5: Cycles
➢ CNC Milling Cycles
CNC milling machine provided with machining software program in ready form by the
manufacturer. These are called machining cycles.
• Drilling Cycle. To drill the hole shown, the part program requires at least 5
blocks in figure 5.1:
Fig 5.1: Drilling Cycle
N10 G71 G94 G90 * Metric mode feed rate in mm/min and absolute
coordinate system
N20 G00 X10.00 Y 15.00 * Position the drilling tool at X = 10.00 and
Y= 15.00
N30 G00 Z-10.00 * Drill moves to approach (reference) plane in rapid
traverse.
N40 G01 Z-50.00 S800 F150 M03 * The spindle starts rotating at 800 rpm in
clockwise direction and the hole are
drilled at feed rate of 150 mm/minute.
N50 Z0 * Drill returns to reference plane
Fixed cycle for drilling a hole is applicable in figure 5.2 , where the complete drilling is
completed by giving information in a single block.
N10 G71 G94 G90 *
N20 G81 X10.00 Y15.00 Z-10 Z-50 S800 F150 M03 *
Hence the Format for drilling cycle is
N… G81 X… Y… Z… Z… S… F… M… *
![Page 46: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/46.jpg)
46
Fig 5.2: Fixed cycle for drilling
• Deep Hole Drilling Cycle (Peck Drilling Cycle). When the depth of hole is
more (l/d > 10) in figure 5.3, it is desirable to withdraw the drill from the hole at
regular intervals to avoid clogging due to chips in figure 5.4. Consider the work
piece shown in fig. The typical format for using deep hole drilling cycle is given
below:
Fig 5.3: Deep Hole Drilling Cycle
![Page 47: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/47.jpg)
47
Fig 5.4: Deep Hole Drilling Cycle chips
N10 G71 G94 G91 M03 S 1000 *
N20 G83 X 10.00 Y 10.00 R-10.00 Z-90.00 Q25.00 F100 *
• Threading cycle (tapping)
The tapping operation, involves positioning of tap at required X and Y position,
moving it rapidly to reference plane and feeding into the predrilled hole in the work
piece at given feed rate. In figure 5.5 The spindle rotation is then reversed, and the tap
is brought back to reference plane in figure 5.6 at the programmed feed rate. The
spindle rotation is again reversed to prepare for next tapping operation.
![Page 48: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/48.jpg)
48
Fig 5.5: Threading cycle (tapping)
Fig 5.6: reference plane
N001 G71 G91 M03 S 500 *
N004 G84 X10.00 Y10.00 R-10.00 Z-35.00 F60 *
![Page 49: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/49.jpg)
49
Boring Cycle. In the boring cycle the boring tool is fed to the required depth at the
given feed rate in figure 5.7. When the tool has reached the required depth, the
rotation of the tool is stopped, and the tool is withdrawn at a rapid feed rate up to the
reference plane.
Fig 5.7: Boring Cycle
• Face Milling canned cycle
In face milling cycle in figure 5.8:
• the cutter is moved in X and Y rapidly till located at the start point (Xs,Ys)
• The cutter is moved rapidly in Z till the approach plane
• The cutter is moved with the feed rate in Z till the required depth
• The cutter, then, moves with the feed rate in X and Y in a zigzag shape, fig till
it reaches the end point (Xe,Ye)
![Page 50: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/50.jpg)
50
• The cutter retracts rapidly the approach (initial) level or to the initial level
depending on the format of the cycle.
Fig 5.8 : Face milling
The Format is:
G77 Xs… X… Ys… Yi… Y… F…
Where:
• X and Y are the incremental distance to be milled along the X and Y axes
• Yi is the incremental step along Y axis
➢ Rectangular Pocket milling cycle
Figure 5.9. shows a rectangular pocket being milled.
Fig 5.9: rectangular pocket
Approach level
Initial
level
![Page 51: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/51.jpg)
51
The Format for roughing with a step in X is:
G78 X1… Y1… Z1… Z2… X2… X3… Y3… F…
The Format for roughing with a step in Y is:
G78 X1… Y1… Z1… Z2… Y2… X3… Y3… F…
The Format for finishing with a step in X is:
G79 X1… Y1… Z1… Z2… X2… X3… Y3… X4 F…
In this cycle the cutter after completing the roughing motion as in G78, it proceeds to
cut inside the peripheral the finishing depth (X4)
➢ Turning Cycles
• Straight Rough turning cycle
Fig 5.10: Straight rough turning cycle
The tool is positioned at the start point. It moves rapidly to the require diameter (X)
along the path “1”. In figure 5.10 It turns with the feed rate to the required length (Z)
along path “2”. It faces the shoulder to the initial diameter through path “3”. It retracts
rapidly to the initial position though path “4”. The Format is:
G77 X… Z… F…
![Page 52: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/52.jpg)
52
If it is a taper rough turning and the incremental movement of the tool along X is “I…”,
where I = , then the format is:
G77 X… Z… I… F…
• Facing Cycle
It is like straight rough turning with the movement illustrated in figure 5.11. Its format
is: G79 X… Z… F…
Fig 5.11: Facing cycle
• Threading cycle
Both straight and taper threads can be cut using the thread canned cycle, figure 5.12.
Fig 5.12: thread canned cycle
![Page 53: Lectures Notes of Computer Aided Manufacturing](https://reader031.vdocument.in/reader031/viewer/2022020623/61f26348dcf37f03a546834b/html5/thumbnails/53.jpg)
53
The threading tool is positioned at the start point. The format is:
G78 X… Z… F…
Where F is the lead of the screw.
If it is a taper thread and the incremental movement of the tool along X is “I…”, then
the format is:
G78 X… Z… I… F…
• Rough and finish Profile turning cycles
Nowadays turning canned cycles are capable to perform multiple repetitive cycles,
which are more powerful canned cycles that automatically determine the number of
tools passes necessary to machine a part. Multiple repetitive cycles can machine most
combinations of tapers, chamfers, and contours. Examples of the profile turning are
shown in figure 5.13 and 5.14. The formats of those cycles will not be given, here, as
they differ completely from a control to another.
Fig 5.13: Rough profile turning cycle Fig 5.14: Profile facing cycle