CNC Programming Techniques Overview
CNC Programming Techniques Overview
Advanced techniques
in computer-aided manufacturing
Course notes
According to the sequence number, the preparatory function codes are programmed. They are
recognized by the word 'G'. These are codes for initializing the required modes for
the interpretation of a movement, for example the choice of the unit system, the advance system,
of the plan used for interpolation, the type of movement, and so on. For the block
Of the NC instructions presented in Figure 1-1, the following meaning can be found for the ...
different codes used. More details as well as a more comprehensive list of available codes
will be presented in the following sections.
G02 Circular motion.
Code G (preparatory) specified with 2 digits from 0 to 99.
X + 05.3 Notes specifying the coordinates associated with the movement
(5 digits before the decimal point, and three decimals)
possible in the metric system
Y + 05.3
Z + 05.3
I + 05.3 J + 05.3 K + 05.3 as above
U + 05.3 V + 05.3 W + 05.3 as above
A + 03.3 B + 03.3 C + 03.3 angular coordinates
F05.2 Definition of feed rate
S05 Definition of the spindle rotation speed in rpm
M03 Definition of auxiliary functions (pin start)
T05 Specification of the tool number to 2 digits
D03 Specification of the registration number for tool sharpeners
The plus sign (+) is taken by default, as well as the leading zero before the decimal point. The spaces
between the words are not necessary. In fact, each space takes up 1 byte of memory, which
should be avoided as much as possible.
From the above formats, we can see that the linear coordinates can be programmed.
with an accuracy of 1 micron and angular coordinates within 1 thousandth of a degree. This
is obviously not related to the accuracy of the movement provided by the operating parts of the
machine.
Block number
Preparatory functions or models: (Letter-address G)
Coordinates of the point to reach
Spindle speed
Advance speed
Tool number and associated register
SYS856 9
Advanced techniques in computer-aided manufacturing
1.2 Positioning mode specification
There are two commands that allow you to specify the machine positioning mode for
all the movements that will follow the introduction of the code.
These commands are modal; they remain active as long as the other command.
of the same family is not specified. As illustrated in the following figure, when the mode of
positioning is set to absolute (G90), the coordinates of the points defining the trajectory
are all specified in relation to the program reference system.
120 30
60
P4
30
P1 P3
P2
P4 P3
90 60
30 P1 P2
X
50 150
200
SYS856 11
Advanced techniques in computer-aided manufacturing
In the case of the relative or incremental positioning mode, the coordinates of a point of the
The trajectories to be achieved are expressed relative to the current position of the tool (Figure 1-3).
Two commands allow the specification of the unit system associated with a program.
One or the other of these modal commands must be specified at the beginning of the program and must not
never be changed afterwards. Some controllers cannot convert the values of
shifts of tools and reference systems from one unit to another during execution
program.
The G20 and G21 codes particularly affect the following parameters that must be expressed
in the chosen unit system:
SYS856 13
Advanced techniques in computer-aided manufacturing
1.4 The preparatory G codes of the movement
The G00 code allows for maximum speed movement of each of the specified axes in this
mode in order to reach the requested position. This is a modal command that remains active.
as long as an order belonging to the same group is not specified. The
The group corresponding to tool movements includes the following G codes:
The unsynchronized movement is carried out at maximum speed for each of the axes.
movement does not end simultaneously for each axis. The axis with the most displacement
who will be the first to finish their action (on the basis of identical maximum speed for
each axis). In a synchronized movement, all axes complete their movement in
simultaneous. It is recommended to prioritize synchronized quick movement. The adjustment is
performed from the machine parameters table of the controller.
40
G00X80Y40
Unsynchronized
Synchronized
80 x
This is a linear advance movement performed from a current point to a programmed point. The
The coordinates of the point to be reached are specified in the current block as well as in the following blocks.
the introduction of interpolation code G01 (modal code). This movement is performed at the speed
pre-programmed in advance through the word 'F' (feedrate). This movement being
synchronized, the speed component along each of the axes is proportionally expressed
to the individual distances traveled.
SYS856 15
Advanced techniques in computer-aided manufacturing
40
Current 80
L= 40 2+ 80 2
80
Component of speed along x: Fx= ⋅ 200
L
40
Component of velocity along y: Fy= ⋅ 200
L
Example 1.1:
SYS856 17
Advanced techniques in computer-aided manufacturing
Circular interpolation G02, G03
G2
G3
G03: counter-clockwise
The parameters to specify when entering the G02 or G03 code are as follows (Figure
1-7) :
2. The radius of the arc or the coordinates of the center of the arc accompanying the
letters I, J, and K
SYS856 19
Advanced techniques in computer-aided manufacturing
Figure 1-7 Specification of circular interpolation
Pour la méthode recourant à la spécification du centre, ce dernier doit être situé à l’intérieur d’une
Zone of acceptable tolerance relative to the theoretical center. The distance separating the point from
The departure of the arc with the specified center must be sufficiently close to the distance separating the point.
arrival with this same center. If this distance exceeds the limit admissible by the CNC, a
alarm will be triggered (Figure 1-8). In addition, for certain controllers, the coordinates 'i, j, k'
are specified in relation to the starting point of the circular trajectory.
In the case of the method specifying the radius of the arc, two trajectories are possible.
since the center can take two positions, as shown in Figure 1-9. The ambiguity is
resolved by specifying a positive radius if the desired trajectory is the arc subtended by a
acute angle and a negative radius for the arcs subtended by an obtuse angle (> 180 degrees, arc the
longer).
SYS856 21
Advanced techniques in computer-aided manufacturing
B B→ C (270o) G02 X -50 Y0 R-50
x
50 G02 B→ C (90o) G02 X -50 Y0 R50
SYS856 23
Advanced techniques in computer-aided manufacturing
The following example presents the specification of circular interpolations according to the two modes.
possibilities.
Example 1.2:
B
+
80
R40
A
40
R60
C
20 x
50 90 150 X
METHOD R METHOD I, J, K
A→ B G90 G03 X90 Y80 RY0 F300 ; G90 G03 X 90 Y80 I0 J40 F300
B→ C G02 X150 Y20 R60 F301; G02 X 150 Y20 I0 J-60 F301
A→ B G91 G03 X 40 Y 40 R 40 F 300; G91 G03 X 40 Y 40 I 0 J 40 F 300
B→ C G91 G02 X 60 Y -60 R60 F301 G91 G02 X 60 Y -60 I 0 J -60 F 301
Interpolation plans :
The specification of circular interpolation being in a plane, this interpolation plane must therefore
to be selected before the order is activated. The three planes XY, ZX, and YZ are
respectively activated via codes G17, G18, and G19 (Figure 1-11). By default, all the
Controllers work in the XY plane (G17). These codes are of modal type.
SYS856 25
Advanced techniques in computer-aided manufacturing
G17 = XY
G18 = ZX
G19 = YZ
G17 by default
SYS856 27
Advanced techniques in computer-assisted manufacturing
b) circular interpolation (G02, G03)
speed mm/min
F=
circumferential distance mm
Example 1.3: For a feed rate at the tool tip of 500 mm/min and a
a displacement of 100 mm, the reverse time advance is calculated as follows:
⎛ F= 500mm/min = 5 ⎞
⎜ ⎟
⎝ 100 ⎠
The advance speed is the result of the speeds of each axis, linear or rotational (without any
distinction).
c
Y
G01 F91 Xa Yb ZcFf ; b a
X
a⋅ f
According toxFx=
L
b⋅f
According toyFy= L= a 2+ b 2+ c 2
L
c⋅ f
According to z Fz=
L
SYS856 29
Advanced techniques in computer-aided manufacturing
When a rotary axis is controlled, it is considered a linear axis with units in
degrees. A linear compensation is made, which skews the reached speed.
90⋅ 200
Advance along the rotational axis Fc= L= 1002+ 90 2
L
100 . 200
Fx=
L
Auxiliary functions allow the activation of different options exhausting the machine. The
The following list presents the available codes with the Hitachi Seiki machine tool.
M0 machine stop
M01 optional stop
M03 clockwise broach (CW spindle ON)
M04 counterclockwise spindle ON
M05 stop spindle
M06 automatic tool change (auto tool change sequence)
M08 jet fluid (flood coolant)
M09 stop coolant
M19 stop spindle and orient
M50 fluid through the pin (THRU coolant)
SYS856 31
Advanced techniques in computer-aided manufacturing
1.7 The specification of tool changes
The tool change sequence is variable and depends directly on the machine rather than
the controller equipping it. In the case of the Hitachi Seiki machine tool with changer
of the tool, the following sequence must be followed:
T0;
T0 M06;
T01;
TXX M06 provokes physical change
T01 M06; TXXXX prepares the tool, chain rotation for
T02; the position of change
G90 X0 Y0 Z0;
machining with T1
T02 M06;
T07;
machining with T2
T07 M06;
T0;
machining with T7
T0 M06;
M2
The T0 tool is a 'dummy' tool. It is used to initialize the machine with a free state.
tool in the spindle.
SYS856 33
Advanced techniques in computer-aided manufacturing
machining
7. withdrawal movements to references
8. brooch, watering and others (stop)
9. change of tool
10. end of program
Example of program
Start section
Section initialization
G20 G40 G49 G50 G64 G69 (imperial, cutcomφ , cutcom L, scaleoff
G80 G90 machining mode, rotation modeOFF,
M69 M79 cycleOFF, ABS)
(clamp B (tilt)OFFclamp Aoff
G91 G30 G0 Z0
G30 X0 Y0
G30 A0 B0
T0
T0 M6
TXX
G91 G30 Z0
G30 X0 Y0 Sequence
G30 A0 B0 of changing tool
(Hitachi)
TXX M6
TXX
Machining
SYS856 35
Advanced techniques in computer-aided manufacturing
G90 G43 G00 Z_HXX activation compensation length
G91 G30 Z0
X0 Y0
To M6
End of program.
M30
SYS856 37
Advanced techniques in computer-aided manufacturing
Chapter 2
Reference systems and tool offsets
2.1 Reference systems
The programming of tool paths for a given part always refers to a system of
coordinates from which the points of the trajectory are expressed. This system is chosen in
the FAO system used for programming. The machine tools all operate from
of a machine coordinate system whose origin, called 'machine zero' Om, constitue
the first reference position. The correspondence between the two reference systems must
to be established in the controller so that it can carry out the transformation operations
required for each tool movement expressed in G code with respect to the program reference
OPThe correspondence is easy to establish, the theoretical position of these two reference frames being
known and often physically represented in the customized configuration of the system
FAO of a company. In the case where the assembly of the part in the assembly system is
persistent and repetitive, the theoretical correspondence of reference systems does not pose any
problem. In the case of an imprecise mounting of the part in relation to the reference system
Machine, the exact position of the reference system program must be determined.
Specifically, this operation can be carried out using a tactile probe to determine
the intersection of three faces of the piece, which will become the origin of the program reference frame. In
the cases where this palpation is impossible to determine the program reference, a reference
piece Opmust be established through physical probing, and the theoretical relationship between this part reference and
The program reference must be entered as a compensation input in the controller.
Op
OP
Om
Xm Yp
SYS856 41
Advanced techniques in computer-aided manufacturing
There are two methods to establish program reference systems, either by using a
G92 command manually entered with the machine controller editor or using
offset tables of the reference frame, these being referenced using a G code in the
program identifying the reference frame in which movement coordinates are expressed.
The X, Y, and Z coordinates accompanying the G92 code specify the current position of the tool.
coupe expressed in the reference system program that we want to define. Having palpated the piece
to know the position of the program origin in the machine's reference frameFigure 2-3 ) the
The procedure generally used to define the program reference with the G92 code is to
position the tool at machine zero (G91G28X0Y0Z0) and enter the coordinates with a sign
inverse in order to properly indicate the position of the tool in relation to the program referenceFigure
2-4).
Om G92
(Om)p
Op
When the machine tool controller has the functions of reference shifting (it
it is often an option to acquire), it is possible to define and change the system of
reference very easily directly from the NC machining program. For the Fanuc 15M control, six
reference systems programs can be defined and used within the same program. The
parameters defining these reference systems can be modified at any time through a
command G10 accompanied by the offset values for each axis of the machine. The
The following figure illustrates the program reference shift table as found on
the machine controller console.
SYS856 43
Advanced techniques in computer-aided manufacturing
Offset System 1 System 2 System 3 System 4 System 5 System 6
G54 G55 G56 G57 G58 G59
X 4 8 25 12 4 1
Y -2 5 20 -8 -4 2
Z 0 0 3 2 0 0
A 0 0 0 0 90 0
B 0 0 0 0 0 0
C 90 0 0 0 0 0
Figure 2-6 shows the coordinates of points A, B, C, and D according to the programs
Machining refers to the reference system G54 or G55.
YM YP2
YP1
5 2
G55 XP2
G54 B
D
4 XP1
8
XM
OM 4
A X0 Y2 Z0 X0 Y2 Z0 X-4 Y1 Z0
B X2 Y0 Z0 X2 Y0 Z0 X-2 Y-1 Z0
C X0 Y-2 Z0 X0 Y-2 Z0 X-4 Y-3 Z0
D X-2 Y0 Z0 X-2 Y0 Z0 X-6 Y-1 Z0
Returning to the machine reference system is always possible using the G53 code.
SYS856 45
Advanced techniques in computer-aided manufacturing
2.1.3 Reference system program defined from a part marker
When the part cannot be directly felt to define the program reference frame, a
The reference system must be defined. There are two simple ways to define the reference point.
program from the known theoretical position of the origin program in relation to the reference frame
part. The first is to use the G92 command applied to the G54 system, defined as
being the reference point as felt. The offset parameters considered with G92
corresponding to the theoretical position of the origin of the reference frame expressed in the frame
Program. The following figure illustrates the definition of the program reference using G92.
Yp
G54
YP1
Op
Xp
G541
X1P
O1P
Om
The other way to specify the program reference is to compensate the G54 defined as reference.
part using the G10 command directly in the NC program.
SYS856 47
Advanced techniques in computer-aided manufacturing
2.1.4 Reference positions of the MOCN
YM
2eref.
OM
XM
The technique for positioning the tool at either of the reference positions is the
next :
SYS856 49
Advanced techniques in computer-aided manufacturing
This is a relative displacement of 0 units along each of the axes compared to the position of
reference specified by G28 or G30. The movement is broken into three blocks to avoid
any collision between the spindle and the fixture. The movement to the reference positions is
always a tool withdrawal, so the first axis to move is the tool axis, the Z axis. Afterwards,
Before activating the rotary axes, it is preferable to move the tool away from the fixture using the X axes.
and Y. The command is completed by positioning the axes of rotation to their position of
respective reference.
In the previous sections, the notion of tool positioning is often referred to.
It is important to specify that the positioning of the tool calculated by the FAO systems considers
Actually, as a reference point, the position of the center of the tool at its tip.
However, the machine controller moves the axes by default in such a way as not to position not
the tip of the tool but rather the reference point that consists of the central point of the face of the
broochFigure 2-9 It is therefore essential to inform the controller of the length of the tool.
loaded in the pin and to command a length compensation through a
instruction in code G.
SYS856 51
Advanced techniques in computer-aided manufacturing
In the case where the tool length compensation is not activated, a damaging collision
for the machine can occur. Let us take the example presented in the following figure. A
move to position ZP= 0 is commanded while a tool is loaded in the spindle and
that no compensation has been demanded by the programmer. In theory, the movement will have
to effect the movement of the lower face of the spindle at the surface of the table, this
which causes a collision and the breakage of the machine. The length Ltool(Figure 2-11must be measured
and entry into the tool compensation table of the controller (Figure2-12). The order
Activating length compensation must also be specified in the program afterwards.
from every tool loading or following each return to a reference position. The G43 codes and
G44 allows this compensation (the use of these codes is presented in the following section).
No collision
compensation in specified length!
Atool
SYS856 53
Advanced techniques in computer-assisted manufacturing
The tool length definition table includes two parameters: the nominal length and
the wear compensation. The tool diameter is similarly compensated by means of the same
table. The nominal length is used by the FAO system for planning the
trajectories. In real life, it is difficult to set up a cutting tool exactly according to the
specified nominal length. In addition, during the useful life of the tool, a certain wear in
length and diameter will be observed. Thus, the true length as measured using a
probe or a preset stationFigure 2-13) constitutes the sum of the nominal value and
of wear. The wear parameter should explicitly appear in the table, as it
may be adjusted according to the machining time. If such measuring devices are not
available, a comparator can do the job at low costFigure 2-14 . TheFigure 2-15
summarize well the important parameters to consider when measuring tools, both in
milling only in turning. Considering the three types of tool measurement systems, the system
The optical presetting, dedicated to this task, allows for the control of angles and corner radii.
Length Rayon
T Name
Name Unsure Name Unsure
001 EM05 7,500 -0.010 0 -0.005
002 BEM025
.
.
.
Figure 2-12Definition table of tools (CNC)
Example of calculation made by the machine controller when the length compensation is
activated (G43). The example pertains to the EM05 tool, namely the T1 tool, appearing at the table of the
Figure 2-12:
SYS856 55
Advanced techniques in computer-aided manufacturing
Figure 2-14Comparator for measuring tools
As mentioned above, the useful G codes for activating length compensation are
G43 and G44. These codes must accompany a movement along the Z axis during activation and
the H register associated with the storage address of the offset information must be specified at
default of what, some FANUC models will take the value of the register associated with the number
of tool. Other models will fall into alarm mode. The length compensation MUST be
activated at the first movement in Z following the tool change, otherwise a collision is to
to foresee.
G43 Zxx H01
SYS856 57
Advanced techniques in computer-aided manufacturing
2.2.2 Cancellation of compensation in length
The cancellation of length compensation is done using code G49, or also through
from the sequence G43 H00, the register H00 assigns a zero length to the current tool, which
implicitly causes the cancellation of the compensation. It is very important to know that the codes
Returning to a reference position G28, G30, G30P2, G30P3 and G30P4 cancel
automatically the tool compensations. It is therefore imperative to reactivate the compensation
in length following any return to a reference position, otherwise collisions
become inevitable.
G49
or G43 H00
or a return to a reference position G28 G30 G30P2G30P3G30P4
Code G44 also allows for length compensation. The compensation in this case is
applied downwards. The programmed Z value is subtracted from the value equal to the length
specified tool in the H register. The use of G44 is not widespread. It is recommended to
choose a type of compensation and stick to it for all machining programs to avoid
a possible confusion that could jeopardize the integrity of the machines. The example below
presents the use of the two compensation codes G43 and G44.
Example 2.1:
Length compensation:
Program NC Z commanded H01 = 200 Compensation
G54 G90 G00 X0 Y0 ;
G43 Z0 H01 ; 0 200 200 + 0
G01 Z-30 F500 ; -30 170 200 + (-30)
Z-100 ; -100 100 200 + (-100)
G49 Z0 ; 0 Collision (-200) 0
Z commanded H02 = -150 Compensation
G44 Z0 H02 0 150 150
G01 Z-30 -30 120 -(-150) + (-30)
Z-100 -100 50 -(-150) + (-100)
Devices for measuring tools have been presented above. Another very
simple and direct, without resorting to any device, is often used. It is the comparison
from the tool to a standard. As illustrated in the following figure, the technique involves pressing the tool
on a reference element and note the machine Z coordinate, then redo
the exercise with a standard rather than with the cutting tool. The tool length is deduced by
comparison of machine Z values observed, knowing the standard length.
SYS856 59
Advanced techniques in computer-aided manufacturing
ZM
XM
On
ZO
ZG
Ao
standard LG
TABLE/REF.
Z G= 300
Z G+ LG= Z The+ A O Z The= 280
( G− Z O
A O= Z ) + LG LG= 20
A O= (300− 280+) 20= 40mm
The offset of the tool rays allows for the programmed trajectory in CNC, or directly
in code G, to be compensated by a radial value equal to the specification given in the table of
controller. Just like the tool length, the compensation parameters include a value
nominal (geometric) and a wear value. When the trajectory is developed by hand
"rise", without the aid of a FAO tool, it is common practice to resort to full compensation
from the tool path code G representing the trajectory of the tool center along the
nominal geometry of the drawing. When a CAD system is used, the calculation of the
trajectory compensation is carried out by the software based on the nominal radius of the tool
cutter, as specified in the tool library within the CAD software. Thus, the
the nominal compensation parameter of the radius entered in the controller table is zero, whereas
The wear parameter slightly compensates for the radial difference from the nominal.
and the actual value as measured for the tool. The following figure illustrates a tool path
programmed from a nominal geometry, as well as the offset trajectory of an equal value
in the tool's radius, as measured using a preset station for example. Regarding
the direction of the shift, two G codes allow for a right shift of the
planned trajectory or a shift to the left of the latter. A shift to the
left of a shift to the right when looking in the direction of the tool's movement. An observer
looking in the direction of movement will see a shift to the left or right depending on the
tool position in relation to the trajectory. TheFigure 2-18 illustrates well the difference between these
shifts. When the specified offset value is negative, then the direction is inverted. The
shift to the right becomes to the left and vice versaFigure 2-19).
SYS856 61
Advanced techniques in computer-aided manufacturing
Figure 2-17Trajectory shift NC
SYS856 63
Advanced techniques in computer-aided manufacturing
Figure 2-19Specification of an offset with a negative value
The specification of the offset on the tool radius is done through G41 codes, for a
left shift, or G42, for a right shift. The code must accompany a
real movement along one of the axes of the plane in which the offset is applied. The code must
also to be accompanied by the 'D' register allowing to identify the address where the values of
compensation are specified. The number accompanying the register is not necessarily the one
of the tool.
Just like the length offset, the cancellation of tool radius offset can be done by
two dedicated codes. It can also be done indirectly through codes of
return to reference positions :
or again
SYS856 65
Advanced techniques in computer-aided manufacturing
The radius offset requires the controller to perform a calculation with each movement made. Thus,
certain application rules must be followed by the NC programmer to ensure
the applicability of ordered compensations. As illustrated in theFigure 2-20, the first rule
to be respected concerns the activation of compensation on a linear movement only (G00
or G01). The machine tool controller does not provide for the calculation aimed at the activation of a
compensation on a circular path (G02 and G03). The tool approaching a movement
circular must necessarily be in radius offset mode to avoid any anomaly. The
Figure 2-21illustrates the difficulty that controllers have in compensating for a radius on a movement
circular. To activate a compensation when the first cutting motion is an arc
circular, it involves adding a linear approach movement that precedes the arc of the circle and
order the G41 or the G42 on the added linear motionFigure 2-22 The movement
can be quick or in advance speed without making a difference regarding the
compensation.
G17 G41 G01 Xx2 Yy2 D01 (activation of compensation on a linear movement)
X x3 Yy3 (movement to point 3)
G40 Xx4 Yy4 (complete cancellation of the delay upon arrival at point 4)
P2
SYS856 67
Advanced techniques in computer-aided manufacturing
P3 G41G01Xx 2 Yy 2 Δ01
G02 P3
P2
G40 P4
P1
The technique of adding linear motion to an arc is very common since the
circular arcs are generally used to approach the workpiece during machining of
Profiles of parts. Thus, the tangential circular inlet must be fully compensated in radius.
in order to achieve maximum dimensional accuracy for the machined geometry. TheFigure 2-23
illustrate the approach of tangential circular entry with a linear motion, performed a priori,
from which the compensation is activated. TheFigure 2-24 show the importance of an entry
adequate in the material during the machining of profiles. In fact, in this specific case, the entry with a
an angle greater than 90 degrees causes excessive material removal ("gouging") in the part
useful for obtaining the final piece!
G41
SYS856 69
Advanced techniques in computer-aided manufacturing
o 90
cut
excessive
The controllers have different calculation algorithms allowing for transparent introduction.
simplifying movements or optimizing the programmed trajectories. TheFigure 2-25 and there
Figure 2-26 illustrate some examples of the types of movements made in different contexts.
situations.
SYS856 71
Advanced techniques in computer-aided manufacturing
bisector R center
normal
R
contour to execute point to calculate
In some cases, the controller's read-ahead, limited to two blocks, does not allow for
to adequately compensate the trajectories. This triggers alarms for the controllers so that
to avoid excessive cuts in the piece, resulting from algorithmic aberrations or
Mathematics. TheFigure 2-27name two examples. All scenarios are addressed in
exhaustively in the programming manuals accompanying the machine tool. It is
important to take note of, especially during the advanced development of post-processors.
SYS856 73
Advanced techniques in computer-aided manufacturing
The following example summarizes the use of tool compensations.
Example 2.2:
z y
80
60
40
40
z0
20 20
20
x
G54 100
D01= 15 mm – 0.02
T01 (END Millφ30)
TO1 MO6
SYS856 75
Advanced techniques in computer-aided manufacturing
Chapter 3
The fixed cycles
3.1 Introduction
For all the diagrams presented in this chapter, the solid lines represent a
movements at forward speed while the dotted lines are associated with displacements
rapidly. As illustrated in figure 3.1, there are mainly five typical movements involved
during a machining cycle procedure. The first movement concerns the positioning of
the tool above the first hole to be drilled, in the selected drilling plan using the codes
G17 to G19. The initial level, namely level Z (in the case of G17), is defined as being the plan
z0associated with the coordinate of the displacement point preceding the activation of the cycle. It is about the
withdrawal plan of the tool at the end of the cycle sequence. The second movement is the
quick approach maneuver until reaching the R level, clearance plan. Subsequently,
the drilling movement at feed speed is carried out until the specified depth, then
A bottom hole operation is activated in the case of particular cycles. It should be noted that the
drilling movement #3 can be interrupted in the case of certain types of cycles (drilling
deep). Movement #5 or #6 describes a quick return or fast forward movement, depending on
the type of cycle. The return can be made to two distinct positions, depending on the choice of
Programmer. The first stop position is plan R. The latter is chosen when a
a succession of holes are drilled without the presence of obstacles (islands) between each of them.
The small recess above the surface helps to minimize movement as much as possible.
fast and thus make the drilling of numerous successive holes as efficient as possible. The
the second withdrawal plan is the initial plan (level Z). It allows for a passage above the
obstacles and successfully completes a sequence of multiple drillings by housing the tool in a position
secure. The selection of the return plan is made through codes G99 (level R) and G98
(level Z). The type of increment G90 or G91 as well as the reference plane must
also be specified for all cycles. The default plan is the G17.
1 initial position (return)
fast
x0y0 z0 level Z = z0
advance
6
2
level R (clear none)
x1y1z1
5
3
4 specified depth
4 fund operation
The general syntax of loops in G-code includes, depending on the type of loop, one or more of
following parameters (SEICOS controller of Hitachi Seiki):
G__ GΔΔ X_ Y_ Z_ R_ P_ Q_ L_ F_ E_
SYS856 79
Advanced techniques in computer-aided manufacturing
A G code is used to identify the cycle that will be activated during the processing of information by the
machine controller. The position of the hole in the interpolation plane must be specified from
the same as its total depth. The R level is specified by the word R. The value
accompagnant ce mot est spécifiée relativement au niveau initial Z. Pour certains cycles, une
The hole bottom timing value is specified using the word P. It represents a pause.
expressed in milliseconds, forcing the tool to remain stationary. Regarding the cycles of
deep drilling, the Q parameter defines a drilling depth achieved by
intermittence, that is to say a total piercing through a succession of small drilling movements of
Depth Q. The number of intermittences is specified through the repetition parameter.
"L". The F word specifies the feed rate during the cut. If the return speed differs from the
fast speed or the specified forward speed, it is possible to use the word E in order to
specify a different speed.
SYS856 81
Techniques avancées en fabrication assistée par ordinateur
3.3 Specification of a cycle in absolute mode (G90)
An example of a program allowing drilling in two positions and coming from a system of
FAO (in CL language) could have the following form:
R− 95
G98
G99
The conversion to G code of this program takes the following form in absolute mode:
SYS856 83
Advanced techniques in computer-aided manufacturing
3.4 Specification of a cycle in relative mode (G91)
The same program specified in relative mode would rather have the following specification:
G98
R− 95
G99
G81 X _ Y _ Z _ R _ F_
x0y0z0
Z
G98
R
x1y1z1
G99
SYS856 85
Advanced techniques in computer-aided manufacturing
3.6 Deep hole drilling cycle with 'DEEP hole' or 'Peck drilling'
This drilling cycle applies to deep holes requiring repetitive chip clearance.
during the cut. This is why the drilling is done intermittently. Two codes are
usable for deep drilling are the G73 and G83. In the first case, a tool retract in
rapid is performed over a distance δ, while the G83 code dictates a return to the R plane after
each intermittent movement, which allows for better chip removal, therefore a
finished of upper surface. The value δ is calculated from
G98 G98
R
Q G99
Q
d
Q d
Q
Q d
from the drilling depth Q from which a margin 'd' is subtracted, the value of which is
specified in the machine controller as a fixed parameter. The number of repetitions "L"
is greater than or equal to the total depth of the hole divided by the intermittence.
⎡ depth ⎤
⎢ L≥ Q ⎥
⎣ ⎦
The syntax associated with the drilling cycle with reaming is as follows:
G73 X _ Y _ Z _ R _ Q _ F_ L _
G83
SYS856 87
Advanced techniques in computer-aided manufacturing
3.7 Tapping cycle (G74, G84)
The tapping cycle allows the machining of threaded holes according to a conventional "pitch" (G84) or
an inverted "step" (G74). Since it is a rigid tapping, not all machines are
necessarily able to support the movements of this cycle. In the case of the G74 cycle, the
The programmer starts the process by activating the pin in the counterclockwise direction (CCW).
Rapid movement positions the tool at plane R, then the cut is made according to the length.
specified. At the bottom of the hole, the pin temporarily changes its direction of rotation to allow
the removal of the tool without damaging the machined threads. The return to the R plane or the initial Z level is
ends with the initial rotation of the spindle. The opposite of the process describes tapping.
conventional 'step' fillets.
R R SH (G99)
fond (SAH)
brooch
(SH)
(G74) (G84)
In the case of the tapping cycle, the machine operator should not intervene during
the execution of the cutting movement by changing the rotation speeds or feed through
of the "feedrate override" and "spindle override" potentiometers. One way to prevent it is
to set the controller in tapping mode via G-code G63. This setting is necessary
to ensure the integrity of the machine part assembly.
G63G74X _ Y _ Z _ R _ P _ F
Following the tapping, the machining mode can be reactivated via the G64 command.
SYS856 89
Advanced techniques in computer-aided manufacturing
3.8 Fine boring cycles or boring cycles with the boring bar
The fine boring cycle allows the production of holes with great precision. A boring bar is
used with this type of cycle. A hole bottom operation allows the spindle to stop for
remove the tool from the machined surface. The tool is then quickly withdrawn from the hole.
retraction of the tool tip by a specified value indicated by the word Q prevents
damaging the part during tool withdrawal. The difference between G76 and G87 codes is
direction in which the machining is performed. Pushing machining is performed from top to bottom
of a hole with a withdrawal without contact with the reamed wall. The boring by pulling involves positioning
the tool at the bottom of the hole then machining by pulling the tool, either from bottom to top of the hole.
by pushing timing at
by pulling bottom of the hole
value of
disengagement at
bottom of the hole
Z
G98
R
G99
Since 'Q' is a modal value for all cycles, and its meaning differs
in the cases of boring and drilling deburring, it becomes very important to always define it at
new when activating a cycle (do not consider the default values).
Given that the tool must be moved a distance 'q' in a fixed direction and
predetermined in the execution routine of the cycle, the tool tip must be
preferentially oriented during the loading of the tool into the spindle. The orientation of the
The brooch must therefore be activated via code M19 prior to the execution of the cycle.
SYS856 91
Advanced techniques in computer-aided manufacturing
3.9 Drilling and Counterboring Cycles
This cycle allows for drilling with a reamer to achieve holes of a precise depth at
flat bottom. The cycle is activated by G-code G82 and involves a timing parameter in
bottom of the hole in order to improve the surface finish and the precision of the hole. The other movements of the
cycles are identical to simple drilling.
G82 X _ Y _ Z _ R _ P _ F _
Several boring modes are also available as basic cycles for most of the
machine manufacturers. For Hitachi Seiki, the G85, G86, G88, and G89 cycles offer
variants in terms of movement to meet most needs in the field
precision hole machining.
The cancellation code for cycles is G80. This code can be specified alone on a block or be
accompanied by movements.
Indirectly, any cycle will also be canceled when the G00, G01, G02, or G03 codes are
activated while the machine is in active machining cycle mode.
SYS856 93
Advanced techniques in computer-aided manufacturing
Example 3.1:simple drilling cycle (G81)
Zp
Xp
The program allows for the successive drilling of holes at points P1 and P2 with a retraction to the plane.
R is read as follows:
G90 G0Z−1.0
G99 G17 G81 X 1.5 Z−1.6 R− 0.45F6.0
X 2.5
G80
G0 Z0 (withdrawal to the source)
The specified Z depth as a cycle parameter is calculated as such for a drill of diameter
equal to 1 inch and an angle of 120 degrees at the tool tip (a margin of 0.05 inch is
considered in order to properly break through the part with a complete drilling):
φ1.0
φ/2 0.5
δ Tg 60= δ= ≈ 0.3
δ Tg 60
SYS856 95
Advanced techniques in computer-aided manufacturing
Example 3.2:Drilling cycle with pecking G83
Zp-1.0 Z
0.75 R
r = 0.05''
3 inches
The diameter of the hole is equal to 1 inch. Considering intermittent cutting movements of
0.75 inches, and a total depth of 4.1 inches, the number of intermittences is calculated as
suit
G90 G0Z−1.0
G17 G98 G83 Z− 4.10 Q 0.75 L4 F6.0
SYS856 97
Advanced Techniques in Computer-Aided Manufacturing
Chapter 4
The APT language
4.1 Introduction
The name given to the APT language comes from 'Automatically Programmed Tool'. It is about
of a language that is very rich in possibilities, which allows to define both geometry in the form
syntax as well as the required specifications for machining simple and complex parts.
Before the advent of CAD software, this language was the reference in the field of
numerical control machining. Programs in APT language must be compiled, which
which allows the calculation of tool paths and the conversion of programs into CL syntax
"Cutter Location", translatable as post-processing NC in order to produce compatible G code at
a given machine tool technology. This language allows for three-dimensional cuts
(simultaneous multi-axes according to the machines) by directing the tool in an imaginary cube using
construction geometry not necessarily belonging to the piece. The tool moving in
3D must be guided along the desired trajectory.
+Z
CUBE
IMAGINARY
ROOM +X
-Y
The trajectory planning approach is based on the specification of three types of surface.
to guide the tool. At theFigure 4-2 , the tool moves straight and is guided by two
converging surfaces. The first surface, called 'guide', directs the side of the cutting tool.
while another surface called 'piece (part)' allows contact from below with the tool. It
This is the floor on which the tool rests. The planes can be imaginary to guide.
the tool according to a trajectory by the programmer. In order to change direction or stop the
knife, a 3eImaginary surface is used. This surface is called the stopping surface.
In summary, given that each surface has a function, we have assigned a name to them.
functional
In order to dictate the exact places to stop the knife or to change its direction.
movement, modifiers are used in conjunction with the main words used to
describe the trajectories. The word TO will dictate the stopping of the tool "before" the stopping surface, the word ON
dictate the stop 'on' the bumped surface while the word PAST will dictate a stop beyond the
stop surfaceFigure 4-4).
SO MUCH
Particular
PSTAN
When the tool movement incorporates either of the modifiers TO, ON, or PAST
applied to the stop surface, the tool may undergo a change of direction if either one of the
minor words available for this purpose are used in the instruction. To direct the tool toward the
right when it has reached the stop surface, the word RIGHT must be specified. Similarly, the
The words LEFT, FORWARD, BACK, GOUP, GODOWN allow respectively for
changes of direction to the left, forward, backward, upwards or downwards
(Figure 4-5).
SYS856 103
Advanced techniques in computer-aided manufacturing
Figure 4-5Changes in the direction of the tool during the trajectory
The specification of the continuous tool movement instructions is given according to the format
basic general following:
GOLF TO
GORGT (symbol) PAST (symbol)
GOFWD Drive Surface ON Check Surface
GOBACK guide SO MUCH stop
GOUP PSTAN
godown
Major key Minor key, modifier
stop surface
GOLF direction
L1
previous
GOLFT/L1, TO, L2
GOLF
DS CS
L2
GORGT
GORGT
GORGT/L1, TO, L2
direction
previous
SYS856 107
Advanced techniques in computer-aided manufacturing
Example 4.2 :(GOFORWARD and GOBACK)
SYS856 109
Advanced techniques in computer-aided manufacturing
Example 4.3:(GOUP and GODOWN)
WAREHOUSE
P1
PL2
PL1
PL3
GOTO/P1
GO/TO, PL2, TO, PLPS, TO, PL1 Same direction as
GODOWN/PL2, TO, PL3 the negative direction
of the tool axis.
SYS856 111
Techniques avancées en fabrication assistée par ordinateur
4.3.1 Use of INDIRP and INDIRV directions
In some cases, it may be necessary to use the words INDIRP (toward a point)
you INDIRV (in the direction of a vector) to indicate the direction of movement rather than
to use the words GORGT or GOLFT, for example. We specify the direction INDIR(P,V) then
GOFWD :
TO : The movement ends when the knife reaches the side of the surface.
stop
PAST: The movement ends when the knife completely exceeds the
stop
ON: The movement ends when the center of the knife is on the surface
stop
SO MUCH: Can only be used if the "guide" surface is tangent to the surface
"stop". The movement ends at the point where the knife, the guide and the
The "stop" surfaces are mutually tangent.
PSTAN: Can only be used when the "piece" surface is tangent to the surface.
"stop": the movement ends at the point where the knife, the "piece" surface
and the "stop" surface are mutually tangent to each other.
SYS856 113
Advanced techniques in computer-aided manufacturing
Example 4.4 :(TO, ON, PAST)
PLΔS
SYS856 115
Advanced techniques in computer-aided manufacturing
4.4 Use of point-to-point movements
Until now in the presented examples, the GOTO instruction has been used in a few
reprises. It is actually a movement to a given point in absolute mode. For a
movement in relative mode, the instruction GODLTA/ X, Y, Z is mandatory.
Normally, an APT program always starts with defining a starting position. The
The starting point can be specified via GOTO but also by an instruction.
dedicated to this effect, either the FROM instruction.
FROM/P1 ; FROM/5, 0, 6
GOTO/Point4 ; GO/Departure ; GOTO/1, 1, 2
Symbols
Until now, we have not specified a statement allowing us to consider the surface.
piece. In fact, this one must be specified once, and then it remains modal as long as
as long as there is no explicit change to this surface.
+Z
GOTO / P2
P3
P1 GOTO
P4 P2
+Y
P7
P5 +X
P6
−Y
+Z
+Y
−X +X
−Z
−Y
SYS856 117
Advanced techniques in computer-aided manufacturing
4.5 Departure instruction GO
TO TO TO
GO ON , Drive [Link] , Part Surf., ON , Check Surf.
PAST guide PAST piece PAST stop
modal
The modifiers TO, ON, and PAST are optional. The default modifier is TO.
TO TO TO
GO/ ON , DSURF , ON , PSURF , ON , CSURF
PAST PAST PAST
DSURF
P1
DSURF
PSURF
TO TO
(specification of 2
GO / ON , Drive Suf., ON , Part Surf.
surfaces only
PAST PAST
If only one surface is specified, either the 'guide' surface or the 'part' surface is assumed.
as being the XY plane (Z=0) and the tool will take the shortest path for its
initial positioning.
TO (1 surface
ON , Drive specified, either the
GO
PAST Surf. surface " guide "
SYS856 121
Advanced techniques in computer-aided manufacturing
The direction of the initial movement can also be specified with INDIRP, INDIRV.
(Figure 4-12andFigure 4-13).
INDIRP/ds-point, ps-point, cs-point (1 to 3 points)
INDIRP/P1 DS
/3, 5, 10 DS
/P1, P2 DS, PS
/3, 5, 10, 5, 7, 4 DS, PS
/, P2 PS
/, P3 CS
...
V1 = vector / 1, 0, 0
INDIRV/V1 INDIRV/1, 0, 0
INDIRV/V1, V2
drive point direction pointing towards the surface(s)
Y Z
S1 S1
SUMMON
P1
INDIRV
P1
PL1
Z
X
X
GOTO/P1
INDIRV/-1, 0, 0
GO/TO, S1, TO, PL1
SYS856 123
Advanced techniques in computer-assisted manufacturing
4.6 Other forms of surface specification 'part'
There are two commands to specify a 'part' surface, namely PSIS and AUTOPS.
These commands can be used at any time to change the "piece" surface which is
modal since its initialization through the command GO.
The specified surface becomes the modal surface. The GO instruction allows specifying the surface.
"piece" at the beginning of the sequence. Subsequently, the only instructions allowing for its change
are PSIS, AUTOPS.
4.6.2 AUTOPS
This word generates a plane parallel to the [Link] through the current position of the cutting tool.
This plan then becomes the modal "piece" surface.
SYS856 125
Advanced techniques in computer-aided manufacturing
Example 4.6:
CUTTER/1.0
TOLER/0.001
FROM/SP
GO/TO, BSURF, TO, PSURF, TO, ASURF
GORGHT/BSURF, PAST, CSURF
GOLFT/CSURF, PAST, DSURF
GOLFT/DSURF, PAST, ASURF
GOTO/SP
By using the words available in APT to operate the tool, it is clear that the system needs
of its diameter in order to automatically calculate the trajectory of its center 'CL' during the
compilation. The instruction allowing this specification is CUTTER. The parameters of
CUTTER includes the diameter and corner radius of the tool.
CUTTER/d
CUTTER/d, r
diameter corner radius
SYS856 127
Advanced techniques in computer-aided manufacturing
4.8 Machining Tolerances
The APT language approximates the movement of the knife along a curvilinear trajectory by
generating a series of linear movements that do not deviate from the actual trajectory of a
greater than given tolerances:
4.8.1 OUTTOL / t1
Outer tolerance applied to the outer side of the theoretical machined surface. The application of
OUTTOL is conservative, it leaves an excess of material.
t1
OUTTO1
Figure 4-15OUTTOL
4.8.2 INTOL / t2
Inner tolerance applied to the internal side of the theoretically machined surface. The application of
INTOL provokes aundercutexcessive material removal.
Figure 4-16INTOL
When one wishes to obtain an internal tolerance of 0 and a specific external tolerance,
The statement TOLER / t1 allows this specification.
SYS856 129
Advanced techniques in computer-aided manufacturing
4.8.3 TOLER/t1
t2
t1
The APT language positions the tool offset from a surface by aligning its tangent surface.
on the surface of the piece. In addition to specifying the tool movements using TO, ON, PAST, this
which has the effect of a shift, it is usually advisable to explicitly specify the shift
with the help of specific words. This will allow for the simplification of programs by ignoring the
words specifying the constraints related to "stop" surfaces.
TLLFT (tool left) : The knife is on the left side of the surface relative to the movement.
TLRGT (tool rightThe knife is on the right side of the surface relative to the movement.
TLON (tool on) : The knife is on the 'guide' surface with no offset.
L2 L2
L1 L1
P1
GOTO/P1 GOTO/P1 GOTO/P1
GO/TO, L1 GO/PAST, L1 GO/ON, L1
TLRGT TLLFT TLON
GORGT/L1, TO, L2 GORGT/L1, L2 GORGT/L1, L2
SYS856 131
Advanced techniques in computer-aided manufacturing
Example of a program referring to offsets:
GO/TO, L1 L2
TLLFT L1
GOLFT/L1, TO, L2
GOLFT/L2, ON, L3
L5
TLON
GOLFT/L3, TO, L4
TLLFT L3
GOLFT/L4, L5
L4
This offset dictates the position of the tool relative to the 'workpiece' surface. There are two types of
shift, either TLOFPS and TLONPS.
TLOFPS (Tool off Part Surface) : The cutter is offset from the part surface.
TLONPS (Tool on Part Surface) : The cutter center is positioned on the part surface.
SYS856 133
Advanced techniques in computer-aided manufacturing
The 'buffer' surface is said to be 'implicit' according to this formulation. The format is as follows:
GOLF
GORGT / drive surface
GOFWD
GOBACK
APT looks forward to the CS for the current statement while referring to the DS of the next statement in
movement. The offset associated with the CS is deducted from the current offset for the guide surface
(TLLFT, TLRGT, TLON). The possible combinations are shown in the table below:
TLLFT GOLF TO 1
TLLFT FEAR PAST -2-
TLRGT GOLF PAST
TLRGT GORGT TO
TLLFT, TLRGT, TLON GOFWD SO MUCH
TLLFT, TLRGT, TLON GOBACK SO MUCH
TLON GOLF ON
TLON GORGT ON
Example 4.7:
Referring to theFigure 4-21 , the simplification of the existing program (old form)
becomes the simplified specification of the instructions as presented in the right column.
SYS856 135
Advanced techniques in computer-aided manufacturing
Figure 4-21Simplification of a program
It is possible to integrate the feed rates into the movement instructions. One can
also use the postprocessor word 'FEEDRATE' to do this.
If the value of 'thick' is negative, it corresponds to the cancellation of the tool radius offset.
Specification of offsets
GOTO/P1
GO/PAST, L1
TLLFT Æ TLLFT, GORGT/L1
GORGT/L1
SYS856 137
Advanced techniques in computer-aided manufacturing
4.13 Steps required to define a machining sequence in APT
In summary, the following steps are necessary for defining machining sequences in
APT language.
The major words are located before the " / " and indicate an instruction to execute (movement p.r.
to surfaces). The words used to qualify the instructions are called minor words.
(limits, boundaries of movement: the 3 surfaces). They can be found to the right of the « / ». Not to be
confusing with the symbols (variables) or constants used to define the coordinates or
geometry.
SYS856 139
Advanced techniques in computer-aided manufacturing
Rules regarding the names of symbols:
6 characters maximum
At least one character must be a letter
P54321 567891
(ok ) (not ok )
Logically, the name chosen for the symbols should be meaningful, either associated with the type of
geometry.
Specification example:
P1 = POINT/5, 6, 0
P2 = POINT/17, 9, 0
L1 = LINE/P1, P2
Six different ways to describe a line in APT. The different possibilities allow for
reducing the calculations required to specify the line in formation of the given 2D drawing.
SYS856 141
Advanced techniques in computer-aided manufacturing
[Link] The circle in APT
Example of specification:
A circle must always be specified even if the movement occurs over a portion of that circle.
(arc of a circle). It is the movement instruction that will allow for movement along the arc.
Example of specification:
MACHINE / name, number specify the post-processor to be used for the translation
SYS856 143
Advanced techniques in computer-aided manufacturing
FEDRAT / 10 FEDRAT / num, (IPM, IPR, …)
SPINDL / 1 000 SPINDL / (CLW, CCLW), num
COOLNT / (ON, OFF)
DELAY / 2
UNITS/ Feet
Inches
mm
cm
LOADTL/M
CUTCOM/ ON
OFF
We will see other syntaxes during the presentation of the concepts associated with post-processors.
SYS856 145
Advanced techniques in computer-aided manufacturing
4.15 Multi-axis programming
The APT language generates the axis orientation in multi-axis machining mode. This is the role of
post-processor subsequently converts these orientation vectors into machine axis rotation.
If the axis is not specified in multi-axis, then APT assumes a vector 0, 0, 1 as orientation.
The available statements in APT for multiaxis are MULTAX and TLAXIS.
⇒ 6 values are output at each point, the coordinates x, y, z, and the vector i, j, k.
FROM/point, vector
/x, y, z, i, j, k
…
GOTO/point, vector
/x, y, z, i, j, k
/point, i, j, k
/ x, y, z, vector
/pnt, vec
SYS856 147
Advanced techniques in computer-aided manufacturing
GOTO/P1 Defect (0,0, 1)
TLAXIS/1,0, 0 orientation of the axis parallel to X
GOTO/P2
Corresponds to
GOTO/P1 (same)
GOTO/P2, 1, 0, 0
In multi-axis, the specification of a single value per GODLTA means a movement according to
the axis. It is a withdrawal if the value is positive or a plunge if the value is negative.
SYS856 149
Advanced techniques in computer-aided manufacturing
4.15.3 Changes to tool axis variables
Application to the statements of starting motion and to the statements of continuous motion.
A TLAXIS statement that initiates a variable orientation of the tool must specify the information
following:
SYS856 151
Advanced techniques in computer-aided manufacturing
Exercise 4.1:
Develop the APT program to machine the contour of the illustrated part.
5 C2
r=1
4
3 P3 P2
L3
L2
2
C3
1 + + C1
r = 0.5 P1 r = .5
L1
0
1 2 3 4 5
1.5 3.5
SYS856 153
Advanced techniques in computer-aided manufacturing