Part Programming Manual PDF
Part Programming Manual PDF
I. INTRODUCTION 3
1. INTRODUCTION 4
2. PROGRAM STRUCTURE 7
3. PROGRAM BLOCKS 7
4. PROGRAM FORMAT 10
V. MISCELLANEOUS FUNCTIONS 61
1. CANNED CYCLES 65
2. DIRECT DIMENSION PROGRAMMING 75
2
PART PROGRAMMING MANUAL
Chapter 1
Introduction
3
PART PROGRAMMING MANUAL
1. INTRODUCTION
1.1 PROGRAM :
To machine a component on a CNC lathe, informations like co-ordinate values and other
technical data which indicate, how, a tool should be moved in relation to a work piece to
achieve a desired machining form, is to be given in the form of coded instructions to the
control unit. These informations are called a PART PROGRAM.
X+
Zero
Z- Z+
X-
4
PART PROGRAMMING MANUAL
Machine drawing Change the drawing in absolute dimension. That is, input
Machining co-ordinate
5
PART PROGRAMMING MANUAL
NC program
punching
Machine operation Measure the work and apply the compensation again if
required.
6
PART PROGRAMMING MANUAL
2. PROGRAM STRUCTURE :
Part program comprises of a string of blocks written one after the other. When writing a program,
a particular syntax is to be followed.
As per part program structure :
A. Program starts with program number.
B. Consists of series of blocks dimensional and non-dimensional data like feed, speed,
auxiliary functions etc.,
C. Program ends with program end code.
Character for program start, precedes the first block in the part program.
Character for main program start is given by O
To start program 1 O 0001
To start program 2 O 0002
Program start can also be called as program numbering. The program number is useful in
identification of a program and calling a program.
Similar to main program we have sub-routine program. Sub-routine program is also called
sub-program. A sub-program could contain a fixed sequence or frequently repeated
pattern.
Character for a sub-routine program start is also given by O
To start sub-program 1 O
To start sub-program 2 O
Character for program end is written in the last block of the part program.
Character for main program end is M02 or M30.
Character for sub-program end is M99
A sub-program can also call another sub-program upto two levels.
Sub-program call :
Example : M98 P .
3. PROGRAM BLOCKS :
Program blocks contain data required to execute an operation. It is possible to write the program
blocks with or without a sequence number. Sequence number is given at the block head. It need
not be consecutive. It is used for the convenience of the operator. Sequence number is of 4 digits.
Examples :
* N0005 G00X20.Z5. ; Program block written with block number.
G00X20.Z5. ; Program block written without block number.
All the blocks end with block end character ; or
If no block number is given or same block number is given to several blocks, then there cannot be
a defined program jump or block search.
7
PART PROGRAMMING MANUAL
4. WORD :
A program is made up a number of blocks. Similarly a block is made up a number of words.
A word consists of an address character and a string of digits (alphanumeric character).
An address character is normally an alphabet.
X,Z,S,F .. are all address characters.
The string of digits may be specified with or without a sign and with a decimal point.
The sign is written between the address letter and the string of digits. The positive sign may be
omitted.
Examples of WORD :
1. X-243.127
String of digits
Address character.
2. Z 242.127
8
PART PROGRAMMING MANUAL
9
PART PROGRAMMING MANUAL
5. BLOCK FORMAT :
The syntax followed for writing a program block should be a simple as possible. An example
given below shows the program syntax that can be followed.
Block example :
N.. G.. X.. Z.. F.. S.. T.. M.. ;
N0015G00X20.Z40.F0.3S500T1M03 ;
N - Address of block number
G - Preparatory function
X,Z - Axes address
F - Feed rate
S - Spindle speed
T - Tool number
M - Miscellaneous function
; - Block end character
A. BLOCK SKIP :
Program blocks which need not be executed during every program run can be skipped by
entering the slash character (/) in front of the sequence number with BLOCK SKIP
switch in ON position.
Example :
N0055 G00X50Z2 ;
/N0060 G01Z-2 ;
/N0065 X40 ;
/N0070 G00Z2 ;
/N0075 X50 ;
10
PART PROGRAMMING MANUAL
Chapter-2
Axes Co-Ordinate System
Methods of Dimensioning
Machine Co-Ordinate System
11
PART PROGRAMMING MANUAL
Before going further into programming it is necessary to know some fundamental details
regarding directions of tool movement, sign convention followed for directions of tool travel and
axes co-ordinate system, different methods of dimensioning, units of dimensioning system etc.,
1. CO-ORDINATE AXES :
The directions of movement in a machine tool are based on a co-ordinate system allocated
to the axes of motion of the slides.
As in the conventional lathe there is movement of slides in two directions along two axes,
one axis being parallel to the spindle axis and the other axis perpendicular to the spindle
axis.
The axis parallel to the spindle axis is called Z-axis. The axis perpendicular to the spindle
axis is called X-axis.
Since the machine co-ordinate system has two axes, X and Z, it is referred to as the X-Z
co-ordinate system.
Z+
MACHINE ORIGIN
MACHINE ORIGIN :
It is considered that the spindle nose front face is lying on X-axis and spindle axis as Z-
axis thus the intersecting point of the two axes is the machine origin.
12
PART PROGRAMMING MANUAL
2. DIRECTIONS OF MOVEMENT :
Consider that a tool is positioned in I quadrant of X-Z co-ordinate system.
Conventionally speaking,
Along Z-axis any movement towards the spindle is considered as movement in the
negative direction and any movement away from the spindle is considered as movement in
the positive direction.
Along X-axis any movement towards the operator is considered as movement in the
negative direction and any movement away from the operator is considered as movement
in the positive direction.
X+
X- X+
Z-
Z+
M Z+
OPERATOR
13
PART PROGRAMMING MANUAL
3. METHODS OF DIMENSIONING :
There are two methods of dimensioning,
a. Absolute system of dimensioning or fixed zero system of dimensioning
b. Incremental system of dimensioning or floating zero system of dimensioning
To represent a point P1 which is located at 3 divisions to the right of the origin along Z-
axis and 4 dimensioning above the origin along X-axis, it is written as P1(X4,Z3). The
positive value for X and Z is given because the point is located in the positive direction
with respect to origin in both the axes.
X+
10
8
6
P2
4
P1
2
Z- Z+
-10 -8 -6 -4 -2 2 4 6 8 10
-4 ORIGIN
-6
-8
-10
X-
14
PART PROGRAMMING MANUAL
Assuming that tool is positioned at point P0, if a reference is made for point P1, co-
ordinates of P1 are defined with respect to point P0.
Similarly if a reference is made for point P2, co-ordinates of P2 with respect to P1 are
X4Z5.
Again if a reference is made for P0, co-ordinates of P0 with respect to P2 are X-8Z-8.
Thus incremental system doesnt have a fixed origin. The origin changes from point to
point. In other words the origin is floating and hence FLOATING ZERO SYSTEM OF
DIMENSIONING.
X+
10
8 P2
4 P1
2
Z+
P0
2 4 6 8 10
15
PART PROGRAMMING MANUAL
4. UNITS OF DIMENSIONING :
Irrespective of whether absolute or incremental system is followed for dimensioning a
component, it is possible to use both inch system and metric system of units.
NOTE :
1. Generally all the programs are written in absolute system.
2. All the programmed X values will be in diameters.
16
PART PROGRAMMING MANUAL
Different co-ordinate systems and reference points used on a CNC machine are explained below.
MACHINE ZERO M :
The points of intersection of the spindle axis and the plane of spindle front face is taken as
machine zero.
Similar to machine co-ordinate system, we have work piece co-ordinate system having the
origin at work zero and the reference point co-ordinate system having the origin at machine
reference point.
X+
Z+
R0
X+
Z+
M W T0
17
PART PROGRAMMING MANUAL
The coinciding point of the work piece front face and the work axis is selected as work
zero.
With the machine co-ordinate system having the origin at reference point, whenever the
slides are taken to reference point the display values of the actual position (on the CRT
screen) will be zero.
With machine co-ordinate system having the origin at machine zero, reference point co-
ordinates are to be defined with respect to machine zero. For all the actual requirements
keeping the slides at the machine reference point, distance between the machine zero and
the turret zero (turret front face and axes intersecting point) is established in both the axes
and defined as the reference point co-ordinates.
PARKING POSITION T :
This is an intermediate or an arbitrary point on the machine which is defined by the
operator. The position is selected such that, it would be convenient for tool indexing,
inspection of component or tool, loading and unloading of component etc.,
18
PART PROGRAMMING MANUAL
Chapter-3
Programming of G-CODES,
Zero offsets, Tool offsets &
(Tool Nose) Radius Compensation
19
PART PROGRAMMING MANUAL
PROGRAMMING OF G CODES :
Command data given to the CNC system in the form of part program comprises of a set of
numerical codes.
They take active part in part program execution and machine operation and are programmed by
letter G followed by two digits as per format G2. They are always programmed at the start of the
block. They describe the type of machine movement, type of interpolation, type of dimensioning,
time related functions and activate certain operating conditions within the control.
G codes once programmed, remain active until another G code of the same group is programmed,
after which the previous one gets cancelled, are said to be MODAL.
G code which remains active only in the block in which it is programmed, is said to be
BLOCKWISE ACTIVE or ONE SHOT G CODE.
G codes which are active after switching on controller or reset or M02 or M30 are called
SYSTEM RESETs or DEFAULT G codes. They need not be programmed unless they are
replaced by a G code of the same group other than resets.
20
PART PROGRAMMING MANUAL
G-CODE LIST :
G-CODE DESCRIPTION
G00 Rapid positioning (rapid traverse)
G01 Linear interpolation (straight line cutting)
G02 Circular interpolation clockwise
G03 Circular interpolation counter clockwise
G04 Dwell in seconds
G20 Inch input (0.0001 in)
G21 Metric input (0.001 mm)
G33 Thread cutting
G40 Tool nose radius compensation cancel
G41 Tool nose radius compensation left
G42 Tool nose radius compensation right
G90 Absolute programming
G91 Incremental programming
G92 Spindle speed limitation with CSS
G94 Feed per minute
G95 Feed per revolution
G96 Constant surface speed (CSS)
G97 CSS cancel
CANNED CYCLES :
21
PART PROGRAMMING MANUAL
G00 can be programmed as G or G0. G00 is modal. It gets cancelled with G01, G02, G03 or
G33.
With G00 being effective, the programmed feed rate gets cancelled, until G01, G02 or G03 is
programmed.
X+
60
40
30
3 2
20
1 10
0 Z+
-40 -20
WORK ZERO
On the CRT screen, movements executed with G00 appear as dotted lines if graphics feature is
available.
To the possible extent all idle movements are programmed with G00.
For example :
1. Movement from machine reference point to turret index position.
2. Movement from turret index point to safe positioning point before cutting and after cutting.
3. All idle movements when the tool is away from component.
22
PART PROGRAMMING MANUAL
Whether one axis is moved at a time or simultaneously two axes are moved, the movement will be
along a straight line.
CNC calculates the feed rate of each axis so that the resultant feed rate is the programmed feed
rate.
The feed rate specified by F code remains effective until a new feed rate is commanded. Hence
it need not be repeated. If feed rate if not specified it will be regarded as zero. The movement
command can be in absolute or incremental command.
Assume that tool is positioned at X40 Z0. It has to reach point 2 and then point 3.
X+
60
40
3 2
30
1 20
0 Z+
-40 -20
WORK ZERO
23
PART PROGRAMMING MANUAL
When the tool is moving from point 2 to point 3 there is no need to define the X value as the
movement is along Z-axis.
End of block
Position data
G01 is the reset mode. It is modal and gets cancelled with G00, G02, G03 or G33.
On the graphic screen movements made with G01 appear as continuous lines.
24
PART PROGRAMMING MANUAL
G02 G03
Z+ Z+
Start point of the circular arc will be known as it is the end point of the preceding command in the
program.
25
PART PROGRAMMING MANUAL
End point is to be calculated depending on the component profile. Format to be used to give a
circular interpolation command with radius is as below.
G02/G03 XZ R F
Feedrate
Arc Radius
Direction of interpolation
Example :
G02X50.Z-25.R5 F0.03 - C.W.
G03X-100.Z-37.R8 F0.03 - C.C.W
26
PART PROGRAMMING MANUAL
The interpolation parameters are the paraxial co-ordinates of the distance vector from the starting
position to the centre point of the circle. The interpolation parameters I and K are allocated to X
and Z axes respectively.
40 P2 3
R15 K I
P1 2 1 10
15
-50 -25
From point 1 to point 2 the tool travels at an angle. From 2 to 3 it travels in a circular path. It is
possible to establish the offsets of the centre point with respect to the start point in both the axes.
The x-axis offset is I and the Z axis offset is K.
Instead of radius R, the interpolation parameters I and K could be given to define the centre point.
The interpolation parameters must always be entered as incremental values irrespective of absolute
or incremental programming is done. The sign is based on the direction of co-ordinate from the
starting position to the centre point of the circle.
27
PART PROGRAMMING MANUAL
X+ C K- K+ E
S
R I+ R
I-
S
E C K-
Z+ Z+
ORIGIN ORIGIN
As explained above the programming format for the four arcs can be written as
X+ X+
C C
R I+ I+ R E
E K+ K-
S S
Z+ Z+
ORIGIN ORIGIN
G02 and G03 are modal and get cancelled with each other and also with G00, G01 and G33. The
following table in a nutshell explains about the circular interpolation parameters.
28
PART PROGRAMMING MANUAL
- This G code must be specified in an independent block before setting the co-ordinate
system at the beginning of the program.
- When the power is turned ON the NC status is the same as that held before the power was
turned OFF.
- G20 / G21 must not be switched during program.
- When switching inch to metric and vice versa, the offset value must be reset according to
the input unit.
29
PART PROGRAMMING MANUAL
D2 D1
When the diameter is specified, it is called diameter programming and when the radius is
specified, it is called radius programming. Radius programming or diameter programming can be
specified by parameter (no. 0019, XRC). When using diameter programming on the X-axis, note
the conditions listed in the following table.
ITEM NOTES
Z axis command Specified irrespective of diameter or radius value.
X axis command Specified with a diameter value.
Incremental command with address U Specified with a diameter value. In the above
figure, specifies form D2 to D1 for tool path B to A.
Co-ordinate system setting (G50) Specifies a X-axis co-ordinate value with a
diameter.
X component of tool offset value Parameter setting (no. 0001, ORC) determines
either diameter or radius value.
Parameters in G90-G94, such as cutting Specifies a radius value.
depth along X-axis ( R ).
Radius designation in circular Specifies a radius value.
interpolation (R,I,K)
Feedrate along x-axis Change of radius / rev.
Change of radius / min.
Display of x-axis position Display as diameter value.
30
PART PROGRAMMING MANUAL
To have G95 effective spindle speed encoder is provided. Spindle encoder sends the
feedback signal of spindle speed to the system, which in turn, controls the feed rate to have
a constant feed per revolution.
31
PART PROGRAMMING MANUAL
32
PART PROGRAMMING MANUAL
EXAMPLE 1 :
POSITION X Z
1 20 0
2 20 -10
3 40 -10
4 40 -20
5 60 -20
6 60 -30
60
40
6 5
4 3 20
2 1
10
20
30
Considering a movement form point 1 to 6 via points 2,3,4 and 5, program could be written as :
N5 G0 X20..Z2 ; (Safe positioning to take cut)
N10 G01Z-10. F0.25 ; (Movement to point 2)
N15 X40. ; (From point 2 to point 3)
N20 Z-20 ; (From point 3 to point 4)
N25 X60. ; (From point 4 to point 5)
N30 Z-30 ;
In block number N10, G00 is replaced by G01. Since G01 is modal it is effective throughout the
program.
33
PART PROGRAMMING MANUAL
EXAMPLE 2 :
POSITION X Z
1 24 0
2 30 -3
3 30 -22
4 36 -25
5 50 -25
6 61.592 -29.447
7 70 -45
8 70 -55
9 80 -60
10 94 -60
11 100 -63
12 100 -75
100
11 70
12 10 R5
9
R3 8 7 15 30
6
5 3x45
R6 4 3 2 N5 G00 X0.Z2. ;
R3 1 N10 G01 Z0.F0.25
N15 X24. ;
0 N20 X30.Z-3. ;
N25 Z-22. ;
25 N30 G02 X36.Z-25.R3 ;
N35 G01 X50. ;
45 N40 G03 X61.592 Z-29.447 R6. ;
N45 G01 X70.Z-45. ;
60 N50 Z-55. ;
N60 G02 X80.Z-60.R5 ;
75 N65 G01 X94. ;
N70 G03 X100.Z-63.R3 ;
Use of G02/G03, G01 and G00 is given clearly. They are all modal and replace each other.
34
PART PROGRAMMING MANUAL
EXAMPLE 3 :
POSITION X Z
1 20 0
2 20 -30
3 43.094 -50
4 51.754 -52.5
5 70 -52.5
6 70 -100
7 51.754 -47.5
70
6 5
R5
7 20
4 I
3 K 2 1
30
30
52.5
100
I = +4.33 K = +2.5
N5 G00 X20.Z2 ;
N10 G01 Z-30..F0.2 ;
N15 X43.094 Z-50. ;
N20 G02 X51.754 Z-52.5 I4.33 K2.5 ;
N25 G01 X70. ;
N30 Z-100. ;
In this example the circular interpolation is programmed using interpolation parameters instead of
the radius.
The I & K values are given as incremental data. Since the centre point is located in positive
direction in both the axes with respect to the start point they have positive values.
35
PART PROGRAMMING MANUAL
1. Make sure that both the axes are referenced and the component is securely clamped.
2. Now bring one of the tools near the face of the job.
3. Select MDI mode.
4. Press PROGRM Button
5. Enter S500, EOB and then press Insert.
6. Press CY START PB.
7. Select Handle / Jog mode and select the appropriate feed.
8. Press spindle CW / CCW depending on the type of the tool.
9. Light facing cut to be taken up to the center.
10. After the finish cut, move the tool back in X only. DONT DISTURB Z-AXIS.
11. Now switch off the spindle.
12. Press OFFSET SETTING Soft key on the CRT. The OFFSET / SETTING / WORK are displayed
on the CRT.
13. Press OFFSET Soft Key, WEAR / GEOM are displayed on the CRT.
14. Press GEOM Soft Key and position the cursor using cursor movement buttons on the required
offset number corresponding to the tool used.
15. Press Z 0 and press MEASUR Soft Key. The Z-offset for the selected tool is set.
16. Now rotate the spindle in the appropriate direction and machine on OD.
17. DO NOT MOVE X.
18. Take Z-axis away from the job.
19. Stop the spindle.
20. Measure the OD dimension.
21. Press GEOM Soft Key and position the cursor using cursor movement buttons on the required
offset number corresponding to the tool used.
22. Press X, the measured value and then press MEASUR Soft Key. The X-Offset for the tool is set.
23. Repeat the procedure for all tools.
24. After taking offsets, select MDI and command S0
36
PART PROGRAMMING MANUAL
EXAMPLE 4 :
POSITION X Z
1 10 0
2 20 -5
3 20 -10
4 30 -15
5 30 -25
6 50 -25
7 50 -30
50
7 6 20
30 R5
5 4 2 5x45
3 1
0
N10 G00 X10.Z5. ;
10 N15 G94 G01 Z0F50. ;
N20 X20.Z-5.
15 N25 Z-10. ;
N30 G95 G02 X30.Z-15.R5. F0.21 ;
25 N35 G01 Z-25. ;
N40 X55.
30 N45 G00 Z5. ;
The above example gives a changeover from feed / rev. to feed / min.
The code G94 activates feed / min. mode and F50 refers to 50 mm/min.
The code G95 activates feed / rev. mode and F0.2 indicates 0.20 mm/rev.
37
PART PROGRAMMING MANUAL
9. REFERENCE POINT :
The reference point is a fixed position on a machine, to which the tool can be easily moved
by the reference point return or zero return function.
1. G04 DWELL :
G04 is used to program dwell time in seconds. The dwell time value is programmed by
means of letter X or P or U or Z or F.
Dwell starts after the commanded feedrate of the previous block attains zero.
38
PART PROGRAMMING MANUAL
Code G96 indicates the constant surface speed in m/min. i.e. S value programmed after
G96 is considered as meters / min.
EXAMPLE :
N5 G96 S500 ; 500 m/min
N10 G96 S200 ; 200 m/min
The CNC calculates the spindle speed for the current turning diameter in accordance with
the programmed cutting speed.
The speed value stored under S, remains unchanged until a new speed value is
programmed. i.e. S value programmed is modal.
When CSS is used the work co-ordinate system must be set so that the centre of rotation
meet the Z-axis (X=0)
The surface speed for a block containing rapid traverse is calculated on the basis of
the end point.
When the power supply is turned ON, the maximum spindle speed is not set ; hence
the speed is not clamped.
G50S0 indicates speed is clamped at 0 rpm.
The S value specified in G96 mode is unaffected by G97 and hence is restored
when returned to G96 mode.
The surface speed specified in G96 is for the program path and not for the position with tool.
39
PART PROGRAMMING MANUAL
G92 is given to safe guard the spindle from running at high rpm values when working at
smaller diameters under constant surface speed. Spindle speed set by G92 can not be
overrun when operating in constant surface speed mode or by using spindle speed override
keys.
The spindle speed limit value stored under address S with G92 remains in the program
until a new spindle speed limit value is programmed. G92SO, stops the spindle.
Spindle speed values programmed with G92 are modal. No other information can be
programmed in this block.
EXAMPLE :
N5 G96 S250 ;
N10 G01 X26.Z5.F0.21 ;
N15 Z-25. ;
N20 X30. ;
N25 G00 Z5. ;
N30 G97 ;
N30 G97 cancels G96. Spindle speed correspondence to X30 (2650 rpm) is retained.
40
PART PROGRAMMING MANUAL
EXAMPLE 6 :
POSITION X Z
1 40 0
2 40 -15
3 40 -25
4 40 -35
5 60 -35
6 60 -50
60
6 5 30 40
4 3 2 1
3 3
N20 G00 X45.Z-15. ;
N25 G01 X30.F0.2 ;
0 N30 G04 X1. ; (Dwell of 1 second)
N35 G00 X45. ;
` 15 N40 Z-25. ;
N45 G01 X30. ;
25 N50 G04 X1. ; (Dwell of 1 second)
N55 G00 X45. ;
35
50
Block numbers N25 and N45 correspond to grooving operation. At the bottom of each groove a
dwell of one second is programmed. Block numbers N30 and N50 represent the same.
41
PART PROGRAMMING MANUAL
EXAMPLE :
POSITION X Z
1 25 0
2 25 -50
3 55 -50
4 55 -75
5 90 -75
6 90 -90
90
N20 S1500 ;
6 5 N20 S1500 ;
55 N25 G00 X25.2 Z2. ;
N30 G01 Z-49.9. F0.3 ;
4 3 25 N35 G00 X27.5 Z-48. ;
1.5 N40 Z2. ;
2 1 N50 G96 S125 ;
N55 G50 S1800 ;
0 N60 G01 X0 Z0 F0.15 ;
N65 X25. ;
50 N70 Z-50 ;
N75 X55. ;
75 N80. Z-7.5 ;
N85 X90 ;
90 N90. Z-90 ;
N95 G00 X92.Z5 ;
N100 G97. ;
N105 G95 ;
Assume a finishing stock of 0.1mm on all faces, and 0.2mm on all diameters. A roughing cut of
1.4mm is to be given on 25. Roughing feed rate is 0.3 mm/rev and finishing feed is 0.15 mm/rev
Roughing is done at 1500 rpm. Finishing is done at a constant surface speed of 125 mts/min with
the maximum spindle speed limited to 1800 rpm.
In the above program, block number N45 corresponds to constant surface speed of 125 mts/min
and block number N50 corresponds to limitation of maximum rpm 1800 rpm. Block number N95
change over from constant surface speed to constant rpm mode.
42
PART PROGRAMMING MANUAL
The offset values of the new origin can be entered into any of the zero offset
locations. When the relevant zero offset number is selected in the program, CNC
refers to the corresponding zero offset location and shifts the machine zero to the
new origin position by the amount of offset value stored for each axis.
EXAMPLE :
N50 G55 ;
When CNC reads the block number N50 the machine origin gets shifted by the amount of
offset value stored in G55 location.
When zero offset data is selected, by using the soft key menu, CRT displays the following
data.
X Z (G54)
X Z (G55)
X Z (G56)
X Z (G58)
Offset data of the new origin is stored into any of the above zero offset memory locations.
Generally settable zero offsets are used to define the work zero. Since work piece axis is
in line with spindle axis, there is no offset along X-axis, and since the work piece zero is in
front of machine zero, it has a particular amount of offset along Z-axis.
43
PART PROGRAMMING MANUAL
A new origin O is defined in the figure. With respect to machine zero, the offsets of the new
origin are X0 Z200.
If the data (i.e. Z0 Z200) is stored in G57 memory location, whenever G57 is used in the program,
offset data entered in G57 is considered by CNC.
X+ X+ P1 (X100, Z250)
30
50
P(X40,Z-30)
20
Z+ 0 Z+
MACHINE ZERO NEW ORIGIN (G57)
200
250
To position tool at P from an existing position P1, control calculates the distance to be traveled in
both the axes considering the offset values of the present position with respect to machine zero,
offset value of G57 origin with respect to machine zero, and offset position of P with respect to
G57 origin.
Along Z-axis =
Z offset of P with + Z offset of G58 origin with Z offset of P1 with
Respect to G57 respect to machine zero respect to machine zero.
= 30 + 200 250 = -80
44
PART PROGRAMMING MANUAL
To enter offset data into programmable zero offsets the following program is written.
N50 G58 X0 Z200 ;
When CNC reads N50, the data programmed under G58 is loaded into G58 memory
location, and the machine zero gets shifted to new origin.
Zero offset values are additive i.e. when more than one zero offset code (G code) are used
in a program, CNC takes sum of all the offset values into consideration, in order to shift
the machine zero to new zero position.
NOTE :
a. G54 is the default function i.e. there is no need to program G54 code, in order to
shift the machine zero to new position, when a zero offset data is entered into G54
memory location.
b. Also when a zero offset location other than G54 is used, in order to enter the zero
offset data, care should be taken to keep the G54 memory location empty.
Otherwise, as G54 is the default, and the zero offsets are additive, whenever a G
code other than G54 is programmed, zero offset value stored in G54 memory
location is added to that value stored in the zero offset location of the programmed
G code.
45
PART PROGRAMMING MANUAL
EXAMPLE :
N5 G55 ;
N10 G00 X100 Z200 ;
:
:
:
N50 G53 X100 Z200 ;
N55 X100 Z200 ;
Block number N5 - Activates the zero offset already loaded in the zero offset memory
G55.
Block number N10 - Command position is with respect to new origin.
Block number N50 - G53 suppresses zero offset G55, and command position is with
respect to machine zero.
Block number N55 - Command position is once again with respect to G55 zero.
In case of touch probe, G53 is used for automatic tool offset entry in JOG MODE, and
automatic updating of already entered tool offsets in AUTOMATIC MODE (by executing
a special program, where all command positions are to be defined with respect to machine
zero).
46
PART PROGRAMMING MANUAL
Turret zero is the intersection point of turret axis and turret front face.
A tool is mounted on turret. The distance between the turret zero and the tool tip along X-
axis is XT, and that along Z-axis, is ZT.
Z300
X900 R
X TOOL
OFFSET
XT M 50 W
Z0
Z TOOL OFFSET ZT
To bring in the established tool offset values of a called tool, the corresponding offset
number is to be programmed following the tool number.
Consider that for tool 1, the offset values are entered in tool offset memory location 1 ;
Then, N50 T01 01 ; is programmed.
47
PART PROGRAMMING MANUAL
Tool number indicates the turret station number where the tool is mounted, and the tool
lengths of which are to be entered.
EXAMPLE :
Tool number 5
X offset 180
Z offset 7
48
PART PROGRAMMING MANUAL
Z300
X900 R
X TOOL
OFFSET
XT
X100
M 50 W
Z0
49
PART PROGRAMMING MANUAL
Z300
X900 R
Z TOOL OFFSET ZT
Z175
Z200
M 50 W
Z0
50
PART PROGRAMMING MANUAL
When ever the tool is called to a particular position, CNC takes into account, zero offset, tool
length offset, distance of the target position from work zero, and the position where the tool is
located and then calculates the distance to be traveled in each axis.
The position of tool tip with respect to turret zero is different for each tool. Tool offsets are used
to establish, the offsets of each tool tip with respect to machine zero.
The tool is brought close to the component, and a cut is taken on OD. The diameter is measured.
The corresponding display position in the X-axis is noted down. Assume that diameter measured
is 50mm and the corresponding display position is X400.
Similarly a cut is taken on the face. The corresponding display position in Z-axis is noted down.
The slide is taken back to a safe position and brought forward so that the turret face is touched on
to component face. Corresponding display position in Z-axis is noted down.
The difference in the positions displayed corresponding to tool stationed at work zero and to that
at the reference position is made use of to establish the tool length offsets.
NOTE :
When the slides are positioned at the machine reference point, turret zero itself is considered as the
machine reference point.
Thus
X offset of tool = X position at W/P W/P radius
(on radius)
= 200 25
= 175
Z offset of tool = Z position with the tool touching Z position with table touching
the W/P the W/P
= 100 92
= 8
The established data is entered into any one of the tool offset memory locations.
51
PART PROGRAMMING MANUAL
C+ C
X+ CODE 2 X+ CODE 6
P Z+ P Z+
C C
X+ CODE 3 X+ CODE 7
C P
Z+ Z+
P C
X+ CODE 4 X+ CODE 8
C C
Z+ Z+
P P
52
PART PROGRAMMING MANUAL
X+
8
4 3
5 9 7 Z+
ORIGIN
1 2
X+
W 2
P Z+
1
LEADING TIP
53
PART PROGRAMMING MANUAL
On the OD the bottom most point, and on the face, the front most point of tool tip, touches the
component.
Lines passing tangential to the TIP CIRCLE meet at point P. Tool tip touching at points 1 and 2
is as good as touching at point P. Keeping this point as reference CNC executes all tool
movements. Point P is called as leading tip.
Different programmed positions are attained by leading tip. It can be clearly seen from the
drawing that the tool has already crossed point 1 and not yet reached point 2. Because of the
leading tip there is profile error at the chamfer portion, i.e. chamfer is short.
75
50
1
LEADING TIP
54
PART PROGRAMMING MANUAL
Compensated path
Programmed path
Since the cutting tip is of circular shape, depending on the contour profile, any point on the
circumference may touch the component which leads to contour error. To avoid this sort of error
tool radius compensation is used.
By programming radius compensation, control calculates and generates a new patch called
compensated path parallel to the programmed path, keeping the distance between the two paths
equal to tip radius. Then the tool offsets get shifted to the tool tip centre and the tool tip centre
follows the compensated path.
Compensated path being traced by the centre point, the counter error is eliminated. Programming
of tool radius compensation is done by the relevant G code. There are two types of cutter radius
compensation (C.R.C) like C.R.C to the left of the component G41 & C.R.C to the right of the
component G42.
The above codes are decided looking in the direction of cutting, to which side of the component,
the tool is existing i.e. if tool is to the left side, code is G41 and if the tool is to the right side, code
is G42.
(Eye)
Looking in the direction of (the feed if the cutting Looking in the direction of the feed if cutting
tool is to the right of the cutting surface tool is to the left of the cutting surface code used
code used is G42 is G41.
In the I figure, to effect C.R.C code programmed is G42 and in the II figure G41 is programmed.
55
PART PROGRAMMING MANUAL
DIRECTION OF CUTTING
(Eye)
Looking in the direction of the feed if the cutting tool is to the left of the cutting surface code used
is G41
DIRECTION OF CUTTING
(Eye)
Looking in the direction of the feed if the cutting tool is to the right of the cutting surface code
used is G42
Whenever C.R.C is selected, to initiate the compensation in the proper direction, CNC refers to the
tool offset page to identify the tool location code and the tip radius.
G41 and G42 are modal. They are cancelled by G40 or after M30, reset or emergency stop.
56
PART PROGRAMMING MANUAL
G40, G41 and G42 can be programmed in a block separately with anyother
function. They are not active, unless a movement command is programmed atleast
in one axis.
When any change from G00 to G01, G02 or G03 is detected the CNC applies the
same process as when the tool radius compensation is initiated.
The spindle speed is read from the position coder on the spindle in real time and converted
to the cutting feedrate for FPM, which is used to more the tool.
Spindle speed must remain constant from rough cutting through finish cutting, else
incorrect thread lead will occur.
57
PART PROGRAMMING MANUAL
LX Tapered thread
Z
LZ
LZ LX 45 lead is Z direction
LZ LX 45 lead is X direction
NOTE :
1. Feedrate override is not effective (fixed at 100X) during thread cutting
2. If FEEDHOLD push button is pressed during thread cutting, the tool will stop after a block
not specifying thread cutting is executed, similar to single block.
3. Spindle speed override is not effective in thread cutting mode.
Lead in Increment /
longitudinal decrement
axis direction of lead per
at the start spindle
point revolution.
Range for K
is 0.0001 to
500.000 mm/rev.
24.2 MULTIPLE START THREADS :
Multiple start threads are cut by shifting the start point of the thread for each start,
by the distance equal to pitch (lead divided by number of starts).
If the lead is 4mm and number of starts are 2, and if the start point for the first start
of the thread is selected as Z4, then the start point for the second start of the thread
is selected as either Z2 or Z6.
58
PART PROGRAMMING MANUAL
Chapter-4
M-Code List
59
PART PROGRAMMING MANUAL
IV. M CODE LIST (New M-code list includes all optional features)
CODE MISCELLANEOUS FUNCTION
M00 Optional stop unconditional.
M01 Optional stop conditional
M02 End of program
M03 Clockwise direction of spindle rotation (viewing towards the chuck from machine
front) of tailstock end.
M04 Anti-clockwise direction of spindle rotation (viewing towards the chuck from
machine front) tailstock.
M05 Spindle stop
M07 Coolant ON
M09 Coolant OFF
M10 Chuck declamp
M11 Chuck clamp
M16 Chuck clamp on ID
M18 Chuck clamp on OD
M19 Oriented spindle stop
M20 Spindle orientation cancel
M21 30 rotation
M22 60 rotation
M23 90 rotation
M24 120 rotation
M25 150 rotation
M26 180 rotation
M30 End of program with return to beginning
M32 Tailstock quill forward
M33 Tailstock quill retract
M34 Parts catcher forward
M35 Parts catcher retract
M46 Door open
M47 Door close
M54 Tailstock quill override ON
M55 Chuck signal override ON
M56 T.S. quill interlock ON for cycles start
M57 T.S. quill interlock OFF for cycle start
M60 Door interlock OFF
M61 Door interlock ON
M82 T.S. body forward
M83 T.S. body retract
60
PART PROGRAMMING MANUAL
Chapter-5
Miscellaneous Functions
61
PART PROGRAMMING MANUAL
V.MISCELLANEOUS FUNCTIONS M :
Miscellaneous functions perform certain machine setting functions such as direction of spindle
rotation, switching on the coolant motor etc., Each block may contain upto 3m functions. Some of
the miscellaneous functions are defined by CNC system manufacturers and some are defined by
machine tool manufacturers.
It is possible to change over from M03 to M04 and vice versa. In such a case before programming
next M function it is necessary to program M05.
M07 COOLANT ON :
By programming M07, coolant motor i.e. low pressure coolant motor switches ON.
62
PART PROGRAMMING MANUAL
This feature is useful to drill offcentre holes, pitch holes at a particular p.c.d., radial slot milling on
face, key way milling, oriented loading and unloading.
M21 30 ROTATION
M22 60 ROTATION
M23 90 ROTATION
63
PART PROGRAMMING MANUAL
64
PART PROGRAMMING MANUAL
Example :
75 X
R3 60 Raw material
75X105
R2 25
R2 45
R3
1x45
70 60 40 25
65
PART PROGRAMMING MANUAL
O00 71 ;
N1 T00 00 ;
G00 X0. Z-100.;
T0606 M07 ;
G92 S2500 ;
G96 S180 M03 X75.Z0. ;
G01 X-1 F0.25 ;
G00 X75.Z2. ;
G71 U2.5 R1. ;
66
PART PROGRAMMING MANUAL
X
60
100
Z
25 30
10
Raw material
15
67
PART PROGRAMMING MANUAL
EXAMPLE :
O0072 ;
T0000 ;
G0 X0. Z-100. M07 ;
T0101
G92 S2500 ;
G96 S180 M03 X105. Z0. ;
G01 X-1. F0.25 ;
G00 X105. Z2. ;
G72 W1.5 R1. ;
G72 P10 Q20 U0.5 W0.25 F0.3 ;
N10 G0 Z-15. ;
G01 X60. Z-10. ;
X30. ;
X25. Z0. ;
N20 X0. ;
G97 S0 T0000 M09 G0 X0. Z-100. ;
M30 ;
68
PART PROGRAMMING MANUAL
EXAMPLE :
X
e
20
20 20 K
60 (W)
O0074 ;
T000 ;
G00 X0 Z-100. ;
S900 M04 ;
T0505 ;
G00 X0 Z3. M07 ;
G74 R1000 ;
G74 Z-60. Q20000 F0.2 ;
G00 Z5. ;
S0 T0000 M09 ;
X0 Z-100. M05 ;
M30 ;
69
PART PROGRAMMING MANUAL
Example :
X
15 10
50
4 Tool offset
80 established to this
edge
Tool width = 4mm
O 0075 ;
T0000 ;
G00 X0. Z-100. M07 ;
T0101 S300 M03 ;
G92 S2000 ;
G96 S100 X82 Z-10. ;
G75 R1000 ;
G75 X50. Z-21. P5000 Q4000 F0.15 ;
G00 X82. ;
S0 T00 00 X0. Z-100. M09 ;
M05 ;
M30 ;
70
PART PROGRAMMING MANUAL
(d min) = minimum depth of cut, subsequent passes depth (dn - dn-1). Number
of cutting passes can be controlled by varying this value.
d = Depth of cut in 1st pass / 1st cut.
Example :
20 X
40
71
PART PROGRAMMING MANUAL
M20x2.5
Pitch = 2.5
72
PART PROGRAMMING MANUAL
X
4 3 2 1
30
4 6 8 10 Z
60
O0763 ;
T0000 ;
G0 X0. Z-100. ;
T0505 M07 ;
G97 S1000 M04 ;
G0 X32. Z10. ;
1 G76 P020060 Q150 R50 ;
G76 X27.44 Z-60. P11280 Q400 F8.0 ;
G0 X32.Z8. ;
2 G76 P020060 Q150 R50 ;
G76 X27.44 Z-60. P1280 Q400 F8.0 ;
G0 X32.Z6. ;
3 G76 P02.0060 Q150 R50 ;
G76 X27.44 Z-60. P1280 Q400 F8.0 ;
G0 X32. Z4. ;
4 G76 P020060 Q150 R50 ;
G76 X27.44 Z-60. P1280 Q400 F8.0 ;
S0T0000 M09 ;
G0 X0.2-100. M05 ;
M30 ;
73
PART PROGRAMMING MANUAL
TAPPING OPERATION :
X
M12
20
Tap mounted
in the tapping
chuck
O5555 ;
T0000 ;
G0 X0.Z-100 ;
T0303 M07 ;
G97 S200 M04 ;
G0 X0. Z5. ;
G33 Z-20. F1.75 ; / G01 Z-20. F1.75 ;
S0 ;
S200 M03 ;
G33 Z5. F1.75 ; / G01 Z5. F1.75 ;
S0 T0000 M09 ;
G0 X0.2-100. ;
M05 ;
M30 ;
74
PART PROGRAMMING MANUAL
A ANGLE
X2Z2
1. Always specified positive (i.e. in the counter
clockwise keeping Z-axis as base).
X1Z1
C-CHAMFER
3 X3 Z3
C
1 X2 Z1
R CORNER RADIUS
3 Y3 Z3
2 X1 Z1
75
PART PROGRAMMING MANUAL
X+
2X2(or Z2)
N10 X1Z1 ;
N15 X2(or X2) A ;
A
1X1Z1
Z+
X+ 3X3 Z3
X2(or Z2)
2
C N10 X1Z1 ;
N15 X2(or Z2) A C ;
A N20 X3 Z3 ;
1X1Z1
Z+
X+ 3X3Z3
X2(or Z2)
2
R N10 X1 Z1 ;
A N15 X2 (or Z2) A R;
N20 X3 Z3 ;
1X1Z1
Z+
76
PART PROGRAMMING MANUAL
X+ 3X3Z3
A2
2
N10 X1 Z1 ;
A1 N15 A1;
N20 X3 Z3 A2 ;
1X1Z1
Z+
X+ 3X3Z3
A2
2
C N10 X1 Z1 ;
A1 N15 A1;
N20 X3 Z3 A2 ;
1X1Z1
Z+
X+ 3X3Z3
A2
2
R C N10 X1 Z1 ;
A1 N15 A1 R ;
N20 X3 Z3 A2 ;
1X1Z1
Z+
77
PART PROGRAMMING MANUAL
X+ 4X4Z4
X3Z3
3 A2 N10 X1Z1 ;
C2 N15 Z1 C1 ;
2 C1 A1 N20 X3 Z3 A2 C2
N25 X4 Z4 ;
1X1Z1
Z+
X+ 4X4Z4
R2
3 A2 N10 X1Z1 ;
X3Z3 N15 A1 C1 ;
2 C1 A1 N20 X3 Z3 A2 R2
N25 X4 Z4 ;
1X1Z1
Z+
X+ 4X4Z4
R2
3 A2 N10 X1Z1 ;
X3Z3 N15 A1 R1 ;
R1 A1 N20 X3 Z3 A2 R2 ;
N25 X4 Z4 ;
1X1Z1
Z+
78
PART PROGRAMMING MANUAL
X+ 4X4Z4
X3 Z3
C2 A2 N10 X1Z1 ;
3 2 N15 A1 R1 ;
R1 A1 N20 X3 Z3 A2 C2 ;
N25 X4 Z4 ;
1X1Z1
Z+
79
PART PROGRAMMING MANUAL
80