0% found this document useful (0 votes)
393 views

CNC Prog

Here is the CNC part program for drilling operation: N1 G21 (Metric programming) N5 T01 M06 (Tool call and change) N10 G00 G90 G54 X50 Y50 S1000 M03 (Rapid move to start position and spindle on) N15 G43 H01 Z-5 (Tool length compensation and move tool down) N20 G01 Z-15 F100 (Drill to depth at feed rate) N25 G00 Z5 (Rapid retract) N30 X75 Y50 (Move to next hole position) N35 G01 Z-15 F100 (Drill hole) N40 G00 Z5

Uploaded by

Poornima Joshi
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
393 views

CNC Prog

Here is the CNC part program for drilling operation: N1 G21 (Metric programming) N5 T01 M06 (Tool call and change) N10 G00 G90 G54 X50 Y50 S1000 M03 (Rapid move to start position and spindle on) N15 G43 H01 Z-5 (Tool length compensation and move tool down) N20 G01 Z-15 F100 (Drill to depth at feed rate) N25 G00 Z5 (Rapid retract) N30 X75 Y50 (Move to next hole position) N35 G01 Z-15 F100 (Drill hole) N40 G00 Z5

Uploaded by

Poornima Joshi
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 38

CNC PROGRAMMING

CO-ORDINATE SYSTEMS IN CNC


WORD ADDRESS FORMAT
Each line of program == 1 block

Each block is composed of several instructions, or (words)

Sequence and format of words:

N3 G2 X+1.4 Y+1.4 Z+1.4 I1.4 J1.4 K1.4 F3.2 S4 T4 M2

destination feed rate


sequence coordinates tool
no dist to
center of circle spindle speed
preparatory function
miscellaneous function
STRUCTURE OF CNC PROGRAM
CNC CODES
 The most common codes used when programming CNC machines tools
are G-codes (preparatory functions), and M codes (miscellaneous
functions).
 Other codes such as F, S, D, and T are used for machine functions such as
feed, speed, cutter diameter offset, tool number, etc.
 G-codes are sometimes called cycle codes because they refer to some
action occurring on the X, Y, and/or Z axis of a machine tool,
 The G-codes are grouped into categories such as Group 01, containing
codes G00, G01, G02, G03. which cause some movement of the machine
table or head.
 Group 03 includes either absolute or incremental programming, while
Group 09 deals with canned cycles.
 A G00 code rapidly positions the cutting tool while it is above the work
piece from one point to another point on a job. During the rapid traverse
movement, either the X or Y axis can be moved individually or both axes
can be moved at the same time. The rate of rapid travel varies from
machine to machine
CODE TYPES
 Sequence Number (N-Codes)
This is an identification number for each block of instructions and increases
sequentially through the program.
 Preparatory Function (G-Codes)
The G-codes are the codes that position the tool and do the actual work These
codes are largely standardized and can be seen in the provided G-code table.
Many of the preparatory functions can indicate canned cycles.
 Co- ordinate Codes
These indicate the co-ordinates for the tool movement. Four to five axis
machines can have the following axes

Cartesian Co-ordinates Angular positions for Circular Interpolation


the Cartesian axes about Cartesian axes
X A I
Y B J
Z C K
Feed rate (F-code)
This specifies the feed rate for the operation. The units
may be mm per minute or mm per revolution (indicated by
the G-code used), with the decimal point implied at a fixed
position from the right.
Spindle speed (s-code)
This specifies the spindle speed to be used for the
operation.
Tool Number
This indicates to the controller which tool is to be used for
the operation. In case of tool adaptors with multiple tool
slots, the machine just switches to the next tool without
removing the earlier one form the adaptor.
G – CODES (FANUC MACHINE CONTROL)
G CODE FUNCTION
G00 Positioning (Rapid traverse)
G01 Linear Interpolation (Cutting feed)
G02 Circular interpolation /Helical cutting CW
G03 Circular interpolation/Helical cutting CCW
G04 Dwell Time
G17 XY plane selection
G18 ZX plane selection
G19 YZ plane selection
G20- 21 Input in inch and mm respectively.
G28 Return to reference point
G40 Cutter compensation cancel
G41 Cutter compensation left
G42 Cutter compensation right
G43 Tool length compensation + direction
G44 Tool length compensation – direction
G53 Machine coordinates system selection
G54 - 59 Work co-ordinate system 1 -6 selection
G71 Stock removal Canned Cycle
G73 Pattern Repeating Canned Cycle
G76 Thread Cutting Canned Cycle
G78 Grooving Cycle Canned Cycle
G80
G81 Drilling cycle, spot boring
G82 Drilling cycle, counter boring
G83 Peck drilling cycle
G90 Absolute command
G91 Incremental command
G92 Programming of absolute zero point
G94/98 Feed per minute
G95/99 Feed per rotation
G96 Constant surface speed control
G97 Constant surface speed controls cancel
G98 Return to initial point in canned cycle
G99 Return to R point in canned cycle
MISCELLANEOUS CODE (M-CODE)
CODE FUNCTION
M00 Program stop, spindle and coolant off
M01 Optional programmable stop
M02 End of program-often interchangeable with M30
M03 Spindle on CW
M04 Spindle on CCW
M05 Spindle stop
M06 Tool change
M07 Coolant supply No. 1 on
M08 Coolant supply No. 2 on
M09 Coolant off
M10 Clamp
M11 Unclamp
M13 Spindle on, CW + Coolant on
M14 Spindle on, CCW + Coolant on
M 20 – 29 Unassigned
M30 Program stops at end of tape+ tape rewind
M31 Interlock by-pass
M40-M45 Gear Changes; otherwise unassigned
M90 Reserved for user
M99 (Subroutine call) Reserved for user
The G01, G02, and G03 codes move the axes at a controlled feed
rate.
• G01 is used for straight-line movement (linear interpolation).
• G02 (clockwise) and G03 (counterclockwise) are used for arcs
and circles (circular interpolation).
COORDINATE SYSTEM FOR A CNC MILL

Zero and reference points on CNC machines


M – zero point of the machine
This is the beginning point of the coordinate system of the machine
work area. It is a fixed structure (usually the intersection of the main
spindle axis and workpiece mounting plane) and can`t be changed. It's
an absolute beginning of the coordinates.
R – reference point of the machine
It is a place on the machine (usually in the working space of the
machine), in the maximum possible distance from the zero point of the
machine, due to end switches in each axis. Only after moving the
reference point relative to the point M, machine "knows where it is”.
Distance from reference point and the zero point is stored in the
machine table of the machine constants. Without moving the reference
point R, machine can’t work in absolute coordinates input.

W – zero point of the workpiece


It is the beginning of the workpiece coordinate system. The position
chosen freely by the programmer and can be changed during the
program. Zero point is usually chosen in the axis of symmetry and at the
upper surface of the workpiece (semi finished).
REFERENCE POINT AND RETURN
G28 Return To Reference Point
The G28 code is used to return to the machine zero position on
all axes. If an X, Y, Z, or A axis is on the same block and specifies a
location, only those axes will move and return to the machines’
zero reference point and the movement to the machines‘ zero
reference point will be through that specified location.
Format: G28 X0 Y0 Z0;
Setting work co-ordinate system (G54 - G59)
G54 Work co-ordinate system 1 selection
G55 Work co-ordinate system 2 selection
G56 Work co-ordinate system 3 selection
G57 Work co-ordinate system 4 selection
G58 Work co-ordinate system 5 selection
G59 Work co-ordinate system 6 selection

G54 X_ Y_ Z_;
G00 Rapid traverse
When the tool being positioned at a point preparatory to a cutting
motion, to save time it is moved along a straight line at Rapid
traverse, at a fixed traverse rate which is pre-programmed into the
machine's control system. Typical rapid traverse rates are 10 to 25 m
/min., but can be as high as 80 m/min.
Format
N_ G00 X__ Y__Z__
G01 Linear interpolation (feed traverse)
The tool moves along a straight line in one or two axis
simultaneously at a programmed linear speed, the feed rate.
Format
N__ G01 X__ Y__Z__ F__
G02/03 Circular interpolation
MILLING
%
O0001
N1 G21
N5 G17 G94 G40 G80 G90 T01
N10 M06
N15 G00 G90 G54 X29 Y28 S1000 M03
N20 G43 Z2.5 H01 M08
N21 G00 Z0
N25 G01 Z-4 F125
N26 X 85 Y 124 F200
N30 G00 Z2.5
N40 X29 Y124
N50 G01 Z-4 F125 N80 X 145.5 Y28
N60 X85 Y28 N90 G01 Z-4 F125
N70 G00 Z2.5 N100 Y76
N110 X174 Y124
N120 G00 Z2.5
N130 X117 Y124
N131 G01 Z-4 F125
N140 X145.5 Y 76
N150 G00 Z2.5 M09
N160 G28 X0 Y0 Z2.5 M05
N170 M30
Write a manual part program for Slotting operation for the component
as shown in drawing and execute.

%
O1000
N1 G21
N5 G00 G17 G94 G40 G80 T01
N10 M06
N15 G90 G54 G00 X25 Y75 S1000 M03
N20 G43 Z10 H01 M08
N21 Z0
N25 G01 Z-5 F0.2
N30 Y25
N35 X75
N40 Y75
N45 G00 Z10 M09
N50 G28 X0 Y0 Z10 M05
N55 M30
Write a manual part program for Drilling operation for the component as shown in
drawing
%
Material – Mild Steel,
O1002
Operation - Drilling
N1 G21
Billet size – 60 x 60 x 30mm
N5 G28 X0 Y0 Z0
Tool – Slot drill Φ 10 mm
N10 T01 M06
N15 M03 S100
N20 G00 X15 Y15 Z5 M08
N25 G01 Z-10 F0.2
N30 G00 Z5
N35 G00 X15 Y45
N40 G01 Z-10 F0.2
N45 G00 Z5
N50 G00 X45 Y45
N55 G01 Z-10 F0.2
N60 G00 Z5
N65 G00 X45 Y15
N70 G01 Z-10 F0.2
N75 G00 Z5
N80 G28 X0 Y0 5
N85 M05 M09
N90 M30
Drilling cycle - G81
Parameters in cycle

1. Rapid to safe position above hole.


2. Feed to bottom of hole.
3. Rapid to safe height above hole.
Format
G81 X_ Y_ Z_ R_ F_
X, Y = hole position
Z = Hole depth
R = Initial safe position
F = Feed rate

N1 G21
N2 G17 G80 G40
N3 G90 G54 G00 X20.0 Y25.0 M03 S2000 T01
N4 M06
N5 G43 Z25 H01 M08
N6 G99 G81 Z-22.0 R2.0 F250.0
N7 X75.0
N8 Y60.0
N9 X20.0
N10 G80 Z25
N11 G28 X0 Y0 Z 25
N12 M05 M09
N13 M30
N1 G21
N2 G28 X0 Y0 Z0
N3 G90 G17 G94 G80 G40 T01
N4 M06
N5 G00 X0 Y0 Z0 M03 S2000
N6 G43 Z25 H01 M08
N7 G01 Z-10 F380.0
N8 X0 Y0
N9 X136.0
N10 Y71.0
N11 G03 X121.0 Y86.0 R15.0
N12 G01 X 15.0
N13 G03 X0 Y71.0 R15.0
N14 G01 Y-10.0
N15 G00 X-50.0 Y-15.0 M05 M09
N16 M30
N1 G21
N2 G28 X0 Y0 Z0
N3 G90 G17 G94 G80 G40 T01
N4 M06
N5 G00 X0 Y0 Z10 M03 S2000
N6 G43 Z25 H01 M08
N7G01 G42 D01 X0 Y0 Z-10 F380.0
N8 X0 Y0
N9 X120.0
N10 Y55.0
N12 G03 X105.0 Y70.0 R15.0
N14 G01 X 15.0
N16 G03 X0 Y55.0 R15.0
N18 G01 Y-10.0
N20 G40 X-50.0 Y-15.0
N10 M06 T01
N20 G90 G00 X10 Y30 Z12 S1000 M03
N30 G99 G81 X10 Y30 Z-17 R2 F75 (Hole 1)
N40 Y10 (Hole 2)
N50 X30 (Hole 3)
N60 Y30 (Hole 4)
N70 G98 X90 (Hole 5)
N80 G99 Y10 (Hole 6)
N90 X110 (Hole 7)
N100 G98 Y30 (Hole 8)
N110 G91 G80 G28 X0 Y0 Z0 M05
N120 M06 T02
N130 G90 G00 X60 Y28 Z12 S750 M03
N140 G99 G83 X60 Y28 Z-17 Q6 R2 F60 (Hole 9)
N150 G98 Y12 (Hole 10)
N160 G91 G80 G28 X0 Y0 Z0 M05
N170 M30
COORDINATE SYSTEM FOR A CNC LATHE
ZERO POINTS AND REFERENCE POINTS
All CNC machine tool traverses are controlled by coordinating systems.
Their accurate position within the machine tool is established by
“ZERO POINTS”.
G00 – RAPID POSITIONING
G01 – LINEAR INTERPOLATION
CIRCULAR INTERPOLATION G02 & G03
N1 G28 U0 W0
N2 G21
N3 T0101 40 30
N4 M06
N5 M03 S2000 M08
30
N6 G00 X40 Z2
60
N7 G01 X 37 F0.2
N8 Z-30
N9 G00 X40 Z2
N10 G01 X 34
N11 Z-30
N12 G00 X40 Z2
N13 G01 X 31
N14 Z-30
N15 G00 X40 Z2
N16G01 X 30
N17 Z-30
N18 G00 X40 Z2 M05 M09
N19 G28 U0 W0
N20 M30
Turning cycle – G71
This cycle generates a part shape from a cylindrical raw material, with cuts along
the axis. The cycle definition has the part shape, depth of cut, finish allowance and
couple of other parameters.
Format
G71 U(d)_ R_
G71 P(s)_ Q(e)_ U(u)_ W_ F_
Ns _ _ _ _
_______
_______
Ne_ _ _ _
U(d) = Depth of cut, radius value
R = Retract amount, radius value
P = Number of the first block of the shape
Q = Number of the last block of the shape
U(u) = Finishing allowance in X, diameter value
W = Finishing allowance in Z
F = Feed rate
The blocks after the second G71 block define the part contour A to B. Parameter P
has the number of the first block Ns and Q has the last block Ne.
O0011
N10 G28 U0 W0
N20 G21
N30 T0101
N40 M06
N50 M03 S2000 M08
N55 G00 X50.0 Z2.0
N56 G71 U 1.5 R 2
N58 G71 P60 Q70 U 0.5 W 0 .2 F0.2
N60 G00 X20.0
N65 G01 Z0.0
N70 G01 X20.0 Z-10.0
N70 G01 X40.0 Z-15.0
N78 G00 X50 .0 Z2.0
N80 G28 U0 W0
N82 T0202
N83 M06
N84 G00 X50.0 Z2.0 M03 S2500
N86 G70 P60 Q70 F0.15
N88 G00 X50.0 Z2.0 M05 M09
N90 G28 U0 W0
N91 M30
%
O0002
N10 G28 U0 W0
N20 G21
N30 T0101
N40 M06
N50 M03 S200 M08
N60 G00 X50.0 Z2.0
N70 G71 U 1.5 R 2
N75 G71 P78 Q91 U 0.5 W 0 .2 F0.2
N78 G00 X15
N80 G01 Z0
N81 G01 X15.0 Z-5.0
N85 G02 X25.0 Z-10.0 R5.0
N90 G03 X39.0 Z-17.0 R7.0
N91 G01 X39 Z-23
N100 G00 X50 Z2 M05 M09
N110 G28 U0 W0
N120 M30
N1 G28 U0 W0
N2 G21
N3 T0101 M06
N4 M03 S1000 M08
N10 G00 X200.0 Z100.0 :
N11 G00 X160.0 Z0.0 :
N12 G71 U7.0 R1.0 :
N13 G71 P14 Q21 U4.0 W2.0 F0.3 S550 :
N14 G00 X40.0 :
N15 G01 W-30.0 F0.15 :
N16 X60.0 W-30.0 :
N17 W-20.0 :
N18 X100.0 W-10.0 :
N19 W-20.0 :
N20 X140.0 W-20.0 :
N21 G00 X40 Z0 :
N22 G70 P14 Q21 :
N23 G00 X200.0 Z100.0 M05 M09 :
N25 G28 U0 W0
N26 M30 :
The component to be machined is shown in figure 2. The outer profile needs to be machined
using a slot drill of ɸ16 mm. Write a CNC program using G and M code

You might also like