Cnc Part Programming
Cnc Part Programming
CNC PART
Co:-Develop part program for CNC Turning, Milling
PROGRAMMING
and verify on simulation software.
keyboards,
diskette drivers,
MACHINE CONTROL UNIT
The machine control unit (MCU) is the heart of a CNC system.
Block Format:
1. Fixed sequential format
2. Tab sequential format
3. Word address format
EXAMPLE:
Assume that a drilling operation is to be
programmed as:
1. The tool is positioned at (25.4,12.5,0) by a
rapid movement.
2. The tool is then advanced -10 mm in the z
direction at a feed rate of 500 mm/min., with the
flood coolant on.
3.The is then retracted back 10 mm at the rapid
feed rate, and the coolant is turned off.
1. Fixed sequential format
0050 00 +0025400 +0012500 +0000000 0000 00
0060 01 +0025400 +0012500 -0010000 0500 08
0070 00 +0025400 +0012500 +0000000 0000 09
Sample Block
Example CNC
Program Each instruction to the machine
N5 G90 G20
N10 M06 T3 consists of a letter followed by a
N15 M03 S1250 number.
N20 G00 X1 Y1
N25 Z0.1 Each letter is associated with a
N30 G01 Z-0.125 F5 specific type of action or piece of
N35 X3 Y2 F10 information needed by the machine.
N40 G00 Z1
N45 X0 Y0
Letters used in Codes
N50 M05 N,G,X,Y,Z,A,B,C,I,J,K,F,S,T,R,M
N55 M30
G Codes
G00 Rapid traverse G40 Cutter compensation –
cancel
G01 Linear interpolation
G41 Cutter compensation – left
G02 Circular
interpolation, CW G42 Cutter compensation- right
G03 Circular G70 Inch format
interpolation, CCW
G71 Metric format
G04 Dwell
G74 Full-circle programming
G08 Acceleration off
G09 Deceleration G75 Full-circle programming
G17 X-Y Plane on
G18 Z-X Plane G80 Fixed-cycle cancel
G19 Y-Z Plane G81-G89 Fixed cycles
G20 Inch Units (G70) G90 Absolute dimensions
G21 Metric Units (G71) G91 Incremental dimensions
M Codes
M00 Program stop
M01 Optional program stop
M02 Program end
M03 Spindle on clockwise
M04 Spindle on counterclockwise
M05 Spindle stop
M06 Tool change
M08 Coolant on
M09 Coolant off
M10 Clamps on
M11 Clamps off
M30 Program stop, reset to start
N Codes
25
B C
20
15
5 10 15 20 25 30
G01 Linear Interpolation
N10 G00 X1 Z1
N15 Z0.1
N20 G01 Z-0.125 F5
N25 X2 Z2 F10
X
Z
G02 Circular Interpolation
15
J=15
10 B
C
5
5 10 15 20 25 30
Canned Cycles
The sequence of some machining operations is
may be the same for any part and for any
machine. For example, drilling a hole involves
the following steps:
%
:1002
N5 G90 G20
N10 M06 T1
N15 M03 S1200
N20 G00 X0.125 Y0.125
N30 Z0.125
N35 G01 Z-0.125 F5
N40 X3.875
N45 Y4.125
N50 X0.125
N55 Y0.125
Second pass:
conventional mill to
a depth of 0.25
around edge profile.
N35 Z-0.250
N40 X3.875
N45 Y4.125
N50 X0.125
N55 Y0.125
N60 Z0.125
Third pass:
conventional mill to a
depth of 0.125
around pocket profile.
N100 Y2.125
N105 X2.625
N110 Z0.125
N115 G00 X-5 Y-5 Z5
N120 M05
N125 M30
Advanced features:
Program structure
Every program consists of:
1. Program Start
The program start is the program number.
The program number begins with
character/letter O.
2. Program Contents
NC blocks
3. Program End
M30 for a main program
M17 for a sub-program
Program Numbers
O6999
.
.
.
O0256
O0255
.
.
.
O0000
• N is the address
• Block numbers from
N0000 to
• N9999
• A block consists of
number and words
• Words are contents of a
block
• Block numbers are
selected in the jumps of
ten for the purpose of
insertion
Example:
P0 N… …
P0 P1 N… G01
X40. Z25. F…
P1 P2 N… G01
X60. Z-40. F…
P2 N… …
Absolute coordinate
system
Example:
P0 N… …
P0 P1 N… G01 U5.
W-25. F…
P1 P2 N… G01
X10. Z-15. F…
P2 N… …
Incremental coordinate
system
Mixed Programming
Example:
P0 N… …
P0 P1 N… G01 U5.
W-25. F…
P1 P2 N… G01
X60. Z-15. F…
P2 N… …
Mixed coordinate
system
Reference Points
M = Machine zero
point.
(unchangeable ref.
Point determined by
machine
manufacturer)
N = Tool mounting
reference point
W = Work piece zero
point. (can be freely
determined by the
programmer and can
be moved within
program CNC Prg. Basics
56
G & M Commands
Incremental dimensions
of the target point
coordinates:
N030 G91
N040 G00 X-10,5 Z-31
G90:
G01 X… Z…
N030 G00 X39
Z2
N040 G01 X39
Z0
N050 G90
N060 G01 X48 Z-
37
G91:
N030 G00 X39
P0: tool
Z2
position
N040 G01 X39
Z0
N050
CNC Prg. Basics G91
N060 G01 X4.5
61
G90
G01 X+140 Z-
90
Target point
abs.
G91
G01 X+40 Z-60
PO: Start Point Target point
P1: Target Point incr.