cnc programming
cnc programming
1
Applications Engineering ASIA INDIA
Understanding of Machine Axes
Y+
X- X+
From Drawing Y-
2
Applications Engineering ASIA INDIA
Address in Program
What is ‘address’
Address is the use of alphabet characters
to regulate the functions of a machine tool.
The commands are shown on next slide.
3
Applications Engineering ASIA INDIA
Sample of Address
Function Address Meaning
Program number O O1000 ( test )
Sequence number N N10, N20, N30
Preparatory Function G G00, G01, command machine
Dimensional words X,Y,Z Axes travel command
R Arc radius
I, J, K Arc center coordinates
Feed rate F F500 ( mm/min )
Spindle function S S1000 ( rpm )
Tool function T T10 ( Tool number 10 )
Miscellaneous Function M M3, M5, on/off control m/c
Offset number H,D H1 ( tool length), D32 ( radius )
Dwell P,X Dwelling time
Program number command P Sub program number
4
Applications Engineering ASIA INDIA
Program number O & Comment
Function of program number O
%
O1000 ( MAKINO )
• O xxxx follow by four digits number
• ( ------- ) comment or message
5
Applications Engineering ASIA INDIA
Sequence Number N
Function of sequence number Nxxxx
• Use number from ( 1-99999 or 1-9999 )
• Can be used for program restart
• Use at changes in the process for easy access
6
Applications Engineering ASIA INDIA
Movement Command & Setting Units
To move machine axis command
• Axes are X, Y, Z, A, B, C, U, V, W
• Providing a decimal point
X50. • X 50 = 0.05 mm
X50.0 • X 1.23456 = X1.235
X50.00
• X1.23456789 = alarm more
X50.000
X50000 than 9 digits
7
Applications Engineering ASIA INDIA
Absolute G90
Function G90
• The destination of movement is specified with the
coordinate value regardless the current position.
Y+
60
Y+
10 10
X+ X+
10 60 10
G90 X60.0 Y10.0 ; G90 X10.0 Y60.0 ;
8
Applications Engineering ASIA INDIA
Incremental G91
Function G91
• The movement is specified by the direction and the
incremental value to the destination referring the
current position. Y+
60
Y+
10 10
X+ X+
10 60 10
G91 X50.0 ; G91 Y50.0 ;
9
Applications Engineering ASIA INDIA
Absolute G90 & Incremental G91
For dimensional command use G90 or G91
• Hereafter, G90 and G91 are abbreviated as ABS & INC
respectively in the text..
10
Applications Engineering ASIA INDIA
Information of ABS & INC
Which is more convenient ?
ABS is better
• when each hole position is
indicated from a reference
point, programming is made
easy by setting as origin.
INC is better
• when the pitch between the
position of each hole is
indicated.
• when position with the same
pitch is repeated.
11
Applications Engineering ASIA INDIA
G CODES
G00 : Positioning in rapid
G01 : Linear positioning in feed
G02 : Circular Interpolation CW
G03 : Circular Interpolation CCW
G04 : Dwell
G10 : Data Setting
G17 : XY Plane Selection
G18 : ZX Plane Selection
G19 : YZ Plane Selection
G20 : Input In Inch
G21 : Input In Metric
G28 : Return To Reference Position
G30 : 2nd, 3rd and 4th Reference Position Return
G31 : Skip Function
G40 : Cutter Compensation Cancel
G41 : Cutter Compensation Left
G42 : Cutter Compensation Right
12
Applications Engineering ASIA INDIA
G43 : Tool Length Compensation + Direction
G44 : Tool Length Compensation - Direction
G53 : Setting Machine Coordinate System Selection
G54 : Work Piece Coordinate System 1
G55 : Work Piece Coordinate System 2
G56 : Work Piece Coordinate System 3
G57 : Work Piece Coordinate System 4
G58 : Work Piece Coordinate System 5
G59 : Work Piece Coordinate System 6
G65 : Macro Call
G73 : Peck Drilling Cycle
G80 : Canned Cycle Cancellation
G81 : Drilling Cycle
G82 : Counter Boring Cycle
G83 : Peck Drilling Cycle
G84 : Tapping Cycle
G85 : Boring Cycle
G86 : Fine Boring Cycle
13
Applications Engineering ASIA INDIA
G90 : Absolute Command
G91 : Increment Command
G94 : Feed Per Minute
G95 : Feed Per Rotation
G98 : Return To Initial Point In Canned Cycle
G99 : Return To R Point In Canned Cycle
14
Applications Engineering ASIA INDIA
G CODES G CODES
FOR FOR
AXES CANNED
MOTION CYCLES
G CODES
G CODES G CODES
FOR FOE TOOL
REFERENCE COMPENSATION
15
Applications Engineering ASIA INDIA
G CODES FOR AXES MOVEMENTS
16
Applications Engineering ASIA INDIA
G CODES FOR REFERENCES
17
Applications Engineering ASIA INDIA
G CODES FOR TOOL COMPENSATION
18
Applications Engineering ASIA INDIA
G CODES FOR CANNED CYCLES
19
Applications Engineering ASIA INDIA
Miscellaneous Function M code
Address M and the follow numerals control on / off of machine
function. Such as the spindle rotation start or stop .
20
Applications Engineering ASIA INDIA
M05 Spindle rotation stop.
The main spindle stops rotating.
M08 Coolant on
Flood coolant is supplied.
21
Applications Engineering ASIA INDIA
Feed rate F & Spindle Speed S
Function F and S code
These are given according to the tools to be used
and the material of them, workpiece to be cut.
F01 1 mm/min
F10.0 10 mm/min
F1000 1000 mm/min
S10 10 revolutions per min ( rpm )
S1500 1500 revolutions per min.
S400 400 revolutions per min.
22
Applications Engineering ASIA INDIA
RPM & Feed Formula
Cutting Speed ( m/min ) * 318
RPM =
Diameter
23
Applications Engineering ASIA INDIA
Learning Activity
Calculation RPM & Feed
• Cutting Speed = 250 m/min
• Cutting Diameter = Ø 10 mm
• No. of tooth = 2
• Feed per tooth = 0.1
• Your answer is
24
Applications Engineering ASIA INDIA
Learning Activity
Calculation Cutting Speed & Feed per tooth
25
Applications Engineering ASIA INDIA
Rapid Traverse G00
Linear Interpolation G01
Rapid Traverse ( G00 )
• The cutter moves at a rapid traverse rate
with non-linear or linear interpolation.
• The rapid traverse rate depends on the
machine type.
26
Applications Engineering ASIA INDIA
Sample of Program
O1000 ( MAKINO )
N1 G90 G54 G00 X0 Y0 S1000 200
M03 ;
N2 G01 X0 Y-50.0 F100 ;
N3 X100.0 ;
100
N4 Y50.0 ;
N5 X-100.0 ;
N6 Y-50.0 ; Y+
N7 X0 ;
X- X+
N8 Y0 ;
N9 M30 ; Y-
27
Applications Engineering ASIA INDIA
Dwell G04
What is ‘dwell’
It is a function to delay the execution of the next block.
P ______
Programming format G04
X _______
28
Applications Engineering ASIA INDIA
Automatic Reference point return G28
Automatic reference point return is a function to return
each axis to its reference position automatically.
Example :-
• G91 G28 Z0 ; The tool moves rapidly to the reference point
of the Z axis ( machine zero point ).
• G28 is usually used under G91 & without axes motion ( X0, Y0 ).
• G28 causes rapid traverse regardless of the previous mode.
• Before specifying G28, the tool radius compensation should be
cancelled in advance.
29
Applications Engineering ASIA INDIA
Circle Interpolation G02 , G03
Circle Interpolation
• Commands G02, G03 are used to cut circle or
circular arcs. G02 is specified for CW circular motion.
G03 for CCW circular motion.
30
Applications Engineering ASIA INDIA
Dimension I & J
* Command I & J specify the distance from the start point of circle arc A
to the Center. I & J must be specified incrementally irrespective of ABS /
INC mode, adding plus or minus for the direction of I & J
* Dimensions I & J are the same data regardless of ABS or INC.
Y
B (end point of the arc)
Y
60
A (start point of the arc)
Start 40
center J
X 10
Center End 10 20 50 X J+
0,0 I
I- I+
ABS G90 G03 X20 Y60 I-40 J-30 F100 ; J-
INC G91 G03 X-30 Y20 I-40 J-30 F100 ;
31
Applications Engineering ASIA INDIA
Specifying radius of circle arc R
* The radius of circle arc can be directly specified by R instead of
specifying the center of circle arc by I, J & K.
* When the center angle of arc is 180 deg or more, the radius R
must be specified with negative (-) sign.
Y
Start
50
B (end point of the arc)
R
60 70
A (start point of the arc)
40
R30 20 End point
0,0 X 0,0 20 70
20 50
ABS G90 G03 X20 Y60 R30 F100 ABS G90 G02 X70 Y20 R-50 F100
INC G91 G03 X-30 Y20 R30 F100 INC G91 G02 X50 Y-50 R-50 F100
32
Applications Engineering ASIA INDIA
A complete circle
* With I, J & K a complete circle can be programmed by
using one block.
Y+ A
0
R4
B
J+
X+
I- I+
J-
33
Applications Engineering ASIA INDIA
Example G02 & G03
Y
O0001 (ABS);
R4
N6 G01 X-60.0; N2
0
N7 G00 X0 Y0; N7 N5
N8 M30; N6
(-60,-40) (0,-40)
34
Applications Engineering ASIA INDIA
Tool Radius Compensation G41,G42 & G40
Tool Radius Compensation, rules of G41, G42
• This
.
function is used for side cutting by end mill,
from rough, semi - finish to finishing cutting.
• G40 for Canceling G41,G42.
Follow the cutting feed direction G42
G42 G41
G41 Left G41
G42 Right
G41 G40
35
Applications Engineering ASIA INDIA
Programming Format G41,G42 & G40
G17 X_ Y_
G00 G42 D_ ;
G18 Z_ X_
G01 G41
Y_ Z_
G19
X_ Y_
G00
Canceling G40 Z_ X_
G01
Y_ Z_
36
Applications Engineering ASIA INDIA
Function of G41
G41 Tool radius offset compensation - Left
• The center of the tool is offset by
the amount referring to the
advance direction.
• G41 cause down cut.
37
Applications Engineering ASIA INDIA
Function of G42
G42 Tool radius offset compensation - Right
• the center
. of the tool is offset by
the amount referring to the
advance direction.
• G42 cause up cut.
38
Applications Engineering ASIA INDIA
Advantage of Tool Radius Compensation
Simplification of roughing to finishing program
• Any allowance can be obtained by modifying the tool
offset data actually used from the tool dimension in
spite of the same program . OFFSET
NO DATA NO DATA
H16 0.000 H25 0.000
Finishing H17 0.000 H26 0.000
H18 0.000 H27 0.000
H19 0.000 H28 0.000
Semi-Finishing Roughing C = A+B H20 0.000 H29 0.000
39
Applications Engineering ASIA INDIA
Sample of Program for G41, G42 & G40
OFFSET
O1000 (Ø20 ENDMILL ) ; NO DATA NO DATA
G90 G54 G00 X0 Y0 S1000 M03 ; H16 0.000 H25 0.000
H17 0.000 H26 0.000
G01 G41 X0 Y-50.0 D32 F100 ; H18 0.000 H27 0.000
X100.0 ; H19 0.000 H28 0.000
H20 0.000 H29 0.000
Y50.0 ; H21 0.000 H30 0.000
200
X-100.0 ; H22 0.000 H31 0.000
H23 0.000 H32 10.000
Y-50.0 ;
X0 ; ACTUAL POSITION [ RELATIVE ]
X 0.000 Y 0.000
G40 X0 Y0 ; 100 Z 0.000
40
Applications Engineering ASIA INDIA
Learning Activity
• If now we need to cut a hole is Ø20
OFFSET
- 0.250
• Your Answer for D32 = __________ . [OFFSET] [SETTING] [WORK]
42
Applications Engineering ASIA INDIA
Canned Cycle
What is a ‘canned cycle’ ?
• The canned cycle can also be called the ‘hole drilling
cycle’.
• Several popular machining cycles such as boring,drilling
and tapping are specified with a fixed format which is
shortened and performed easily.
43
Applications Engineering ASIA INDIA
Programming Format for Canned Cycle
G90 G98 G_ _ X_Y_R_Z_Q_F_P_L_ ;
G91 G99
44
Applications Engineering ASIA INDIA
Programming Format for Canned Cycle
G 98 : Initial level return
G 99 : R point level return
G __ : Cycle mode ( G81, G82, G83 )
G80 : Canned cycle cancellation
45
Applications Engineering ASIA INDIA
Overview of Canned cycles
Cycle feed Operation at the Retraction
G code ( - Z direction ) bottom of a hole ( + Z direction ) Application
High speed peck drilling
G73 Intermittent feed ---- Rapid traverse cycle
G74 Cutting feed Spindle CW Cutting feed Left hand tapping cycle
Fine boring cycle
G76 Cutting feed Spindle orientation Rapid traverse ( canned cycle II only )
G80 ---- ---- ---- Cancel
Drilling cycle, spot drilling
G81 Cutting feed ---- Rapid traverse cycle
Drilling cycle, counter
G82 Cutting feed Dwell Rapid traverse boring cycle
G83 Intermittent feed ---- Rapid traverse Peck drilling cycle
G84 Cutting feed Spindle CCW Cutting feed Tapping cycle
G85 Cutting feed ---- Cutting feed Boring cycle
G86 Cutting feed Spindle stop Rapid traverse Boring cycle
Manual / Boring cycle, back boring
G87 Cutting feed Spindle stop Rapid traverse cycle
Dwell Manual /
G88 Cutting feed Spindle stop Rapid traverse Boring cycle
G89 Cutting feed Dwell Cutting feed Boring cycle
46
Applications Engineering ASIA INDIA
Example of Program
G98 G81 G98 G82
FEED
RAPID
O Point R O Point R
O O Point Z O O Point Z
Dwell
47
Applications Engineering ASIA INDIA
Example of Program
G98 / G99 G81 X_ Y_ R_ Z_ F_ ;
O1000 ( CANNED CYCLE ) ;
G90 G54 G00 X0 Y0 ; 100 10
Y
S1000 M3 ;
Z100.0 ;
50 Z
G98 G81 X50.0 Y25.0 R5.0 Z-10.0 F100;
X-50.0 ;
Y-25.0 ; X
X50.0 ;
G80 ;
M30 ;
48
Applications Engineering ASIA INDIA
Difference between G73 & G83
G73 / G83 X_ Y_ R_ Z_ Q_ F_ L_ ;
G98 G73 G98 G83
FEED FEED
RAPID RAPID
O O
R Point R Point
Q Q O
d d
O O O O
Q Q O
d O O
d
O O
Q Q
O O Point Z O O Point Z
G73 - HIGH SPEED PECK DRILLING CYCLE G83 - PECK DRILLING CYCLE
49
Applications Engineering ASIA INDIA
G76 Fine Boring Cycle
G98 / G99 G76 X_ Y_ R_ Z_ Q_ F_ ;
Tool
Initial point
O O O
FEED
O Point R RAPID
OSS O
Point Z
Q
OSS - oriented spindle stop M19 Shift amount Q
50
Applications Engineering ASIA INDIA
Programming Example
G98 G84 X_ Y_ R_ Z_ P_ F_ ; G98 G86 X_ Y_ R_ Z_ F_ ;
G99 G99
FEED
RAPID
O O Point Z O O Point Z
Spindle CCW
Spindle stop
51
Applications Engineering ASIA INDIA
Programming Format M98 ,M99 & M30
52
Applications Engineering ASIA INDIA
Subprogram nesting up to 4 levels
Main program Sub program Sub program Sub program Sub program
M 30 M 99 M 99 M 99 M 99
53
Applications Engineering ASIA INDIA
Example of Subprogram
01001 (SUB PRO ) ;
Use F100 as feedrate G91 G00 Z-95.0 ;
50 ----- Rapid traverse G41 X40.0 Y20.0
___ Cutting feed D32;
G01 Z-15.0 F100;
Y30.0 ;
50 100 150
01000 ( MAIN PRO ); X-10.0;
G90 G54 G00 X0 Y0 ; X10.0 Y30.0 ;
S1000 M03 ; X40.0 ;
Z100.0 ; X10.0 Y-30.0 ;
X-10.0 ;
M98 P1001 ;
Y-20.0 ;
G90 G00 X80.0 ;
X-50.0 ;
M98 P1001 ;
G00 Z100.0 ;
G90 G00 X0 Y0 M05 ;
G40 X-30.0 Y-30.0 ;
M30;
M99 ;
54
Applications Engineering ASIA INDIA
Example of Subprogram under G90 mode
Y
55
Applications Engineering ASIA INDIA
56
Applications Engineering ASIA INDIA