0% found this document useful (0 votes)
16 views48 pages

Gposai GB

Uploaded by

Vujk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views48 pages

Gposai GB

Uploaded by

Vujk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

PROGRAMMING

GUIDE

®
brembana
macchine
A trademark of CMS SpA
CNC Machining Centres

CMS S.p.A.
Costruzione Macchine Speciali
Via Antonio Locatelli, 49
24019 ZOGNO (Bergamo) Italia
Tel. +39 (0) 345/64.111 - Fax +39 (0) 345/64.281
http:\\www.cms.it - E-mail: [email protected]

OSAI
Published by:

CMS S.p.A. brembana


macchine
UFFICIO DOCUMENTAZIONE TECNICA A trademark of CMS SpA

CNC Machining Centres


Edition A
C.M.S. S.p.A. Costruzioni Macchine Speciali
1st October 1994

All rights reserved. This publication may not be reproduced, wholly or in part in any form, by any means, or for
any purpose. It may not be given to third parties, and its contents may not be used by or in any way divulged to
third parties unless expressly authorized by CMS S.p.A. In no circumstances may CMS be held responsible to
third parties for any damages incurred as a result of the use of this publication.
Trademarks are the property of their respective owners.
FOREWORD

This “Programming Guide” is a short introduction to the


User Course held at the CMS Customer Service Center.
The purpose of this leaflet is to gradually build up the
reader’s understanding of Numerical Control machine pro-
gramming.
Since we will take for granted the Participants’ knowledge
of the concepts presented here, any incomplete knowledge of
the contents of this leaflet will diminish the intended effective-
ness of the course.
During the course all concepts presented in this leaflet will
be looked at in greater detail to develop specific and complete
operating autonomy at the machining center.

CMS S.p.A.
Servizio Clienti
1-1 . . . . . . . . . . . . . . . . . . . . . . . . CHAPTER 1
1-1 . . . . . . . . . . . NUMERICAL CONTROL MACHINES

2-1 . . . . . . . . . . . . . . . . . . . . . . . . CHAPTER 2
2-1 . . . . . . . . . . . . . . . . . . . . . WORKING SPACE
2-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1 MOVEMENT DIRECTIONS
2-4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 MEASUREMENT UNITS

3-1 . . . . . . . . . . . . . . . . . . . . . . . . CHAPTER 3
3-1 . . . . . . . . . . . . . . . PROGRAMMING LANGUAGE
Index
Programming guide

CHAPTER 1
NUMERICAL To meet the increasingly difficult challenges of a very dynamic
CONTROL marketplace, the most effective technological response to the
requirements of modern industry, such as:
MACHINES
– reducing machine setup times
– extending flexibility of use
– increasing productivity
– improving product quality level
– ensuring conformance to new safety standards,
lies in the development of NUMERICAL CONTROL machines.
The basic concept behind this technology is revealed by the word
NUMERICAL. All machine functions are actually controlled by an
electronic device in which each magnitude is represented by numbers.
This device receives its instructions from us in the form of an
ALPHANUMERIC code which is automatically converted into
mechanical machine movements and written “instructions” which are
carried out in sequence.
For example, to make a motor run at different speeds, we do not pull a
lever or push a button, but simply “instruct” the machine to run at
“1500” or “12000” rpm. Similarly, to make a cut of a certain length,
we do not mechanically adjust the limit switch, but rather “instruct”
the machine to cut to the distance required, “X1200”.
The acronym NC, standing for Numerical Control, refers in particular
to an electronic system capable of “understanding” numerical orders
and controlling the machine drives accordingly.
If the electronic system also includes a computer, we use the acronym
CNC, Computerized Numerical Control.
If the system is controlled by a powerful Mainframe Computer
(usually connected to several machines) through a communications
line, the acronym DNC, Direct Numerical Control, is used.

1-1
Programming guide

4 X

5
Z

1 2 Y

The manual positioning adjustments 1, 2, 3, 4 and 5 for the worktable,


the reference stops and the spindle turret are all replaced by coded
instructions which control, with a high degree of precision, the
movements of the X and Y axes (in the table plane) and the Z axis
(vertically) until the numerical value entered is actually reached.
The work process is organized as shown in the following diagram:

Printer
2D
digitizing
table

Personal computer

Plotter

3D
digitizing
N

table
C
pr
og
ra
m

5
6

4
7

3
2
8

CNC
work center CN unit

1-2
Programming guide

In order to understand what operations machines can perform, their


various shapes and features must be divided as follows:
a) by STRUCTURE i.e. general shape;
b) by TYPE, or characteristics of the operating units.

Structure a1: Open machines - SA


Structure a2: Open machines with inclinable table (4 or 5 axes)
Structure a3: Mobile table fixed bridge machines - PF
Structure a4: Mobile bridge machines - PM

Type b1: In-line, parallel head machines


Type b2: Revolver - R8
Type b3: Automatic tool change units - TCU
Type b4: 5-axis head tool change units - TUCU

represented by a number of standard CMS models:

Structure a1

Structure a2

1-3
Programming guide

Structure a3

Structure a4

Type b1

1-4
Programming guide

4
6

3
7
8

2
1

Type b2

Type b3

Type b4

1-5
Programming guide

The numerical control system can accept “coded” data input in various
ways:
– through manual keyboard entry
– by reading a punched tape
– by reading a magnetic tape or disk
– directly through a “serial” input port, via a cable
and several of these options are available on the same machine.
In each case the system can also store in its “memory” all the data
received, even after the machine has been switched off, and can carry
out the work programs an infinite number of times in the sequential
order in which they were written.

1-6
Programming guide

CHAPTER 2
WORKING SPACE 2.1 MOVEMENT DIRECTIONS
Whatever the TYPE or STRUCTURE of the machine, for
programming purposes the signs and movement direction conventions
are reduced to those for the most simple machines with the workpiece
locked firmly onto the table and the operating unit vertical,
perpendicular to the table plane and mobile along three axes.
If, in actual fact, it is the table that moves, the manufacturer simply
inverts the movement sign of the corresponding axis to ensure perfect
compatibility with this abstract model.
Movement directions are aligned with a right-handed coordinate
system in which the axis directions can be easily identified using the
RIGHT HAND RULE.

If you look at your right hand, pointing upwards with the palm facing
inwards, the thumb, the index finger and the middle finger indicate
respectively the X, Y and Z axes.

2-1
Programming guide

The work space is delimited by the mechanical strokes of the three


axes and, by moving the three axes singly or together, the operating
unit head (i.e. the tool) can reach any point within this space:

Z Y

Within this “box”, simultaneous movements of the three axes are


possible and, in this case, the tool moves through “space”. If, instead,
only one or two axes move together, the movement takes place on a
“plane”. The plane parallel to the table, the XY plane, is the most
frequently used. For movements along the X and Y axes, all the planes
parallel to the table (but at different heights on the vertical Z axis) are
equivalent, as are all the parallel YZ and ZX planes.

Z Y

2-2
Programming guide

The three main planes of the coordinate system are identified precisely
by the SEQUENCE of the axes that define them:
the XY plane has a positive x towards the right and a positive y
upwards and corresponds to the table plane as seen from above;
the YZ plane has a positive y towards the right and a positive z
upwards and corresponds to the vertical plane as seen from the right of
the machine;
the ZX plane has a positive x towards the right and a positive z
upwards and corresponds to the vertical plane as seen from behind the
machine.

XY

X G17 Y

G18
ZX

X Y

G19
YZ

X Y

2-3
Programming guide

2.2 MEASUREMENT UNITS


The measurement unit for axis movements is the millimeter, with a
precision up to three decimal places. Thus, each axis is represented by
a directionally oriented straight line along which we can identify a
sequence of points spaced one thousandth of a millimeter apart.

0 18 19 20 21 22
X

20.56

20.562

In addition, all the points on a plane are represented by Cartesian


coordinates. The coordinates of a point are often written in brackets,
with a comma separating the first, X, from the second, Y, i.e.:
P1(3,5)-P2(9,7)-P3(6,-2)-P4(-2,4)-P5(-1,-3).

P1: X=3 Y=5


P2
P2: X=9 Y=7
P1
P3: X=6 Y=-2
P4
P4: X=-2 Y=4
P5: X=-1 Y=-3

X
origin
P3
P5

2-4
Programming guide

The absolute origin, at “machine zero”, of CMS machines is in the top


right-hand position at the back of the available working space, and the
operating head must return to this position each time the machine is
switched on.

Z+
Y+
machine zero

X- X+

Y-

Z-

To move out of this initial safety position, with the tool at the top right
and at the back of the space where workpieces may be placed, the
“absolute” coordinates of the points to be reached inside the work
“box” will all be negative.

2-5
Programming guide

NOTES

2-6
Programming guide

CHAPTER 3
PROGRAMMING The programs the machines can run are written in a specific
LANGUAGE LANGUAGE in ISO code (an international standard).
Like any other language, it has its own VOCABULARY,
GRAMMAR and SYNTAX, and may be written in a particular
STYLE.
The vocabulary is the complete set of words or instructions that the
NC system can understand and the appropriate Programming Manuals
should be consulted for any information in this regard.
Grammar and syntax explain the rules for using the words and
commands available, and above all their logical sequence (syntax).
For further details, you should consult your Manuals. In this chapter
we will consider the most frequently used rules, i.e. those which are
useful for initiating the operator in the use of the system.
In particular, we will examine the language STYLE techniques
characterizing the CMS STYLE. In other words, an organic approach
to program structuring and the use of certain commands rather than
others on the basis of the experience acquired by our instructors, the
ongoing interchange of mutually useful information with our very
broad clientele, and an extensive series of programs and proven
applications and running in various parts of the world.
In this short Programming Guide we do not intend to rehash the
contents of the manuals provided by the Numerical Control system
manufacturers. We will therefore explain just a few of the most
frequently used programming “words” or “KEYS”, discussing step by
step the instructions required to prepare simple programs and adding,
only if necessary, a few short Geometry Revision Notes where a
“brush-up” may be useful.

3-1
Programming guide

Example: using a pointed cutter, we may want to cut a panel fixed


onto the work table along the path drawn, from point P1 to point P9,
with a circle at the end.

machine zero
Y+

1000
X+

P3
R 50
P4 P5
50
194.586

P6
94.586

650
R 100
P2 P7
172.91

P9
300

P8
P1 R 40

68.44
194.586 100 350 50 100

For the time being, we will ignore the workpiece locking commands
which will be presented later.
Let us consider the entire sequence of instructions step by step, giving
the machine the appropriate instructions for each operation. First of
all, we must position the tool above the workpiece. This is done with a
rapid traverse that brings the tool from machine zero into the correct
position above the starting point of the required PATH.
If we had to move the axes one at a time, we could, for instance, move
the Y axis first, by 650 mm in the negative direction, and then the X
axis, by 1000 mm also in the negative direction.

3-2
Programming guide

In a real job we would use the programming key:


3.1 G90
which means we are using an absolute dimension calculated from the
machine origin (this is a modal function and remains activated until
the reciprocal function command, G91, discussed later, is given), and
also:
3.2 G00
which is also a modal function and indicates that we want to move the
axes at the highest speed available on our machine. Thus, by entering

G90 G00 X-1000 Y-650


we can position the tool at P1.
The numerical control system automatically distributes the two axis
movements and the resulting motion is along the diagonal.
We must now bring the tool down onto the workpiece, but first we
must enable the operating head required and start up the motor:
3.3 T....
To choose head 11, for example,
you must enter: T11
3.4 M3
If a “right-handed” cutter is used, this command makes the motor
rotate clockwise
3.5 S....
To make the motor rotate at 18000 rpm M3 S18000

We can now bring the tool down, initially at fast speed (without any
need to specify it again, as the G00 command given previously
remains active):
Z20
and then to lower the tool onto the workpiece at a lower speed
(supposing that the correct cutting height is, for example, Z=-5) we use:
3.6 G01

3-3
Programming guide

which indicates a rectilinear movement at the speed specified in


mm/min. by the code:
3.7 F....
G01 Z-5 F1000
(In other words, the tool is brought down onto the workpiece at the
correct height, Z=-5, AS THE VALUES ENTERED ARE
ABSOLUTE, BEING CALCULATED FROM THE ORIGIN. Thus,
in the initial movement the path covered brought the tool to 20 mm
above the workpiece and now the second movement of 25 mm has
brought the tool to 5 mm above the workpiece).
All the coordinates of the points required could be calculated from the
origin, but it is much more convenient to use incremental
programming in which each movement is calculated from the last
point reached.
3.8 G91
This command means that from this point onwards the coordinates
will be written in the incremental mode (until the G90 command is
entered again). We now proceed with the first block as far as P2:
G91 Y300 F3000
at a new speed suitable for cutting the workpiece.
We continue in a similar manner as far as point P5.

GEOMETRY REVISION NOTES


To find the components of an oriented segment with their respective signs, substract the coordinates of their
starting points from those of their end points:
Y Y

+25 P2 +5
P2

da
–21 +18
X
db
+10
P1

P1
+4 +18 X –15

dx=Xp2-Xp1=18-4=14 dy=Yp2-Yp1=25-10=15 dx=Xp2-Xp1=-21-18=-39 dy=Yp2-Yp1=5-(-15)=20


and, once these components are known, the distance between two points can be found by applying
Pythagora’s Theorem:
da= 142 + 152 = 20.518 db= 392 + 202 = 43.829

3-4
Programming guide

Recapping up to point P5:


G00 G90 X-1000 Y-650
T11
M3 S18000
Z20
G01 Z-5 F1000
G91 Y300 F3000
X194.568 Y194.568
X100 Y-50
X350
The path continues with an oriented curve, in that we must proceed in
a COUNTER-CLOCKWISE direction:
3.9 G03
The x and y coordinates of the end point are programmed incrementally,
and the radius of the counter-clockwise arc is indicated by the letter R:
G03 X50 Y-50 R50
and we continue with G01
G01 Y-94.586
To proceed along the next arc, we must use:
3.10 G02
clockwise arc: G02 X68.44 Y-172.91 R100
and again G01 G01 X100
and again G02, if we want to proceed along the arc in a clockwise direction:
G02 X0 Y0 I40 J0
where I and J represent the coordinates of the center of the circle, i.e.
the distance between the starting point of the circle to the center along
axis X (value I) and along axis Y (value J).
We now lift the tool away from the workpiece along the vertical axis
Z in a single rapid movement as this time we are not moving towards
the workpiece but an empty space. We can now stop spindle rotation
and return to the X and Y zero position:
G90 G00 Z20
M5
X0 Y0
Lastly, to end the program we use the key:
M30

3-5
Programming guide

For greater clarity, a more detailed discussion of the programming of


arcs and circles in general may be useful:

(x – 305.414, y – 350)

P7

R 100

(x – 305.414, y – 450)

P8
(x – 236.974, y – 522.91)

The same arc can be programmed in four different ways:


a) absolute with radius:
G90 G02 X-236.974 Y-522.91 R100
b) incremental with radius:
G91 G02 X68.44 Y-172.91 R100
c) absolute with center coordinates:
G90 G02 X-236.974 Y-522.91 I-305.414 J-450
d) incremental with center coordinates:
G91 G02 X68.44 Y-172.91 I0 J-100
where I, parallel to the X axis, and J, parallel to the Y axis, indicate
the incremental value (with their signs) between the starting point and
the center of the circle.

3-6
Programming guide

Complete circles must be programmed with the I and J center


coordinates.

R 10
0 R 40

P9
(x – 136.974, y – 522.91)

absolute
G90 G02 X-136.974 Y-522.91 I96.974 J-552.91
incremental
G91 G02 X0 Y0 I40 J0

3-7
Programming guide

We will now illustrate the use of some keys specific to the OSAI
numerical control system, i.e. the three-letter keys additional to the
standard G, T and M type keys.
Of these we will now use the key:

3.11 (DPI,....) choice of the interpolation plane

Circular interpolation can take place in any plane, XY, YZ and XZ,
chosen using the appropriate three-letter key:
(DPI,X,Y) interpolation in the XY plane
(DPI,Y,Z) interpolation in the YZ plane
(DPI,Z,X) interpolation in the ZX plane

(If, at the beginning of the program, no function is defined,


interpolation in the XY plane is automatically enabled by default).

G02 G03
G17
G1 8
9 G1
G0 2
3 G0

X Y
G0 3
2 G0

3-8
Programming guide

GEOMETRY REVISION NOTES

If we define a given arc by indicating two points, 1 and 2, and the radius R, the only possible
doubt lies in whether we are referring to the minor or the major arc of the plane angle.

For numerical control purposes,


the former is indicated
by default and the latter
by writing a minus
sign (-) in front of the R
radius value.
(It does nit indicate a
negative radius which 2
would be impossible).
R
E.g.:
G02 X.. Y.. R30 1
G02 X.. Y.. R-30

Now that we know how to move a tool along a path, let us consider,
for instance, how we would use the same program to make two
identical parts one after the other. This will clarify the meaning of the
terms SETTABLE ORIGIN and program NESTING.

Y+

2500
1000
X+
650

ORA 2 ORA 1

3-9
Programming guide

We could use the same cycle described above and, at the end of the
work path, after raising the tool in the vertical Z axis, move it in the
absolute mode to the starting point of the second workpiece. But it is
much better to use Settable Origins:
3.12 (UAO,...)
Any movements made after entering this key can be related to a
maximum of 9 new origins, different from the “MACHINE ZERO”,
which can also be recalled however using (UAO,0).
The X,Y, Z values of these origins can be modified directly on the
machine. The advantage they offer is immediately evident, i.e. even if
the workpiece positions change on the machine, there is no need to
modify the program. All that is required is an adjustment in the
appropriate ORA table of the value of the corresponding origin setting.
Also, using “nesting”, we can avoid the need to rewrite the left-hand
path instructions that are identical to those for the right-hand path.
We thus discover the benefits of structured programming:
– easier readability of programs
– assurance that any changes are automatically made throughout.
N.B.: To make movements in respect of the machine zero, we use the
G79 code which is not modal.
(CLS,name) Calling subroutines
Subroutines may be called from up to 3 different levels. A main, or
“grandfather”, program can call any number of “father” subroutines,
and each of these in turn can call any number of “son” subroutines.
Any routine can be used as the main program, provided it contains the
M30 end of program key.

PRG1 SUB1 PRG1 SUB1

SUB2
(CLS,SUB1) (CLS,SUB1)

(CLS,SUB2)

M30 M30
PRG1 SUB1

SUB2 SUB3
(CLS,SUB1)

(CLS,SUB2) (CLS,SUB3)

M30

3-10
Programming guide

If we set the ORA1 origin at X-1000, Y-650 and the ORA2 origin at
X-2500, Y-650, the main program takes the following form:
(DIS,“CAPO”)
(UAO,1)
G00 G79 Z0
G90 G40 X0 Y0
M21 right-hand workpiece locked
T11
M3 S18000
(CLS,FREGIO) subroutine FREGIO called
M5
M11 right-hand workpiece unlocked
M00 stop before starting on left
(UAO,2)
G00 G79 Z0
G90 G40 X0 Y0
M22 left-hand workpiece locked
M3 S18000
(CLS,FREGIO) subroutine FREGIO called
M5
M12 left-hand workpiece unlocked
M30
while the subroutine FREGIO, which is called twice to make the two
pieces in sequence, takes the form:
(DIS,“FREGIO”)
G00 Z20
G01 Z-5 F1000
G91 X0 Y300 F3000
X194.586 Y194.586
X100 Y-50
X350 Y0
G03 X50 Y-50 R50
G01 X0 Y-94.586
G02 X68.44 Y-172.91 R100
G01 X100 Y0
G02 X0 Y0 I40 J0
G90 G00 Z20
where we have also used a three-letter code, DIS (meaning display), to
display the name of the program being run on the Numerical Control
video. This code can be used to display on the video any message
written between the quotation marks.

3-11
Programming guide

The two programs, CAPO and FREGIO, must of course be recorded


in the NC memory under these names. Thus, calling the CAPO
program, the FREGIO program is automatically run as a subroutine at
the points where it is called.
Between the machining of the first and second pieces, the following
stop code was entered:
3.13 M00
to stop the program and restart it by pressing the start button. The
program is then completed with the vacuum locking and unlocking of
the workpieces in the two independent areas of the table, left and
right, to allow for the loading and unloading of the workpieces before
and after machining.
3.14 M21, M11, right-hand locking and unlocking;
M22, M12 left-hand locking and unlocking
We now come to the use of tool length compensation to avoid changing
the program if a different cutter is used or if the same cutter is shortened
by sharpening:
3.15 T11.5 M6
The operator knows the fixed distance (ZMACHINE) between the spindle
in the absolute position Z=0 and the work table, as it is a fixed
machine datum. He also knows the height B (sinking) above the table
that the cutter tip must reach to begin machining. When selecting the
tool, he therefore indicates a NOMINAL LENGTH (Hpr) from the
spindle reference plane to the tip of the tool inserted in the collet. If,
on measuring in the factory, this dimension is found to be different
from the nominal value, it is sufficient to vary the corresponding
compensation value in the appropriate control system table to
automatically make up for this difference.

MACHINE 0

Hpr=100
ZMACHINE=310
Z(UAO,1)

WORKPIECE 0
B

H workpiece=20
H underpiece=25
worktable

3-12
Programming guide

In the example illustrated in the figure the workpiece origin (UAO,1)


is on the surface of the workpiece. In our case, we must therefore
enter a negative (UAO,1) value in Z of 265 mm:
Z(UAO.1)=ZMACHINE-HWORKPIECE-HUNDERPIEC E; Z(UAO,1)=310-20-25.
In the NC compensation table we enter the real tool length value
which is easily measured using a PRE-SETTING instrument.
When using tool length compensation, you must therefore proceed
with care, remembering to record the right value in the length
compensation table. You must also remember to enable the length
compensation in the program before lowering the tool in the vertical
Z axis and to disable it when the tool is raised.
N.B.: Positioning in Z is made 20 mm above the actual workpiece
(safety height).
Compensation is enabled by adding to the head call code, for example
T11, the compensation number required preceded by a decimal point
(e.g.: T11.5 for compensation 5) and then calling the compensation
enable key, M6 (i.e. T11.5 M6). The compensation value enabled is
taken into account as from the next movement made in the vertical Z
axis. To disable it, the instruction used is T11 M6. In other words, the
M6 compensation enable key is called a second time, but in this case,
however, as no corrector number is indicated (and no decimal point is
written separating the head number from the compensation number)
any compensation previously enabled is now disabled.
The compensation is actually eliminated with the next vertical
movement, but only when working with absolute coordinates.
(Remember to rewrite G90, if you are working in the G91 mode).

3-13
Programming guide

3.16 G29, G28, G27 Acceleration control


Looking at our work path, we may notice that between one block and
the following there are “sharp corners”. Also, in some cases, for
example at points P3 and P8, when the end point of the block is
reached, to continue on to the next block the motion direction of one
axis must be inverted.
To change direction when driving a car at fast speed,
it is obviously not possible simply to go into reverse.
F We must first brake sufficiently to reach, at least
momentarily, a speed of 0. We may then accelerate in
block change reverse until we reach the desired speed once more.
By “default”, NC machines operate in the G27 mode,
i.e. in each single block there is a portion (ramp)
G29 during which acceleration takes place up to the
programmed speed F and, before the end point is
reached, another ramp for braking. However, if we
t want to cut out two large tangent arcs, in contouring
jobs for instance, a braking action with a dead stop at
the end point of the first arc would leave a mark on
F the workpiece. Using the modal function G28, we can
instruct the machine to perform a block change
without slowing down.
G29 allows us to brake completely.
Great care should be taken in the use of these
commands. If we were to use G28 in the program we
G28 have been discussing so far, we would not obtain a
correct stop at the end of each block and the corners
would be rounded, thus altering the shape of the path.
t Also, we would considerably shorten the life of the
mechanical parts because, by instructing the machine
“not to brake” when it has to go around very sharp
F corners, we force it to make very abrupt movements
with violent braking and acceleration that are
damaging to drive components.

G27
limit speed
t

3-14
Programming guide

The example discussed so far concerns a job that may be compared to


a pencil line drawn on a sheet of paper and that follows a path
corresponding to the “cutter center”. However, if we have to use a
cylindrical cutting tool or a shaped contouring tool, it is immediately
clear that the tool center path would not coincide with the finished
profile of the part. It would also be absurd to “pad” the path by adding
the value of the tool radius, or if internal, to “pare” it by subtracting
this value. Each time the tool is sharpened or a different tool is
selected, we would have to repeat the calculations.

3.17 G41, G42, G40 Cutter radius compensation


The compensation may be made to the left or to the right depending
upon whether the tool is located to the left or to the right of the “good”
workpiece along the oriented path we want to machine. (To determine
what is left and what is right in relation to the path, you need only
think of each segment as though it were an arrow looked at from
behind with its point facing away from you. You can see immediately
whether the tool should be moved to the left or to the right).

G41 G42

Using codes G41 and G42, cutter compensation is enabled and, using
G40, it is disabled. The programming of the workpiece geometry
follows the path of the finished part and the “cutter center” is
automatically displaced by a value equivalent to the radius recorded
in the compensation table.
The following example clarifies the use of these techniques.

3-15
Programming guide

3.18 Example No. 1


Small 500x250 mm rectangular door, 40 mm links and groove.

55

5
Ø 40
50

16

R 40
ORA1
Ø 20

20
150

250
50
400 50 30

500

420
180
8

500

3-16
Programming guide

The design of the program required to make the part starts with an
analysis of the machining operations to be performed:
a) cutting the contour;
b) cutting the groove.
The overall program will therefore consist of a “father” (or main
ANTINA) program and two “son” programs (or subroutines). Next the
tools required are selected:
– for the first path, a cutter with nominal diameter of 40 mm; radius
compensation is selected to take care of any differences (see
CONTOR);
– for the second path, a tool with a diameter equal to the actual width
of the groove, 20 mm, is selected and the groove path followed
corresponds to the “cutter center” (see CANALE).
Consequently, two different kinds of lead-in to the workpiece are
selected:
– for the external path a lead-in arc and a symmetrical lead-out with
a 5 mm overlap;
– for the internal path, the tool is gradually lowered into the groove
which is machined in a single pass with a symmetrical lead-out at
the end, again with a 5 mm overlap.
Finally, a common workpiece origin is selected for both cycles at the
center of the two lead-in/lead-out quarter circles.
The values of this position are memorized as ORA1.
The cutter compensation value for the first operation is recorded in the
machine memory, K=40 (diam.=40).
(DIS,“ANTINA”)
(UAO,1)
G00 G79 Z0 safety return to Z=0
G90 X-250 Y50 traverse to ORA1 origin
at the programmed path point
M21 vacuum workpiece locking
T 11.1 M6 head 11 called, comp.1 enabled
M3 S12000 machine start up at 12000 rpm
Z20 position at 20 mm above
(CLS,CONTOR) CONTOR program called once
G00 G79 Z0
G90 X-300 Y-50
M5 motor switched off
T12.3 M6 head 12 called, comp.3 enabled
M3 S18000 machine start up at 18000 rpm

3-17
Programming guide

Z20
(CLS,CANALE) CANALE program called
G00 G79 Z0
M5
M11 unlocks workpiece
M30 end “father” program

(DIS,“CONTOR”)
G00 G91 Z-50 incremental down stroke
G01 G41 X-50 F4000 cutter radius comp. enabled
with 4 m/min. feed
G03 G28 X50 Y-50 R50 quarter circle lead-in
G01 X250 contour path blocks
r-40
Y-250
r-40
X-500
r-40
Y250
r-40R X255
G29 G03 X50 Y50 R50 quarter circle lead-out
G01 G40 X-55 cutter radius comp. disabled
G00 Z50 return up stroke

(DIS,“CANALE”)
G91 G01 G28 X50 Z-36 F4000 lead-in with Z down stroke
G29 X200
Y-150
X-400
Y150
G28 X205
G29 X50 Z36 lead-out with Z up stroke

Observe carefully the BLOCK sequence. Note that for the first path
(CONTOR), the finished part profile is programmed and the cutter
center path is displaced outwards by the compensation function. For
the other path (CANALE), instead, the cutter center path is located
precisely in the middle of the groove.
The r key inserts an automatic link between the rectilinear paths.

3-18
Programming guide

< N2 < N14

3>
N
3

N1
N12 > N4 >

>
>

N
11

5
<
20
N

>
N
N

28
<
N26 > N21 > N27 > N22 >
N10 >

N23 >

N6 >
N25 >

< N24
<

7
N

N
9

< N8

<
Now consider the machining of the outside.
For this path, the automatic NC generated link option was selected.
Thus only the horizontal and vertical segments were programmed as
far as the points where they intersect. The link path with its desired
radius was obtained by entering the key r.

3-19
Programming guide

If, however, we wanted to guarantee the width of the groove even after
the tool used had been sharpened several times, we would have to use a
smaller diameter tool and follow the groove path twice, on the two sides.
Using this technique we could also make the groove corner radius
smaller, 10 mm for example.
The path of the side being machined by the cutter is programmed with
automatic links. A 0 radius link is used on the internal corner so that
the tool can “roll” around it smoothly and without any break in
continuity, while a 10 mm radius link is used on the external corner.
In this case, the tool is on the inside in relation to the programmed
profile and, consequently, the compensation value cannot exceed
the radius value.
The program now becomes:
(DIS,“CANALE”)
N20
N21 G91 G27 G41 G01 X20 F4000
N22 X60 Z-24
N23 X200
r0
N24 Y-130
r0
N25 X-380
r0 Programmed point,
the arc is machined as
N26 Y130 an automatic link
r0 with compensation on

N27 X200
N28 G03 X0 Y20 R10
N29 G01 X-220
r10
N30 Y-170
r10
N31 X420
r10
N32 Y170
r10
N33 X-220 Programmed point,
the arc is machined as
N34 G40 X-60 Z24 an automatic link
N35 X-20 with compensation on

N36 G29 G00 X90 Y90

3-20
Programming guide

A 14 mm diameter tool was selected that can be sharpened several


times, while still maintaining a constant groove width.
Once the pass is finished, the tool, which remains at the bottom of the
groove, moves to the other side through a half circle with
compensation on, and then proceeds along the other side in the
opposite direction. In this way the cutter produces two equivalent
finishes. In the drawing, the tool is shown hatched when it is at the
bottom of the groove.

z=0

lead-in
z=-24

20

side-change

lead-out

3-21
Programming guide

Below are the most commonly used techniques for enabling and
disabling cutter radius compensation:

with two blocks, 1 and 2, enabling with G41 in block 1:

1 2
1 2
2

The actual cutter center path is modified in the first case with a
“parallel” type movement, following a diagonal route to the outside of
the path, and in the other two cases with a “perpendicular” type
movement, shortening segment 1 to bring the cutter edge in contact
with the next programmed profile.
With two lead-out blocks, 4 and 5, disabling with G40 in block 4:

5 4

4 5 4

At the end of block 4, where G40 is written, the compensation is


disabled and, in the next block, the entire programmed trajectory is
completed.

3-22
Programming guide

The operator is invited to try his hand at programming with the


following cycles. During the User Course at CMS the program listings
prepared will be corrected, discussed and perfected.

3.19 EXAMPLE No. 2

5 20 30 7

7
R

R
5
5

7
START
29

34.5
R
7

7
33.5
65

27
10

9 35 11

3-23
Programming guide

_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________

3-24
Programming guide

3.20 EXAMPLE No. 3

18.75 31.25

20
R
R 30
10.969

17.55
50
6.581

120
102.45

R 15

60

100

3-25
Programming guide

_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________
_______________________________________ _______________________________________

3-26
Programming guide

GEOMETRY REVISION NOTES

The example shows that before writing the blocks, it is absolutely essential to dimension the drawing
correctly, adding the necessary dimensions as required for programming.

In this case, if the drawing indicates the value of the two radii of the “S” as R1 = 30 mm and R2 = 50 mm
and the distance between F and D as 50 mm, the other dimensions must be calculated correctly
(or measured on the scale drawing).

The segment BE is calculated using Pythagoras’s Theorem:

BE = AE2 – AB2 = 6400 – 2500 = 62.45 mm

and therefore

BC = BE – CE = 62.45 – 50 = 12.45 mm
as BD is equal to AF = 30 mm,

CD = BD – BC = 30 – 12.45 = 17.55 mm

and the required exact location of point F is found at 17.55 mm below C.


To find the coordinates of point G and the X and Y components of the arcs to be programmed,
it is sufficient to note that the triangle AGH is similar to the triangle EAB and therefore:

HG/AG = AB/AE HG = AG*AB/AE = 30*50/80 = 18.75 mm

and by subtraction: LD = 50 – 18.75 = 31.25 mm

AH/AG = BE/AE AH = AG*BE/AE = 30*62.45/80 = 23.419 mm

and by subtraction: HF = 30 – 23.419 = 6.581 mm

and KH = 17.55 – 6.581 = 10.969 mm


10.969

A B

K C
30

17.55

G
H
D
F L
6.581

50

18.75 31.25

50

3-27
Programming guide

It is essential to know the geometry of right-angled triangles as this is very useful for calculating the
coordinates required.
Below is a table of the most frequently used formulas:

KNOWN values: Values to be CALCULATED:

c = a2 + b 2
a–b a = arctg a/b
b = 90° – a

b = c2 – a 2
a–c a = arcosin a/c
b = 90° – a

b a = c2 – b 2
c b–c a = arccos b/c
a
b = 90° – a
a
b b = a/tga
a–a c = a*sina
b = 90° – a

b = a*tgb
a–b c = a/cosb
a = 90° – b

a = b*tga
b–a c = b/cosa
b = 90° – a

a = b/tgb
b–b c = b/sinb
a = 90° – b

a = c*sina
c–a b = c*cosa
b = 90° – a

a = c*cosb
c–b b = c*sinb
a = 90° – b

3-28
Programming guide

G02 G03
G17
G1 8
9 G1
G0 2
3 G0

X Y

(DPI,X,Y) etc.
G0
2 G 03

interpolation plane selection


Y

G90 absolute programming (referred to the present origin)


X

G91 incremental programming


X

X–

Y–
G79 absolute programming (referred to the machine home position
x
G00 y
z
Tool
a position

G00 [Z]

b Z

G00
Y

rapid traverse OP X

G01
Z
Y

X
OP

G01 linear interpolation

Z G02
Y

X
OP

G02 circular interpolation (clockwise)

Z G03
Y

X
OP

G03 circular interpolation (counter-clockwise)

F axes feed rate

3-29
Programming guide

X–

(UAO,0) suppression of workpiece zero offset Y–

X–

(UAO,1) settable workpiece zero offset


Y–

Y
tool

G40
centre

suppression of CRC (cutter radius compensation) X

F..

Y
R
G41 CRC (cutter radius compensation) left-hand
X

F..

Y
R
G42 CRC (cutter radius compensation) right-hand
X

t
G27 block transition with speed reduction
F

t
G28 no speed reduction
F

t
G29 fine exact positioning

3-30
Programming guide

M03
M3 spindle clockwise revolution

M04
M4 spindle counter-clockwise revolution

M05
M5 spindle stop

S programmable tool speed S

T... tool call


T1.n M6 .n tool-offset
M6 enabling
Programma
PRG 1
N..
N..
N . .M00
N..
N..

M00 programmed stop


PRG 1
N..
N..
N..
N..
N . . M30

M30 main program end

M... auxiliary function (clamping and various)


typical of each machine

3-31
Programming guide

NOTES

3-32

You might also like