CH 3-Part II - CNC Machine Tools
CH 3-Part II - CNC Machine Tools
-
Manual NC Part
Programming
April 2020
1
1. Manual NC Part Programming
1.1. Programming fundamentals
a. Coordinates systems and references
points
Part programming requires establishment of some
reference points.
Three reference points are either set by
manufacturer or user.
i. Machine Zero (machine coordinate system)
Its is a fixed point set by the machine tool
2
Cont’d…
ii. Program Origin
It is also called home position of the tool.
It is point from where the tool starts for its motion while executing a program
and returns back at the end of the cycle.
This can be any point within the workspace of the tool which is sufficiently
away from the part.
In case of CNC lathe, it is a point where tool change is carried out.
4
1.2: Positioning Cont’d…
The way of specifying
coordinate values of path’s
end point or target position in
programming are 3 in kinds:
a. Absolute programming
All references are made
to the origin of the
coordinate system.
X/Z axis absolute
coordinate values are
presented by X--, Z— 5
2. Incremental programming
It uses the preceding point in a sequence of points as a
reference.
X/Z axis incremental coordinate values are presented by U--, W–
3. Compound programming
Uses the absolute programming and incremental program
together.
Specified by X--,W-- or U--, Z-- 6
Ex. 1: Define the coordinates of points p0-p6 both in
absolute & incremental mode.
7
Soln: Cont’d…
G90 G91
Absolute X Y Increment X Y
P0 X0 Y0 P0 X0 Y0
P0-P1 X-20 Y-20 P0-P1 X-20 Y-20
8
Example 2
9
1.3. Interpolation Methods
Interpolation is defined as a planar or three dimensional
contour formed by path of 2 or multiple axes moving at the
same time.
Here four methods are discussed:
Linear interpolation: Straight line between two points
in space.
Circular interpolation: Circular arc defined by starting
point, end point, center or radius, and direction.
Helical interpolation: Circular plus linear motion.
Parabolic and cubic interpolation: Free form curves
using higher order equations.
10
1.4. Structure of NC program
Cont’d…
A program consists of a sequence of blocks, beginning with
“OXXXX” (program name) and ending with “%”; a block
begins with block number and ends with “;”.
See the general structure of program as follows:
13
1.4.1: Explanation of Words
1. Sequence number (N address):
Its used to identify the block and its always placed at the
beginning of the block.
The sequence number need not to be consecutive.
15
5. Spindle function (S Address)
The spindle speed is commanded under an S address and is always in
revolution per minute.
The following table gives the surface cutting speeds for some common
materials:
16
7. Tool Function (T Address)
The selection of tool is commanded under a T address.
8. Miscellaneous functions
It’s a function programmed to control the machine operation
other than coordinate movement.
The most common M functions are as follows:
17
2: Manual Part Programming For NC Lathe
2.1: G codes(preparatory functions)
G00 (Positioning)
Each axes moves as much as commanded data in rapid feed
rate.
Command Format: G00 X(U)__Z(W)__
Absolute programming
G00 X150.0 Z100.0
X200.0 Z200.0
Incremental
programming
G00 U150.0 W100.0
18
Example:
19
G01 (Linear interpolation)
Each axes moves straightly as much as commanded data in
commanded rate.
Command Format: G01 X(U)___ Z(W)___ F___
Absolute programming
G01 X150.0 Z100.0 F0.2;
X200.0 Z200.0;
Incremental programming
G01 U150.0 W100.0 F0.2
U50.0 W100.0
20
Example 1:
N100 G01 X25.0 Z-30.0 F0.2
21
Example 2: Cutting path from Φ40 to Φ60
Absolute programming
G01 X60 Z7 F0.2;
Incremental programming
G01 U20 W-25F0.2;
Compound programming
G01 X60 W-25F0.2 ;
Compound programming
G01 U20 Z7 F0.2 ;
22
Circular interpolation: G02 & G03
Command format:
Command function:
G02 movement path is clockwise arc from starting point to end
point.
G03 movement path is counterclockwise arc from starting point
to end point.
I = Coordinates of center point – that of starting point in X
direction;
K = Coordinates of center point – that of starting point in Z
direction.
23
Command the path
G03 path
G02 path
24
Example 1:
Absolute programming
G03 X63.06 Z-20.0 R19.26 F0.2 ;
Incremental programming
G03 U17.81 W-20.0 R19.26 F0.2 ;
Absolute programming
G03 X63.06 Z-20.0 I17.68 K-6.37 F0.2;
Incremental programming
G03 U17.81 W-20.0 I17.68 K-6.37 F0.2;
25
Example 2: Write a manual part program to generate the ff profile.
O0001
G21 M03 S200 ;
G00 X0 Z3.0 M08 ;
G01 Z0 F0.2;
G03 X20.0 Z-10.0 R10.0;
G01 Z-50.0;
G02 X100.0 Z-74.385 R45.0;
G01 Z-114.385;
G00 X200.0 Z200.0 M05 M09;
M30;
26
Example 3:
Process: Facing process, turning
process
Dimension: ø105 x 86L
Material: mild steel
(ABSOLUTE)
N0005 G90 G21 S900 M03 ;
N0010 G00 X90.0 Z5.0 M08 ;
N0015 X48.0 ;
N0020 G32 Z-71.5 F0.3 ;
N0025 G00 X90.0
N0030 Z5.0 ;
N0035 X46.0 ;
N0040 G32 Z-71.5 ;
N0045 G00 X90.0 ;
N0050 Z5.0;
N0055 X150.0 Z150.0 T0100 ;
N0060 M30 ; 31
Example 2
ABSOLUTE
N0005 G90 G21 S900 M03 ;
N0010 G00 X90.0 Z5.0 ;
N0015 X23.0;
N0020 G32 X48.0 Z-71.5 F3.0 ;
N0025 G00 X90.0 ;
N0030 Z5.0 ;
N0035 X21.0 ;
N0040 G32 X46.0 Z-71.5 ;
Lead of screw: 3mm N0045 G00 X90.0 ;
δ1: 5mm N0050 Z5.0 ;
δ2: 1.5mm N0055 X150.0 Z150.0 Mo5Mo9T0100 ;
Depth of cut: 1mm(2cut two N0060 M30 ;
times)
32
INCREMENTAL
O0013
N010 G21 G90;
N015 MO3 S300 T0101 ;
N020 G00 X56.0 Z2.0 M08 ;
N025 G90 X51.0 W-32.0 F0.25 ;
X46.0 ;
X41.0 ;
X36.0 ;
X31.0 ;
X30.0 ;
N030 G28 U0 W0 ;
N035 M30 ;
Example 2:
O0012
N010 G21 G90;
N015 MO3 S300 T0101 ;
N020 G00 X61.0 Z2.0 M08 ;
N025 G90 X55.0 W–42.0 F0.25 ;
X50.0 ;
X45.0 ;
X40.0 ;
Z-12.0 R-1.5 ;
Z-26.0 R-3.25 ;
Z-40 R-5 ;
N030 G28 U0 W0 ;
N035 M30 ;
38
(G94) Radial cutting cycle
Command format: G94 X(U) __ Z(W) __ F__; (face cutting)
G94 X(U) __ Z(W) __ R__ F__; (taper face
cutting)
Command function: From starting point, the cutting cycle
of cylindrical surface or taper surface is completed by radial
feeding (X) and axial (Z or X and Z) cutting.
39
Cycle process:
① Z rapidly traverses from starting point to cutting starting
point;
② Cutting feed (linear interpolation) from the cutting starting
point to cutting end point;
③ Z executes the tool retraction at the cutting feed rate
(opposite direction to the above-mentioned ①
④ The tool rapidly traverses to return to the starting point and
the cycle is completed.
40
Example 1:
O0014
N010 G21 G90 ; Z–12.0 ;
N015 MO3 S300 T0101 ; Z–14.0 ;
Top
View
Front
View
Tool At Start
y
Top
View
Front
View
Tool At Start
N01 G90 G71 G95
N02G00 X25.0 Y25.0
N03 G00 Z0.1 M08
y N04 M03 S600
Top N05 G01 Z-20.0 F0.5
View N06 G00 Z0.1
N07 G00 X75.0
No8 G01 -20.0
x N09 G00 Z0.1
N10 G00 X75.0Y75.0
N11 G01Z-20.0
z N12 G00 Z0.1
N13 G00X25.0
Front N14 G01 Z-20.0
76
2.3.1: G codes(preparatory functions)
78
CNC Milling
2D - Surface Machining
CNC Programming
CNC Programming
N00 G90 G21 G17 G94 ;
N01 G00 X0 Y-4;
N02 G01 X54 Y-4 F0.2;
N03 G01 X54 Y24;
N04 G01 X50 Y24;
N05 G02 X29 Y45 I0 J21;
N06 G03 X-29 Y45 I-29 J0;
N07 G02 X-50 Y24 I-21 J0;
N08 G01 X-54 Y-24;
Tool radius = 4 mm (tool at X = 0, Y = -4)
N09 G01 X-54 Y-4;
Tool starts from origin and returns to origin
N10 G01 X0 Y-4;
Only motion statements
N11 G00 X100 Y100;
All motions are feed motions
N11 M30;
CNC Programming
Options
N04 G02 X29 Y45 R21
N05 G03 X-29 Y45 R29
Tool radius = 4 mm (tool at X = 0, Y = -4) N06 G02 X-50 Y24 R21
Tool starts from origin and returns to origin
Only motion statements
All motions are feed motions
Options
N00 G42
N01 G00 X0 Y-4 N01 G00 X0Y0
N02 G01 X54 Y-4 N02 G01 X50 Y0
N03 G01 X54 Y24 N03 G01 X50 Y20
N04 G01 X50 Y24 N04 G02 X25 Y45 I0 J25
N05 G02 X29 Y45 I0 J21 N05 G03 X-25 Y45 I-25 J0
N06 G03 X-29 Y45 I-29 J0 N06 G02 X-50 Y20 I-25 J0
N07 G02 X-50 Y24 I-21 J0 N07 G01 X-50 Y0
N08 G01 X-54 Y-24 N08 G01 X0 Y0
N09 G01 X-54 Y-4 N09 G00X100 Y100 G40
N10 G01 X0 Y-4 N10 M30;
Tool Radius Compensation
G41 Radius Compensation (left)
G40 Cancel Compensation
G42 radius Compensation (right)
Example:
Profile depth
= 2mm
85
O0002 N040 G03 X2 Y8 R6;
N045 G01 X0 Y10;
N005 G21 G17 M08 G90; N050 G00 Z10;
N010 M03 S500; N055 G00 X0 Y0;
N015 G00 X0 Y0; N060 G11;
N020 G00 X10; N065 G25 N020.055;
N025 G00 Z2; N070 G00 X100 Y100 G10 M05
N030 G01 Z-2; M09;
N035 G01 X8 Y2; N075 M30;
Shifting origin (G92)
Command format:
G92 X__ Y__ ; Where: X and Y
values are positions after
shifting.
Command function: It is used
to temporarily shift the origin
to the reference point
86
specified.
Example:
O0004 N055 Y0 ;
N005 G21 G17 M08 G90 ; N060 G00 Z10 ;
Example:
88
Cont’d…
O0007
N055 G00 Z10;
N005 G21 G17 M08 G90;
N060 G00 X0 Y0;
N010 M03 S500;
N065 G72 K2.0;
N015 G00 X0 Y0;
N070 G25 N020.050;
N020 G00 Y25;
N075 G00 Z10;
N025 G01 Z-2;
N080 G00 X0 Y0;
N030 X-25;
N085 G72 K3.0;
N035 Y-25;
N090 G25 N020.050;
N040 X25;
N095 G00 Z10;
N045 Y25;
N100 G00 X0 Y0;
N050 X0;
N095 G72 K1.0;
N105 M30;
89
Summary of G Codes
G00 Rapid linear movement
G01 Linear feed movement
G02 Circular movement (CW)
G03 Circular movement (CCW)
G70 Inch units
G71 Metric units
G90 absolute dimension
G91 incremental dimension
G94 Feed per minute
G95 Feed per revolution
G96 Constant surface speed
G97 Speed in RPM
G40 Cancel cutter compensation
G41 Cutter compensation (left)
G42 Cutter compensation (right)
Summary of M Codes