Download as pdf or txt
Download as pdf or txt
You are on page 1of 106

Defining Computer Aided Design (CAD)

Computer Aided Design (CAD) is the modeling of physical

objects on computers , allowing both interactive and automatic

analysis of design, and the expression of design in a form suitable

for manufacturing.
Examples of CAD Software

SolidWorks SolidEdge

Inventor Iron CAD

Defining Computer Aided Manufacturing


(CAM)
➢ Is an application technology that uses computer software and

machinery to automate manufacturing processes.

➢ Commonly refers to the use of numerical control (NC)


computer software applications to create detailed instructions
(G-code) that drive computer numerical control (CNC)
machine tools for manufacturing parts.
Examples of CAM Software

CAMWorks EdgeCAM

PowerMILL FeatureCAM

• CAD/CAM = Computer Aided Design and


Computer Aided Manufacturing. It is the
technology concerned with the use of computers
to perform design and manufacturing functions.
Examples of CAD/CAM Software

AlphaCAM Mastercam

• …….etc

• The Role of CAM In The Product Cycle

Product Engineering Working


Concept (2) Design (3) Drawing (4)

Customers
& Process
Markets Planning (5)
(1)

Quality Control Manufacturing Production


(8) Processes (7) Scheduling (6)

CAM
What is Manufacturing?

The Process Of Converting Raw Materials, Or Parts Into


Finished Goods That Meet A Customer's Expectations Or
Specifications.

Input Manufacturing Output


Raw Materials process Product
A. Joining Process Welding
Manufacturing Process

From Liquid
B. Same Material
ex:( Casting)

C. Subtract Material Machining

D. Additive Manufacturing

C. Subtractive Process

Machining
In Machining, A Manufactured Part Is Created To Its
Desired Geometric Dimensions By The Removal Of Excess
Material From A Work Piece, Via A Force Exerted Through
A Certain Material Removal Tool.
Turning Milling

Drilling Shaping

Types of
Milling Machines

Horizontal Vertical
milling machine milling machine
MILLING MACHINE

Types of Cutting Tools on the


Vertical Milling Machine

End Mill
Cutting Tool
Holders

Workpiece clamping on milling machines


1- Bolting to the machine table
Workpiece clamping on milling machines
2- Using Vises: which is mounted on the machine table

Plain Vise SwivelVise

Universal Vise

Milling Operations

Pocket milling

Profile milling
Milling
Parameters
S: Spindle Speed (RPM)

a: Depth of Cut (mm)

F: Feed Rate (mm/min)

• Drilling

Drilling Operations
Drilling Operations:
1- Drilling:
A drill bit enters the workpiece axially and cuts a
blind hole or a through hole with a diameter
equal to the tool diameter.

Twist Drill

III- Drilling tools (bits):


B. Twist drill geometry:
III- Drilling tools (bits):

1- The body: consisting of multi spiral grooves


(flutes).

2- The shank: a straight or tapered section where the


drill is clamped

III- Drilling tools (bits):


➢ 3- Cutting angles:
b) The Point angle

It is the angle between the cutting edges. It is generally 118 degree. Its
value depends upon the hardness of the work piece to be drilled. For
harder material, larger angles are used.
VI- Drilling Operations:
2- Reaming:
A reamer is a multi-point tool that has
many flutes, which may be straight or
in a helix.
•A reamer enters the workpiece
axially and enlarges an existing hole to
the diameter of the tool.
•Reaming removes a minimal amount of
material and is often performed after
drilling to obtain
- Accurate diameter.
- A smooth internal finish.

VI- Drilling Operations:


3- Tapping:
• A tap enters the workpiece axially and cuts internal
threads into a predrilled hole.
• The tap is selected based on the major diameter
and pitch of the threaded hole.
VI- Drilling Operations:
4- Boring:
• A boring tool enters the workpiece
axially and cuts along the internal surface
of an existing hole to enlarge the
diameter or obtain more precise
dimensions.
• The boring tool is a single-point cutting
tool, which can be set to cut the desired
diameter by using an adjustable boring head.

VI- Drilling Operations:


5- Counter-boring:
• A counter-bore tool enters the workpiece
axially and enlarges the top portion of an
existing hole to the diameter of the tool
(cylindrically – shaped) .
• It is performed to provide space for the head
of a fastener, such as a bolt, to sit flush with
the workpiece surface.
• The counter-boring tool has a pilot on the end
to guide it straight into the existing hole.
VI- Drilling Operations:
6- Counter-sinking:
• A countersink tool enters the workpiece
axially and enlarges the top portion of an
existing hole to a cone-shaped opening.
• Countersinking is often performed after
drilling to provide space for the head of a
fastener, such as conical head screws, to sit
flush with the workpiece surface.
• The common angles for countersink are
60, 82, 90, 100, 118, and 120 degrees.
• Historical background

NC is based on the work of man named John T. Parsons in


1940. he developed a method of using punched card
containing coordinate position data to control a machine tool.

In 1948 he demonstrated his concept to US air force, which


sponsored researches at servomechanisms Lab at MIT
(Massachusetts institute of technology).

The first demonstration of NC concept was proven

What is numerical control

• Definition of Numerical Control NC


NC is the term used to describe the control of machine
movements and various other functions by instructions
expressed as a series of numbers and initiated via an
electronic control system.

Computerized Numerical Control CNC is the term used


when the control system includes a computer.

NC also defined as: form of programmable automation in


which the process is controlled by numbers, litters , and
symbols.
Part selection for NC Machine
• Parts with substantial tooling cost
• Parts with lengthy setup time on conv.
machine
• Parts in small or variable lots
• Parts in wide diversity
• Parts in complex configuration (accurate)
• Parts with mathematical complex contours
• Parts at very expensive prices
• Parts of high priority
• Parts of mirror-image copies

Planning for use NC

• Basic knowledge of how NC works


• General knowledge about machine
tool and control unit

• Best measure is to attend NC training


programs offered by NC vendors, and
suppliers
• Capital Investment
• Substantial initial cost as compared with
conventional (500,000-10,000,000) L.E.
• Machine should be scheduled to pay itself

• Personnel and training

• Selecting the qualified and skilled


personnel to cope with such
technology

• Programming and tooling


• Tooling is related to the programming (choosing
size and shape of cutting tools)
• Maintenance and Repair
• Based on education offered by controller
vendor
• Maintenance and operation of NC equipment
must be restricted to trained and competent
personnel
• Cost analysis

• Rather than the cost analysis of conventional


machining operation
• Programming cost
• Tape or media preparation cost
• Note the lead time on NC is shorter than
conventional

• Quality control
• The adverse effect of operator skill, fatigue and
human reliability have been reduced to minimum
• More complex parts can be produced at high level
of accuracy as well as quality
• Service responsibility

• Define problem origination either from machine


tool or control unit
• Best practice recommends purchasing the control
unit and machine tool from the same vendor
• Environmental requirement

• Special attention should be paid to the cleanness


and possibility for air conditioning

Advantages of NC

• High rates of productivity


• Uniformity of the products
• Reduce components rejection
• Human Less operation involvements
• Complex shapes machined easily
CNC Milling Machine

Basic Components of NC system

1. Program of instructions
2. Machine Control Unit (MCU)
3. Machine tool (turn, mill, machine
center)
1. Program of instructions

• Is the step by step set of direction


which tell the machine tool what to do.
• These commands are encoded in
numerical and symbolic form

• The data can be transmitted using many


kinds of transmitting medias:
• Punched tape
• Magnetic tape
• Floppy disk
• Direct to computer
1.2. Magnetic tape

Magnetic tape
• The main advantages :
1. Easier for handling.
2. Rapidly produced and read.
3. Programs can be erased and tape reused.
4. More durable than paper (in perforated
tape)
5. More storage space than perforated tape
• The main disadvantages :
1. Not visible
2. Need VDU to check by eye
1.3. Floppy disk

5.25 In

3.5 In

• Advantage
Faster transfer rate than other medias

• Disadvantage
Same with magnetic Tape (not visible)
• Solution
Using PC to visualize contents
1.4. Direct to computer

1.1. Manual data input (MDI)


• Program directly on the machine
terminal using the control, unit itself
1.2.Conversational data input
• Program directly on the machine
terminal using the control, unit itself

2. Machine Control Unit (MCU)


• Consists of electronic hardware that
read and interpret the program and
convert it to mechanical movements
of the machine.
3. Machine tool

• Is the part of NC system that perform


the useful work. It is generally
consists of:
1. Work table
2. Spindle coupled with motor
3. Cutting tools
4. Work fixture
5. Others

➢CNC Milling Machine


➢CNC Turning Machine

➢ CNC Router Machine


➢ CNC Laser Cutting Machine

➢ CNC Plasma Cutting Machine


Coordinate Systems

• Right Hand Axis

Linear Axes
➢ The Z axis is along the spindle. +Z is from the part looking

towards the spindle.

➢ The thumb points in the +X direction.

➢ the index finger points towards +Y.

➢ The program zero is the intersection of the axes.

➢ All coordinates in a program are referenced from this point.


Coordinate Systems
➢ 3 Axis in Milling

➢ 3 Axis CNC Milling


Rotary axes
➢ Rotary axes about X,Y and Z are called A, B and C
respectively.
➢ The sign of a rotary axis is determined by the thumb and
curled fingers of the right hand.
➢ If the thumb points in the + direction of the linear axis, the
other fingers point in the + direction of the corresponding
rotary axis.

➢ 4 - Axis CNC Milling

➢ 5 - Axis CNC Milling


67

1. Reading drawing

2. Programming

3. Input Program

4. Manufacturing

68
NC Words
General Format of a Block
Tool
Dimension Feed
Sequence Preparatory Number
Words Rate Spindle Misc.
# Function
Speed Function

N G X Y Z I J K F S T M

Example

The following list presents the different types of NC


words:

N-Word: Sequence No.


This is used to identify the block

N010

N020
N025
N030
G-Code : Preparatory Word
Is used to prepare the controller for instructions
G20 – Inch input (in) – G70
G21 –Metric input (mm) – G71

G00 – Rapid positioning mode :

Move in a straight line at rapids speed. NOT used for cutting.

G01 – Linear Interpolation mode

Tool is moved along a straight-line path at programmed rate of


speed.
G02 – Circular motion clockwise (CW)

G03 – Circular motion counter clockwise (CWW)

Coordinate Systems
Absolute Incremental

(2,10) (10,10) (-8,8) (8,0)


2 3
2 3

1 (10,2) 1 (10,2)
Absolute & incremental coordinates
Absolute (G90) : All Points refers to Zero point

Incremental (G91) :
All Points refers to
Previous point

pt Abs Inc
Practice
X-Y-Z Word : Coordinates word

G Codes – Arcs
Method : Arc with R
(R is arc radius)
Absolute coordinates
X1Y2
N0 G90 ; Absolute coord
N5 G00 X1 Y2 ; start
R1
N10 G02 X2 Y1 R1

X2Y1

X1Y2

R1
Relative coordinates
N0 G91; Relative coord
X1Y-1
N05 G00 X1 Y2 ; start
N10 G02 X1 Y-1 R1
F-Word : Feed Rate :

The feed rate code to move the cutting tool or work piece to

the desired position.

S-Word : Spindle Speed (rpm)

T-Word: Tool number


T01, T02,….etc

80 Tool Magazine
CNC turret

Miscellaneous function
M-Code List: that used for decision command like
spindle on/off or coolant on/off
M02 End of Program
M03 Spindle on CW
M04 Spindle on CCW
M05 Spindle off
M06 Tool change
M07 Coolant 2 on
M08 Coolant 1 on
M09 Coolant off
M30 End of tape
Preparatory function
G-Code List: that used to guide the machine tool to
carry out machining processes
G00 Rapid Linear Interpolation PTP
G01 Linear Interpolation
G02 Clockwise Circular Interpolation
G03 Counter Clockwise Circular Interpolation
G17 X-Y Plane Selection
G18 Z-X Plane Selection
G19 Y-Z Plane Selection
G20 Inch Mode
G21 Metric Mode
G90 Absolute Value Command
G91 Incremental Value Command

Programming
Point N G X Y Z I J S F T M
P1


Pn
Profile milling
Profiling is to cut the WP using one side of the
cutting tool

Practice
Write a part programme to machine the following part and
list the tool used
30
50

20

80 10

Dim in mm
Solution Tool change Point
P0

Y
30
P2
50 P3

P4 P5
20
P1
80 P6 X 10 Z

Solution
N010 G21 G90

N020 G00 X90 Y60 Z5 T01 M06

N030 X0 Y0 S1000 M03 M07

N040 G01 Z-15 F200

N050 Y50

N060 X30

N070 Y20

N080 X80

N090 Y0

N100 X0

N110 Z5

N120 G00 X90 Y60 M05 M09

N130 M30
Tool Description

T01 End mill, 10mm


Dia.

Part Programming Examples

90
Example2 (Profiling)
example
Absolute cord. N10 G90
Feed Rate (mm/min) N20 G98
Metric units N30 G21
Go to above start point(1) N50 G0 X25 Y5 Z10
Tool changing N60 T1 M6
Spindle 1000rmp&feed N80 S1000 M03
Down to depth 5 at (1) N90 G01 Z-5 F100
Linear to (2) N100 X95
Linear to (3) N110 Y12
CW to (4) N120 G2 X110 Y27 R5
Linear to (5) N130 G1 X115
Linear to (6) N140 Y70
CCW to (7) N150 G3 X100 Y85 R15
Linear to (8) N160 G1 X15

example
Linear to (9) N170 X5 Y63
Linear to (10) N180 Y27
Linear to (11) N190 X10
CW to (11) N200 G2 X25 Y12 R15
Linear to (12) N210 G1Y5
Out of w.p. to Z=10 N220 Z10
Spindle stop N230 M5
End program N240 M2
Slot milling
Slotting is to cut the WP using both sides of cutting
tool

Example3 (Slotting)
Example (Slotting)

Example (Slotting)
Example (Slotting)

Example (Slotting)
Example (Slotting)
Absolute cord. N10 G90
XY plane N20 G17
Metric units N30 G21
Go to above start point(1) N50 G0 X40 Y100 Z10
Tool changing N60 T2 M6
Spindle 1000rmp&feed N80 S1000 F10 M3
Down to depth 5 at (1) N90 G01 Z-20
Linear to (2) N100 Y60
CCW to ( 3) N110 G3 X70 Y30 R30
Linear to(4) N120 G1 X130
CCW to (5) N150 G3 X160 Y60 R30
Linear to (6) N160 G1 Y100
Out of w.p. to Z=10 N220 Z10
Spindle stop N230 M5
End program N240 M2

Example No. 4
16

1 10

24
1 GRID
SPACES

D( , ) I( , ) J( , )
B( , ) K( , )

L( , )

E( , )
A( , )

F( , )

C( , )
H( , ) G( , )
Origin
(0,0)

1GRID
SPACES

D( 10,14) I(14,12) J(16,14)


B(3,14) K(19,14)

L(21,12)

E(21,4)
A(3,2)

F(19,2)

C(10,2 )
H(14,4) G(16,2)
Origin
(0,0)
Solution Tool
Y change
Point
N010 G90 G21
N020 G00 X25 Y17 Z1.5 T01 M06
N030 G00 X3 Y2 Z1 S1000 M03 M08
X
N040 G01 Z-1 F5
N050 Y14
N060 X10 Y2
N070 Y14
N080 G00 Z1

Tool
Y change
N090 X21 Y4 Point
N100 G01 Z-1
N110 X19 Y2
N120 X16
N130 X14 Y4 X

N140 Y12
N150 X16 Y14
N160 X19
N170 X21 Y12
N180 G00 Z1.5
N190 X25 Y17 M05 M09
N200 M30

• Fixed Zero and Floating Zero


• Automated Tool Compensation

109
Fixed Zero and Floating Zero

Machine
Zero

Program Zero

Part Zero

Fixed Zero and Floating Zero


Machine Zero: The machine origin is a fixed point set by the
machine tool builder. Usually it cannot be changed. Any tool movement
is measured from this point. The controller always remembers tool
distance from the machine origin.

Program Zero: It is also called home position of the tool. This


can be any point within the workspace of the tool which is sufficiently
away from the part. In most cases, it is a point where tool change is
carried out.

Part Zero: The part origin can be set at any point inside the
machine's electronic grid system. Establishing the part origin is also
known as zero shift, work shift, floating zero or datum. Usually part
origin needs to be defined for each new setup. Zero shifting allows
the relocation of the part.
Fixed Zero and Floating Zero

Fixed Zero: is the origin point of


machine zero itself. This zero is located at
the same location every time using the
machine

Fixed Zero and Floating Zero

Floating Zero: In machines with


floating zero the fixed zero point of the
machine can ignored while programming.

the programmer can select any point as the


part zero without any constraint on the sign
of the programmed dimensions, i.e., in milling
the dimensions in the part program may be
positive as well as negative.
Fixed Zero and Floating Zero

Floating Zero:

Fixed Zero and Floating Zero

Fixed / Floating Zeros:


Fixed Zero and Floating Zero
Example
For the shown part calculate the coordinates
of points 1, 2, and 3 in:
1- Fixed Zero
2- Floating zero at
parts’ center point

20

20

Fixed Zero and Floating Zero


Example
For the shown part calculate the coordinates
of points 1, 2, and 3 in:
1- Fixed Zero
Fixed Zero and Floating Zero
Example
For the shown part calculate the coordinates
of points 1, 2, and 3 in:
2- Floating zero at
parts’ center point

Fixed Zero and Floating Zero


Registering floating zero command

In old CNC milling machine the code G92 is


used to define part zero

G92 X…Y…Z…

It can be used to change


the programming zero
at any point in the
program
Fixed Zero and Floating Zero
Registering floating zero command

In new CNC milling machines the codes G53-G59


are used to define part zero
G53-G59 : each one is having a pre-programmed
different part zero can be called while machining

Cutter Radius Compensation


At No Compensation Designed
Contour

Produced
pocket

Produced
profile

The g-code programming usually controls the


position of tool’s center

To enable cutting calculation with respect to

tool side, the radius compensation should

be taken in the consideration

D: Cutter Diameter rc
rc: cutter radius D
The programming regarding tool radius
compensation are as follows:

1. Automated Tool Compensation

2. Manual Tool Compensation

1. Automated Tool Compensation


Tool compensation G-Codes
1. Automated tool compensation

At Left compensation
G41

Tool compensation G-Codes


1. Automated tool compensation

Compensation direction

(a) G41 (b) G42

Left to path Right to path


Tool compensation G-Codes
1. Automated tool compensation

Types of Compensation

1. Ramp compensation

2. Parallel compensation

Tool compensation G-Codes


1. Automated tool compensation

1. Ramp compensation (0.5, 1.7)

G41 (1.5, 1.7)

G42

G41 (or G42) and G01 in the same block ramp takes place at
block N0010.
N0010 G01 G42 X0.500 Y1.700
N0020 G01 X1.500
Tool compensation G-Codes
1. Automated tool compensation

2. Parallel compensation

G41

G42
G41 (or G42) is already started before G01 in previous
block, the compensation is effective from the start.
N0010 G41………………………
N0020 G01 X0.500 Y1.700
N0030 G01 X1.500

Tool compensation G-Codes


1. Automated tool compensation
Compensation startup methods
Go above entering point N90 G00 X-30 Y-30
Down to depth N100 G01 Z-20

Approach X with Ramp compens. N100 G01 G41 X0


Cut the side with parallel compens. N110 Y50
Tool compensation G-Codes
1. Automated tool compensation
Compensation startup methods
Go above entering point N90 G00 X-30 Y-30
Down to depth N100 G01 Z-20

Approach Y with Ramp compens. N100 G01 G41 Y0 D01


Approach X with parallel compens. N110 X0
Cut the side with parallel compens. N120 Y50

Tool compensation G-Codes


1. Automated tool compensation
Compensation startup methods
Go above entering point N90 G00 X-30 Y-30
Down to depth N100 G01 Z-20

Approach start point with Ramp compens. N100 G01 G41 X0 Y0


Cut the side with parallel compens. N110 Y50

Recommended
Tool compensation G-Codes
1. Automated tool compensation

Relation between G41/42 and M03/04

Tool compensation G-Codes


1. Automated tool compensation
The tool path is regenerated according to
tool’s diameter
• Tool length offset

136
Tool length offset
• If more than one tool is being used, the first tool is set to zero on all
axis (XYZ). As the X and Y axis are set at the center of the cutter
they will be the same for all subsequent cutters.
• The Z axis zero point will however be different for each tool, being
dependent on the tool length.

Tool length offset


To make life easier the first tool is given an offset (or length) of zero
and subsequent tools are given a positive or negative offset based on
the difference in length from tool No. 1.
Tool length offset
Lets bring the first tool into contact with the work

This means that tool No. 1 has been set to a tool length
of 0

Tool length offset


Now tool 2 is brought into position. Its height is now
compared with Tool No. 1 and the tool length offset
entered in the tool data file. In this case it is -5.5, in other
words the tool No. 2 is 5.5 mm lower than tool No. 1 when
it is in contact with the work.
Tool length offset
Finally the third tool is brought into contact with the work

Once again the difference in height between it and the


first tool is measured. This time the tool is higher than
Tool No. 1 so its offset value is positive.

Tool length offset


Example
T01(used in floating zero adjustment) T02 (another tool)

Length 160 Length 130


mm mm

H= -30 mm

When use T02


(1) Is (-30 mm) from
machine’s database table
N000 G43 H1
Tool length offset
Example Master tool

Tool length offset


Tool length offset
In practice, the tool offsets are set by simple touching each tool in
turn onto the top surface of the workpiece. The top surface of the
workpiece is usually the Z zero. A value is displayed, which is the
distance that the tool is from the zero point. All the setter has to do
is to enter the displayed value into the tool offset data panel and the
offset is set

Tool compensation G-Codes


1. Automated tool compensation
There are 3 different types of tool offset tables

Offset memory Type A

Offset memory Type B

Offset memory Type C


Tool compensation G-Codes
Offset memory Type A

It uses only parameter (H) for both length and


radius compensations (called shared compensation)

T05 M06
T05 new tool
length G43 H05
Radius G41 H35

Tool compensation G-Codes


Offset memory Type C

It uses parameter (H) for length and parameter (D)


radius compensations

T05 M06
length T05 new tool

G43 H05

G41 D05
Radius
Example II
Solve the following with auto. tool compensation using
tool of 20 mm diameter at depth 10 mm, S2000, and
F10
Point X Y
1 0 0 3 4
2 0 100
3 50 170 5
4 140 170 2
5 190 120
6 190 40 6
7 150 0
1 7

Example II
Solve the following with auto. tool compensation using
tool of 20 mm diameter at depth 10 mm, S2000, and
F10
Absolute cord. N10 G90 G98
XY plane N20 G17
comp. off N30 G40
Metric units N40 G21 3 4
w.p. floating(0) N50 G54
Go to above 1 N60 G0 X-20 Y-20 Z20
Tool changing N70 T1 M6 G43 H1
1000rmp&feed N80 S1000 F10 M3 5
Dwn to depth 10 at (0) N90 G01 Z-10
2
Ramp Linear to (1) G41 D01 X0 Y0

Linear to (2) N100 Y100


Linear to (3) N110 X50 Y170 6
Linear to (4) N120 X140
CW to(5) N130 G2 X190 Y120 R50 1
Linear to (6) N140 G1 Y40 7
CCW to (7) N150 G3 X150 Y0 R40
Linear to (1) N160 G1 X0
Cancel compensation N170 G40 X-20 Y-20
Out of w.p. to Z=10 N180 Z20
Spindle stop N190 M5 0
End program N200 M2
• Manual Cutter Radius Compensation

152

2.Manual tool compensation

The tool center is shifted on a new profile by the


amount of tool radius where the new profile is

calculated

Original
profile

Offset
profile
(2,4)

(6.5,2)

(0,0) (6,0)

Manual tool compensation is time consuming and

dependent on tool’s diameter.


BUT WHY?
1. MCU does not support radius compensation

feature.

2. In complex shapes, some compensation errors may

occurs, the manual compensation method is the

solution.
Example No.1
Write a CNC program to mill the outline of the following
part using 0.5” end mill. The machine doesn't

support the tool compensation option.


2
4

5 1
Dim in inch

Solution Tool change Point


P0

Y
ΔY 2 ΔY
ΔX P2 P3 ΔX
4

ΔY ΔY
P4ΔX P5 ΔX
P1 1
P6
ΔY 5 X ΔY 1 Z

ΔX ΔX
XC = YC =
point X Y ΔX ΔY
X+ΔX Y+ΔY
1 0 0 -0.25 -0.25 -0.25 -0.25
2 0 4 -0.25 0.25 -0.25 4.25
3 2 4 0.25 0.25 2.25 4.25
4 2 1 0.25 0.25 2.25 1.25
5 5 1 0.25 0.25 5.25 1.25
6 5 0 0.25 -0.25 5.25 -0.25
ΔX : the cutter location shift in X direction
ΔY : the cutter location shift in Y direction

XC : the cutter location in X direction


G code Program
YC : the cutter location in Y direction

G Code Program
N010 G20 G90

N020 G00 X6 Y5 Z0.5 T01 M06

N030 X-0.25 Y-0.25 S1000 M03 M07

N040 G01 Z-1.5 F200

N050 Y4.25

N060 X2.25

N070 Y1.25

N080 X5.25

N090 Y-0.25

N100 X-0.25

N110 Z0.5

N120 G00 X6 Y5 M05 M09

N130 M30
The tool path is regenerated according to
tool’s diameter
ΔX and ΔY are determined depending on the case
of the intersections of two surfaces.

Case No.1 : Two Perpendicular Surfaces

ΔX = ΔY = rc ΔY

ΔX

Case No.2 : One Horizontal And Other Inclined

ΔY = rc ΔX
α
2/ α
ΔX = rc / tan(α/2) rc ΔY

α
Case No.3 : one vertical and other inclined

ΔX = rc

ΔY = rc / tan(α/2)

Case No.4 : one vertical and other inclined

ΔX = rc

ΔY = rc / tan(α/2)

Example No.2
Write a CNC program to mill the outline of the following
part using 0.5” end mill. The machine doesn't
support the tool compensation option.

Dim in inch

Thick. = 1”
XC = YC =
point X Y ΔX ΔY
X+ΔX Y+ΔY
1 0 0 -0.25 -0.25 -0.25 -0.25
2 0 5 -0.25 0.25 -0.25 5.25
3 2 5 .09 0.25 2.09 5.25
4 5 2.48 0.25 0.116 5.25 2.6
5 5 0 0.25 -0.25 5.25 -0.25

G code Program
N010 G20 G90

N020 G00 X7 Y7 Z1 T01 M06

N030 X-0.25 Y-0.25 S1000 M03 M07

N040 G01 Z-1.5 F200

N050 X-0.25 Y5.25

N060 X2.09

N070 X5.25 Y2.6

N080 Y-0.25

N090 X-0.25

N100 Z1

N120 G00 X7 Y7 M05 M09

N130 M30
Case No.5 : Line with arc

ΔX= ( R + rc ) sin (α)

ΔY= ( R + rc ) cos (α)

Example No.3
Define the coordinates for the outline of the following
profile. The machine doesn't support the tool
compensation option.

All Dim.
are in inch
point X Y ΔX ΔY XC YC I J

1 0 0 -0.25 -0.25 -0.25 -0.25

2 1.75 2.5 -2 0 -0.25 2.5 2 0

3 1.75 2.5 0.84 1.81 2.59 4.31

4 4.5 1.5 0.73 1.58 5.23 3.08 0.7 1.5

5 4.5 1.5 0 -1.75 4.5 -0.25

Solution
At Point 3
ΔX3=(1.75+0.25) sin (θ)
ΔY3=(1.75+0.25) cos (θ)
Where:
Θ=α+β
Tan(α)=1/2.75 α = 20 deg.
Sin(β) = 0.25 / 𝟐. 𝟕𝟓𝟐 + 𝟏𝟐 β = 5 deg. Θ = 25 deg.
ΔX3 = 0.842 inch
ΔY3 = 1.814 inch
Xc3 = 1.75+0.842=2.592 inch
Yc3 = 2.5 + 1.814 = 4.314 inch

At Point 4

ΔX4=(0.25+1.5) sin (25) = 0.737 inch

ΔY4=(1.5+0.25) cos (25) = 1.587 inch

Xc4 = 4.5+0.737=5.237 inch

Yc4 = 1.5+1.537= 3.087 inch


What is the Drilling and Milling Canned Cycle?

➢ Canned cycles automate certain machining


functions such as drilling, boring, tapping,
pocketing, etc...
The Different Levels of the Tool Position

Z initial

R -level

Z -level
Initial level : is the specific position of the tool at the moment the canned
cycle become effective

Z - level: is the end of the feed (metal cutting) motion or the final depth

R - level : the end or rapid motion (0.5: 2.5mm) from the part surface.

Generally, a canned cycle consists of a sequence of six


operations, as shown below:

Op.1 - Positioning of the X and Y axes.


Op.2 - Rapid traverse in the Z axis
to the "R“ point.
Op.3 - Hole machining procedure.
Op.4 - Operation at bottom of hole.
Op.5 - Retraction to R point.
Op.6 - Rapid traverse in the Z axis to
the Initial l e v e l.
Conventional programming to drill a hole on CNC m/c

N10 G90 G21


N20 G00 X100 Y100 Z30 T01 M06
N30 S1000 M03 M08
N40 G00 X10 Y10
N50 G00 Z2
10MM THICK
N60 G01 Z-15 F0.5
N70 Z2
N80 G00 Z30
………. AND SO ON

Conventional programming

How many blocks you need to drill all


holes?
Drilling and milling Canned Cycles
G81 : Drilling
G82 : Drilling –Counter Boring
G83 : Deep Hole - Peck Drilling
G84 : Tapping
G76 : Boring
Note : G80 : Cancels Canned Cycle
G98 : Return To Initial Level
G99 : Return To R - Level

G81 : Drilling

Sequence of moves:

Op 1) Rapid position to X, Y and Z (the Initial level).

Op 2) Rapid traverse to R level.

Op 3) Feed to Z depth.

Op 4) Rapid traverse to Initial level (G98) or R level (G99).


Format
G81 X Y Z R F

Z
Example
Z initial
G00 Z30
30
R -level
G98 G81 X10 Y10 Z-15 R2 F0.4
20 15
Note Z -level
Y
If the Zero point in the bottom of the WP

G00 Z50
10 X
G98 G81 X10 Y10 Z5 R22 F0.4 10

Note (cont.)
For through holes
Z = wp thick + d /(2tan 59) + clearance (5mm)
Z = 20 + (10 / (2tand(59))) + 5 = 31mm Z

Example
G00 Z30 30

G98 G81 X10 Y10 Z-31 R2 F0.4


20 10
Note
5
If the Zero point in the bottom of the WP

G00 Z50 d
118
G98 G81 X10 Y10 Z-11 R22 F0.4
G82 : Counter Boring

Sequence of moves:

Op 1) Rapid position to X, Y and Z (the Initial level).

Op 2) Rapid traverse to R point level.

Op 3) Feed to Z depth.

Op 4) Dwell for value P. ----P (time in 1/1000 seconds)

Op 5) Rapid traverse to Initial level (G98) or R level (G99).

Format
G82 X Y Z R F P

Z
Example
Z initial
G00 Z30
30
R -level
G98 G82 X10 Y10 Z-5 R2 F0.4 P2500 5

20
Note Z -level
Y
If the Zero point in the bottom of the WP

G00 Z50
10 X
G98 G82 X10 Y10 Z15 R22 F0.4 P2500 10
G83 : Deep Hole Peck Drilling ---- (L/d)≥3

Sequence of moves:
Op 1) Rapid position to X, Y and Z (the initial level).
Op 2) Rapid traverse to R point level.
Op 3) Feed in to the value of Q.
O p4) Rapid traverse out to R point. Operation from 2 to 4 are repeated until
Z depth is reached.
Op 5) Rapid traverse to Initial level (G98) or R level (G99)

Format
G83 X Y Z R F Q

Z
Example L=15 ,d=5mm
Z initial
G00 Z35
35
R -level
G98 G83 X10 Y10 Z-15 R2 F0.4 Q 2
5
30 15
Note Z -level
Y
If the Zero point in the bottom of the WP

G00 Z65
10 X
G98 G83 X10 Y10 Z15 R32 F0.4 Q 2 10
Note (cont.)
For through holes
Z = wp thick + d /(2tan 59) + clearance (5mm)
Z = 20 + (10 / (2tand(59))) + 5 = 28mm Z

Example L=30 ,d=10


G00 Z35 35

G98 G83 X10 Y10 Z-38 R2 F0.4 Q3


30 10
Note
5
If the Zero point in the bottom of the WP

G00 Z65 d
118
G98 G81 X10 Y10 Z-11 R32 F0.4

G84 : Tapping

Sequence of moves:

Op 1) Rapid position to X, Y and Z (the initial level).

Op 2) Rapid traverse to R point level.

Op 3) Feed to Z depth.

Op 4) Dwell P (time for spindle stop and start CCW d i r e c t i o n ) .

Op 5) Feed to R point level.

Op 6) Dwell P (time for spindle stop and start CW direction).


Format
G84 X Y Z R F

Note

F = pitch * spindle speed

For example ---using 125rpm to tape M6 * 1 --- F=1*125= 125 mm/min

---using 100rpm to tape 3/8” * 16 --- F=(1/16)*100= 6.25”/min

---- F=6.25*25.4 = 158 mm/min

Example
------

N40 S100 M03


Thread (¼” *20)
G00 Z1

G98 G84 X0.625 Y0.625 Z-.8 R0.1 F0.4

Note :

F = 100*(1/20)=5”/min
G76 : Fine Boring

Sequence of moves:

Op 1) Rapid position to X, Y and Z (the Initial level).

Op 2) Rapid traverse to R point level.

Op 3) Feed to Z depth.

Op 4) spindle stop and move Q value.

Op 5) Feed to R point level.

Op 6) Move back Q value.

Format
G76 X Y Z R F Q

Q: side shift Z
Example
Z initial
G00 Z35
35
R -level
G98 G76 X10 Y10 Z-35 R2 F0.4 Q 0.5
5
30
Note Z -level
Y
If the Zero point in the bottom of the WP

G00 Z65
10 X
G98 G76 X10 Y10 Z-5 R32 F0.4 Q 0.5 10
1. Complete the following table to perform the (Drilling, Counter
boring, and Tapping operations) For the part shown in the Fig,
using suitable canned cycles. Note: R-level =2mm for all
operations.
position Drilling Operation
G X Y Z R S F P Q Note
1 81 25 25 -5 52 1000 4 Z=
2 81 100 50 -5 52 1000 4
3 81 100 150 -5 52 1000 4
4 81 175 175 -5 52 1000 4
Counter boring
2 82 100 50 15 27 1000 100
3 82 100 150 15 27 1000 100
Tapping
1 84 25 25 -5 52 100 200
4 84 175 175 -5 52 100 200

Multiple Machining

195
Y
Loop Command Cycles
N10 G90 G20 X

N20 G00 X12 Y2 Z1 T01 M06

N30 S1000 M03 M08

N40 G00 X1 Y-1

N50 G99 G81 Z-1.5 R0.1 F0.4

G91 X1 L9

G90 Y-2

G91 X-1 L9

Y
G90 Y-3
X
G91 X1 L9

G90 Y-4

G91 X-1 L9

……………

G90 Y-10

G91 X-1 L9

G80 G00 G90 X12 Y2 M05 M09

M30
Bolt Hole Patterns

G72: Bolt Hole along


G70: Bolt Hole Circle G71: Bolt Hole Arc
an angle

These G codes must be used with one of canned cycles (G81-G76)

The tool must be positioned at the center of circle either in


a previous block or in the G70/71 )

G70: Bolt Hole Circle

G70 I J L

I: Radius (Minus Reverse Starting Position)

J: Starting Angle (0 To 360 Deg. CCW Form Horizontal)

L: Number of Holes
Y
Example X
N10 G90 G20 G00 X6 Y5 Z1 T01 M06

N30 S1000 M03 M08

N40 G00 X2 Y-1.5 (Center position of bolt

hole circle)
Note : L0 will cause machine
N50 G99 G81 Z-0.5 R0.1 F0.4 L0
to not do this command until
N60 G70 I1.25 J10 L8 the control reads the next

N70 G80 G00 X6 Y5 Z1 M05 M09 line, so as not to drill a hole


in the center of bolt circle
N80 M30

G71: Bolt Hole Arc

G71 I J K L

I: Radius (Minus Reverse Starting Position)

J: Starting Angle (0 To 360 Deg. CCW Form Horizontal)

K: Angular Spacing of Holes (+ or -)

L: Number of Holes
Example Y
N10 G90 G20 G00 X6 Y5 Z1 T01 M06 X

N30 S1000 M03 M08

N40 G00 X2 Y-1.5 (Center position of bolt hole arc)

N50 G99 G81 Z-0.5 R0.1 F0.4 L0

N60 G71 I0.875 J45 K36 L6

N70 G80 G00 X6 Y5 Z1 M05 M09

N80 M30

G72: Bolt Hole along an angle

G72 I J L

I: Distance Between Holes

J: Angle Form Three o’clock position

L: Number of Holes
Y
Example X

N10 G90 G20 G00 X6 Y5 Z1 T01 M06

N30 S1000 M03 M08

N40 G00 X0.65 Y-1.5 (Start position of bolt holes along an angle)

N50 G99 G81 Z-0.5 R0.1 F0.4 G72 I0.5 J20 L7

N70 G80 G00 X6 Y5 Z1 M05 M09

N80 M30

Example No.1 Y
N10 G90 G20

N20 G00 X5 Y5 Z1 T01 M06

N30 S1000 M03 M08

N40 G00 X1 Y1

N50 G99 G81 Z-1.5 R0.1 F0.4 L0 X

N60 G70 I0.5 J0 L6

N70 G80 G00 X3 Y1

N80 G99 G81 Z-1.5 R0.1 F0.4 L0

N90 G70 I0.5 J0 L6


N100 G80 G00 X3 Y3 Y

N110 G99 G81 Z-1.5 R0.1 F0.4 L0

N120 G70 I0.5 J0 L6

N130 G80 G00 X1 Y3

N140 G99 G81 Z-1.5 R0.1 F0.4 L0


X
N150 G70 I0.5 J0

N160 G00 G80 X5 Y5 Z1 M05 M09

N170 M30

Subprogram
Subprogram call M97

A subprogram is a separate program called up by another program.

The use of subprograms can significantly reduce the amount of

programming on some parts.

Subroutines allow the CNC programmer to define a series of

commands which might be repeated several times in a program and,

instead of repeating them many times, they can be “called up” when

needed.

The most common use of subroutines is in the definition of a series of

holes which may need to be center drilled, peck drilled, tapped, and/or

chamfered.

If a subroutine is defined that consists only of the X-Y position of the

holes, the main program can define the canned cycles, and the hole

locations can be called up in the subroutine to do each of the tool

operations.

Thus, the X-Y positions can be entered only once and used several

times for each tool.


Another important feature of a "subroutine call" is that the M97

block may also include an L (loop) or repeat count. If there is an Ln

with the subroutine call it is repeated that number of times before the

main program continues with the next block.

To return back to the main program, you end a subroutine with an

M99 which sends it back to the next line after the subroutine call in

the main program.

Subroutine call M97


N1 G90 G20 G00 X6 Y4 Z2 T01 M06
N2G00 X0.5 Y0.5 S1000 M03 M08
Main Program

N3G99 G81 Z-5 R1.1 F0.4


N4 M97 O100 L1
N5 M05 G80
N6 G00 X6 Y4 Z2 T02 M06
N7G00 X0.5 Y0.5 S300 M03 M08
N8G99 G84 Z-5 R1.1 F0.1
N9 M97 O100 L1
N10 G80 G00 X6 Y4 Z2 M05
N11 M30 (End of main program)

O100 (Subprogram)
X2.5
X4.5
X3.5 Y1.5
…………Listing all the hole locations
M99 (ends a sub-program and returns back to
the next line in the main program)
Write a G code program for milling the shown 4 rectangular pocket,
use subroutine
Y call.

20
25

20
30
X
N1 G90 G21 G00 X200 Y80 Z50 T01 M06

Main Program
N2 G00 X20 Y20 Z5 S1000 M03 M08
N4 M97 O100 L1
N6 G00 X70 O100 (Subprogram)
N7 M97 P100 L1 G92 X0 Y0 (set current
N8 G00 X120 position to X=0,Y=0)
N9 M97 O100 L1 G01 Z-10 F4
N10 G00 X200 Y 50 Z20 M05 M09 Y25
N11 M30 (End of main program) X30
Y0
X0
Z2
M99

You might also like