NC Part Programming
NC Part Programming
Coordinate System
Z AXIS
• workpiece-rotating machine:
Z is parallel to the spindle Z
• tool-rotating machine:
Z is parallel to the tool axis
Z
Z
Coordinate System
X AXIS
workpiece-rotating machine:
X
X is the direction of tool movement Z
horizontal milling machine :
Y Y
Basic Programming of a CNC Milling Machine
Machine coordinate system
• N, G, X, Y, Z, A, B, C, I, J, K, F, S, T, M
M CODES
modal groups
NC Words
N, G, X, Y , Z, A, B, C, I, J, K, R, F, S, T, M
T: tool number
NC Words
N, G, X, Y, Z, A, B, C, I, J, K, R, F, S, T, M
• X, Y, Z, A, B, C:
• Unit selection:
– G70 (inch), G71(metric)
• Coordinates selection:
– G90(absolute), G91(incremental)
• Working plane selection:
– G17(X-Y), G18(Z-X), G19(Y-Z)
Rapid traverse: G00
• G00:
– to make the machine move at maximum speed.
– It is used for positioning motion.
G90 G00 X20.0 Y10.0
End
G90:
(20,10)
absolute
coordinates (10,10)
Start (0,0
)
Linear interpolation: G01
• G01:
– linear interpolation at feed speed.
G91 G01 X200.0 Y100.0 F200.0
Y
G91: End
incremental 100.0
coordinates
Start 200.0 X
Circular interpolation: G02, G03
• G02, G03:
– For circular interpolation, the tool destination and the circle
center are programmed in one block
– G02 is clockwise interpolation, G03 is counterclockwise
interpolation
G 02 R
G17 X __ Y __ F __;
G 03 I __ J __
G 02 R
G18 X __ Z __ F __;
G 03 I __ K __
G 02 R
G19 Y __ Z __ F __;
G 03 J __ K __
End point Circle center, radius
Return to Machine Zero: G28
G91: incremental
G28 coordinates
• The machine passes by the specified point, and then move
to the machine zero.
G91 G28 X_, Y_, Z_
• X,Y,Z are the coordinate of specified point that is saved in memory of
machine.
• Usually this instruction is used in the beginning and end of program.
Machine
Zero
Specified
A
point
M code: M00, M01
M00 and M01 both stop the machine in the middle of a program.
N10 G41 D01 M03 S1000 Begin compensation ( left ) , set feed
and speed, spindle on ( CW )
N20 G00 X6.000 Y6.000Z1.000 Move to lower left corner
N50 G01 X8.000 M96 Cut to upper right corner with external curve
N60 G01 Y6.000 M95 Cut to lower right corner with external curve
N70 G01 X6.000 M96 Cut to lower left corner with external curve
30
(0,0,0)
10
N01 G90 G21 G94 ; absolute mode, input in mm, feed mm/min
20 10 X
40
N01 G90 G21 G94 M03 S2000
N02 G91G28 X0 Y0 Z0
N11 M30
CANNED CYCLE FUNCTIONS
N….G…G….X…Y…Z…R…Q…P….F….K….
P= the dwell time for the drill while rotating at the bottom of
the hole (not used for every drilling cycle)
dwell is in seconds for the purpose of complete
removal of excess material
F= feed rate
K= number of repeats
G81- canned cycle for spot drilling