CNC Part Programming
CNC Part Programming
Manufacturing
NC/CNC Machines
Axis designation for each type of machine tool is suggested in the EIA
(Electronic Industries Association) RS 274-B standard. This conforms to
ISO Recommendations R831. The nomenclature of the three main
axes (X, Y AND Z) is based on the “Left hand rule”. The thumb
indicates the orientation of the X-axis; the index finger indicates the Y-
Axis, and the middle finger points in the direction of the Z-axis
Motion and coordinate system for NC machine
Z-axis: Always aligned with the spindle that imparts cutting power. This
spindle might rotate the work-piece as in a lathe, it might rotate a tool as in a
milling machine. It is perpendicular to work-holding surface if there is no such
spindle. Positive motion in z axis tends to increase the separation between the
work-piece and the tool
Principal: X,Y,Z
Second: U,V,W
Tertiary: P,Q,R
C-axis
A-axis
Programming Format
O - Program number (Used for program identification)
N - Sequence number (Used for line identification)
G - Preparatory function
X - X axis designation
Y - Y axis designation
Z - Z axis designation
R - Radius designation
F – Feed rate designation
S - Spindle speed designation
H - Tool length offset designation
D - Tool radius offset designation
T - Tool Designation
M - Miscellaneous function
List of G-codes
G-code Function
G00 Positioning rapid traverse
G01 Linear interpolation (feed)
G02 Circular interpolation CW
G03 Circular interpolation CCW
G04 Dwell
G20 or G70 Inch unit
G21 or G71 Metric unit
G28 Automatic zero return or home position of tool
G40 Tool nose radius compensation cancel
G41 Tool nose radius compensation left
G42 Tool nose radius compensation right
G43 Tool length compensation (positive) ON
G44 Tool length compensation (Negative) ON
G49 Tool length compensation OFF
G80 Canned cycle cancel
G81 Drilling cycle
G82 Drilling cycle with dwell
G83 Peck drilling cycle / deep drill
G84 Tapping cycle
G85 Boring / Reaming cycle
G86 Boring cycle
G87 Back boring cycle
G90 Absolute command
G91 Incremental command
G94 Feed per minute
G95 Feed per revolution
G98 Return to initial point in canned cycle
G99 Return to R point in canned cycle
List of M codes
M codes vary from machine to machine depending on the functions
available on it. They are decided by the manufacturer of the machine. The
M codes listed below are the common ones.
M-codes Function
M00 Program stop
M01 Optional program stop
M02 Program end
M03 Spindle ON clock wise (CW)
M04 Spindle ON counter clock wise (CCW)
M05 Spindle stop
M06 Tool change
M07 Mist coolant ON (coolant 1 ON)
M08 Flood coolant ON (coolant 2 ON)
M09 Coolant OFF
M30 End of program, Reset to start
Programming Format
Arc center
The arc center is specified by addresses I, J and K. I, J and K are the X, Y and Z
co-ordinates of the arc center with reference to the arc start point.
Block format
N__ G02 X__Y__ Z__ R__ F__
N__ G03 X__Y__ Z__ R__ F__
DWELL COMMAND
G04 Dwell
Format : G04X_; or G04U_; or G04P_;
X: Specified time(decimal point is permitted)
F: Specified time(decimal point is permitted)
P: Specified time(decimal point is unpermitted)
Explanation : G04 command dwell. The execution of the next block
is delayed by the specified time, specify dwell for each rotation in
feed per rotation mode. Dwell is use to stop feed for specified
period of time.
Tool path without cutter compensation Tool path with cutter compensation
Cutter radius compensation
G43, G44, G49 - Tool Length Compensation
• Different tools of different lengths are used in machining any part. The lengths of the
tools are not considered in the part program. They are entered in the machine’s
memory, and are considered automatically for each motion in the program
depending on the tool that is being used. The tool lengths in the Z direction are
called the Tool length offsets.
Codes Function
G43 Make the value of the cutter’s offset add to the value of Z coordinates of the program
G44 Make the value of the cutter’s offset subtract the value of Z coordinates of the Program
G49 Cancel the offset of the length of the cutter
Format: - G43 Z_ H_ ; G44 Z_ H_ ; G49 Z_ ;
Plane Selection
Circular milling operations (such as G02 and G03) must be aligned on a plane defined by two
axes of motion. This plane is selected by calling one of these functions.
G54 X_ Y_ Z_ ;