Introduction To Fanuc 21im Programming Key With Topmill
Introduction To Fanuc 21im Programming Key With Topmill
Software-Entwicklung GmbH
© MTS GmbH • Kaiserin-Augusta-Allee 101 • D-10553 Berlin • Tel.: +49 / 30 / 349 960 - 0 • Fax: +49 / 30 / 349 960 - 25
Fanuc 21 iM
Version 7.3 – 26.06.2010
Alle Rechte, auch die fotomechanische Wiedergabe und der Speicherung in elektronischen Medien, vorbehalten.
4. Canned cycles
4.1. General explanations for canned cycles
4.2. Travel distance along the drilling axis G90 / G91
4.3. Return point level G98 / G99
4.4. Canned cycles with repetitions in G91 mode
4.5. Deactivating commands for canned cycles
4.6. High speed peck drilling cycle G73
4.7. Left handed tapping cycle G74
4.8. Drilling cycle, spot drilling G81
4.9. Drilling cycle with dwell G82
4.10. Peck drilling cycle G83
4.11. Tapping cycle G84
4.12. Reaming (Boring) cycle G85
4.13. Reaming (Boring) cycle with spindle stop G86
4.14. Reaming (Boring) cycle with dwell G89
1.4. Most needed and available tool types for machining (tool equipment)
In the current state of TopMill the software handles 33 tool types with more than 670 milling tools, extendable
by the user to create your real tools like on the CNC mill in your workshop.
A note to our readers: You can find the description to create the respective tool data of a new tool in the
“Introduction to TopMill CNC simulator milling version 7.3”.
with sphere diameter Ø10 Ø16 until Ø32 at the large end and cutting edge angle
with 45° and 60°
Ø16 until Ø32 at the large end and cutting edge Ø4 until Ø12 and with point angle 90° and 120°
angle with 45° and 60°
with shaft diameter Ø8 until Ø20 for radii between 1mm until 20mm
long tools with Ø4 until Ø40 short tools with Ø4 until Ø40
solid carbide milling cutter Ø2 until Ø20 long tools with Ø4 until Ø40
short tools with Ø4 until Ø40 solid carbide milling cutter Ø2 until Ø20
solid carbide milling cutter Ø2 until Ø20 60° with Ø3, Ø4 and Ø6
Ø10,5 until Ø32,5 and cutting edge length from Ø3 until Ø30
2mm until 8mm
Ø4 until Ø20 Ø40 until Ø100 and teeth number between 6 until 10
Ø40 until Ø100 and teeth number between Ø50 until Ø160 and teeth number between
6 until 10 10 until 18
Ø2 until Ø40 Ø6 until Ø16 and point angle 90° and 120°
for thread lead 0,5mm until 2,5mm Ø11 until Ø60 and cutting edge length from 4mm until
28mm
long drills with Ø2 until Ø20 short drills with Ø2 until Ø20
A note to our readers: All other available turning tool types you can find in the setup dialog “tool system
(turret equipment)”.
The NC-program obtains NC-sentences, called NC-blocks with the NC-block number.
The NC-word obtains a NC-address as a big address letter with an address value.
These address values can be positive or negative decimal number with decimal point.
CNC-program structure
NC-block structure
G0 – rapid traverse
G1 – linear interpolation
NC-block: G1 X0 Z-Y120 F…
The second option to program a circular arc is to enter the incremental distance between the starting point
and the circle centre in X-coordinate with the address I and in Y-coordinate with J. Following some graphics
explanations:
T – calling a tool
Function: The command T calls a tool in a selected magazine position with the codes H and D for tool offset.
N50 G0 X… Y…
1
G97 – constant spindle speed (min- ) Function: With G97 all S values are in rev./min).
NC-block: G94 F…
NC-block: G95 F…
The command types of auxiliary functions are diverse function for specifying spindle start, spindle stop
program end, and so on. All auxiliary functions are M – code commands.
Function: If the optional stop function on the machine The program can be restarted by pressing the NC-
operation panel is turned on, the program execution is start button.
stopped in the same way as M00.
If the optional stop switch is off, the command M01 is
ignored. The operation proceeds to the next block.
NC-block: M3…
NC-block: M4…
M5 – spindle stop
NC-block: M5…
NC-block: M08…
M30 – main program end with resetting Function: This command informs the control system
that the current program run has been completed.
NC-block: M30
The spindle and the coolant pump are deactivated and
the automatic program run is terminated.
M99 – subprogram end Function: This command informs the control system
that the called subprogram run has been completed.
NC-block: M99
In computing the tool motion the control system assumes the movement of the theoretical middle point of the
milling tool along the programmed contour.
Every time the tool executes a programmed movement which is shifted away from the real contour with the
value of the tool radius.
The deviations from the desired contour and the corresponding dimensions are unavoidable, because the
radius middle point creates the contour.
To see the effects of the tool radius and to see the difference between the radius middle point and the actual
needed contour creating point we can investigate workpieces with the function for quality analysis in TopMill
which is called <Measure/3D>.
When cutter radius compensation is activated with the command G41/G42, the control system computes the
path of the centre of the tool radius, equidistant to the contour, accounting for the radius of the current tool.
If the cutter radius compensation is selected the motion of the tool radius centre goes on an offset path
equidistant to the contour, i.e. the actual cutting point moves exactly along the programmed contour
around the workpiece.
By activating the cutter radius compensation, only the workpiece contour points are programmed and the
control must be informed whether the tool shall move left or right of the programmed contour.
So the control has to be informed that the tool takes place on the left with the command G41 or right with
command G42 of the programmed contour.
The qualifications left or right apply to the direction in which the tool travels along the contour (direction
of the feedrate).
G41: Compensation to the left of the contour (in the cutting direction)
Function: The command of the NC-block specifying G41 should be G00 or G01. When G42 is
specified by the commands G02 or G03 an alarm message is displayed.
G41 is also called downcut or climb milling.
Function: The command of the NC-block specifying G42 should be G00 or G01. When G42 is
specified by the commands G02 or G03 an alarm message is displayed.
G42 is also called upcut or conventional milling
Function: Canned cycles make it easier for the programmer to create programs.
With canned cycles often used operations in can be specified in a single NC block with a G code – without
these canned cycles normally more than one NC block is required and so the canned cycles can shorten
programs.
Function: With the command G90 the parameters R and Z are absolute values in distance to the workpiece
zero point coordinate.
Function: With the command G90 the parameters R and Z are absolute values in distance to the workpiece
zero point coordinate.
Function: When the tool is reaching the bottom of a hole the tool may be returned to the point R or to the initial
level point SP (start point).
Function: With the command G98 the tool moves up from the bottom of the hole to the initial level SP in
Z coordinate at the end of the cycle.
Function: With the command G98 the tool moves up from the bottom of the hole to the initial level SP in
Z coordinate at the end of the cycle.
Function: To repeat holes with equally distances the cycle can specify the number of repetitions with
parameter K.
K is active only within the NC block where it is specified and the position of the first hole needs incremental
mode programming with G91.
If the parameter K is specified in absolute mode G90, the drilling cycle works again on the same coordinate
position.
NC-block: G0 X0 Y0 Z5
Function: The code G80 cancelled a canned cycle in a program. Also a group 01 G code like G00, G01, G02
and G03 deactivate a canned cycle.
NC-block: G80
Function: The drill dips into the workpiece for the infeed value Q and drives back 1mm to break the chips
(intermitted infeed).
It dips in again etc. until the end depth is reached. At the end the tool retracts with rapid speed.
The retraction distance value for chip breaking is adjusted by machine parameter No. 5114 – usually 1
or 2mm.
Function: The tapping is performed by turning the spindle counter clockwise and when the bottom of the
thread has been reached, the spindle is turning clockwise for retraction.
Feedrate overrides are deactivated during left-hand tapping and a feed hold does not stop the spindle until the
return operation of the tap is completed.
Function: This cycle is used for normal drilling. The drill tool cuts down to the end depth with feedrate and
retracts from the bottom
Function: This cycle is used for normal drilling. The drill tool cuts down to the end depth with feedrate and
dwells turning to clean the hole ground.
The cycle G82 is used to machine drill holes more accurately with respect to depth as G81.
N…G98 G83 X… Y… Z… R… Q… F… K…
Function: The drill dips into the workpiece for the infeed value Q and drives back to the start plane with G98
or to the withdrawal plane with G99. So the cycle breaks chips and removes it from the hole.
Than the tool traverses with rapid speed until 1mm over the previous drilling depth and dips in again for the
infeed Q so often, until the end depth is reached.
The retraction distance value for chip breaking is adjusted by machine parameter No. 5114 – usually 1
or 2mm.
N…G99 G83 X… Y… Z… R… Q… F… K…
Function: The tapping is performed by turning the spindle clockwise and when the bottom of the thread has
been reached, the spindle is turning counter clockwise for retraction.
Feedrate overrides are deactivated during right-hand tapping and a feed hold does not stop the spindle until
the return operation of the tap is completed.
Function: The tool traverses down to the end depth with feedrate and retracts up to the point R level with
the same feedrate.
Depending on G98 the tool retracts with rapid speed from point R level to the initial level point SP.
Function: The tool traverses down to the end depth with federate. At the hole ground the spindle stops and
the tool retracts with rapid speed.
Function: The tool traverses down to the end depth with feedrate and dwells on the hole ground. The tool
retracts up to the point R level with the same feedrate.
Depending on G98 the tool retracts with rapid speed from point R level to the initial level point SP.
Chamfering and vertex rounding values can be programmed by directly inputting these values.
They can be inserted automatically between the following geometrical elements:
G1 X… Y… (EP)
G1 X… Y… (EP)
There are two ways to program travels of tools, the absolute command G90 and the incremental command
G91.
In the absolute command G90 the coordinate value of the target position is programmed.
By incremental programming with G91 the move distance between the start and target point is pro-
grammed, so we can say, that with the incremental command G91 you can specify the distance from
the previous tool position to the next tool position.
The G code must be specified in an independent NC block before setting the coordinate system at the
beginning of a program.
The unit system for the following values are changed after inch / metric conversation:
G50 – cancel scaling and mirror Function: The commands G51 and G50, used to
cancel scaling and mirror, may be specified in a
NC-block: G50 separate NC block which contains no other
commands.
NC-block: G52 X… Y… Z…
G52 – cancel local coordinate system Function: The commands G52 is also used to cancel
the local coordinate system
NC-block: G50 X0 Y0 Z0
.
X / Y - centre of rotation
R - angle of rotation
NC-block: G68 X… Y… R…
G69 – cancel rotation Function: The G69 command, used to cancel coor-
dinate system rotation, may be specified in an NC
NC-block: G69… block which contains other commands also.
A note to our readers for the following program examples: To get detailed information and introduction about:
please read the “Introduction to TopMill CNC simulator turning version 7.3”.
face end mill Ø80 mm end mill rough HSS short Ø40 mm
• T01 • T02
• vc= 200 m/min • vc= 50 m/min
• fz= 0.1 mm • fz= 0.1 mm
• z=6 • z=6
• R=40 mm • R=20.5 mm
• T03
• vc= 50 m/min
end mill finish HSS short Ø40 mm
• fz= 0.1 mm
• z=4
• T04
• R=10.5 mm
• vc= 70 m/min
• fz= 0.08 mm
• z=4
• R=20 mm
tap M10
Angular cutter typ B Ø16 mm x 4 mm
• T09
• T11
• vc= 15 m/min
-1 • vc= 50 m/min
• n= 470 min
• fz= 0.05 mm
• F= 1.5mm (lead of threading)
• z=6
• M3= right hand threading
• angle= 45°
• R=4.5 mm
twist drill Ø6 mm
• T12
• point angle 118° twist drill Ø19 mm
• vc= 40 m/min
• n= 2100 min
-1 • T13
• F= 0.1mm • point angle 118°
• M3= rotation direction • vc= 40 m/min
-1
• n= 670 min
• F= 0.15mm
• M3= rotation direction
• T14
• vc= 70 m/min
• fz= 0.06 mm
• z=4
• R=6 mm
In the following example program we use the knowledge about canned cycles, also the kind of programming
with subprogram technology and coordinate system rotation.
The setup of the workpiece starts with the setup dlg. File in TopMill.
To start now with Exercise 1 we open the main menu and click on <Setup dlg. File> or press in order to
access the setup dialog menu.
The setup dialog as the begin of every program has always the same dialog boxes and the are:
• general information
• workpiece
• workpiece clamping
• zero register and
• tool system.
As next we create the program for Exercise 1 with zero point, tool calls, technology data for the tools and
cycles.
Also we practise the contour description with subprogram technology with repetitions and coordinate system
rotation.
In the opened NC-editor it is possible now to enter the program line by line with the help of dialog
programming.
Starting with the zero point call of the workpiece, we must enter the tool exchange. In this example we are
working at first with a face end mill with a cutting head of Ø80 mm. We cut 2 mm of the blank surface to
create the finished surface Z=0 coordinate.
N2 T1 M6 tool call
N3 G97 S790 G94 F480 M3 spindle speed, feedrate and tool rotation direction
N5 G0 X-35 Y-95 rapid traverse with safety distance for face cutting in X
and Y coordinate
Next we have to mill the hexagon. To produce a roughly milled hexagon we are using a modified correction
value of tool number 2 with a cutting head of 40 mm and a radius correction value of 20.5 mm.
The result is an allowance with 0.5 mm on the border of the contour to give the possibility for finishing the
border later on.
We are cutting the depth of the hexagon with 3 infeeds in the depth and therefore we create a subprogram.
This subprogram is running 3 times.
N12 S400 F240 M3 spindle speed, feedrate and tool rotation direction
N14 G43 G0 Z10. H2 rapid traverse with safety distance in Z coordinate and
activating the tool length compensation
N15 G0 X80 Y0 rapid traverse with safety distance for hexagon cutting
in X and Y coordinate
The best way to enter a subprogram is to write the command M30 at the end of the main program.
Behind this command you can enter an arbitrary number of subprograms.
The advantage of this kind of programming is that you can see all inputted programs in the editor mode of
TopMill with a fast look at the screen.
N163 G41 G1 X37. Y0. D2 linear interpolation to the contour point P1 of the
hexagon and activating the tool radius compensation
N170 G40 X80 Y0 cancel cutter radius compensation and move to the
X and Y start point like in the main program
For the next work step we enter the same contour like in roughing and for softly approaching and departure
we insert circular interpolations with radii of 30 mm.
N20 S517 F248 M3 spindle speed, feedrate and tool rotation direction
N22 G43 G0 Z10. H4 rapid traverse with safety distance in Z coordinate and
activating the tool length compensation
N23 X80 Y0 rapid traverse with safety distance for hexagon cutting
in X and Y coordinate
N174 G41 G1 X67. Y30. D4 start point for softly approaching with R30 mm to P1
and activating the tool radius compensation
N182 G3 X67 Y-30 I30 J0 circular interpolation as softly departure away from
contour point P1 with R30 mm
N183 G40 G1 X80 Y0 cancel cutter radius compensation and move to the
X and Y start point like in the main program
We use the spot drill in order to produce a chamfer on the M10 threads with an Ø11.5 mm and 90° angle.
N32 G98 G90 G81 X-38.184 Y-38.184 Z-15.75 R-8. spot drilling in absolute mode with return point by
initial level
We continue the work with the same tool in order to make 6 spot drills to an Ø6.4 mm.
N37 G99 G90 G81 X30. Y0. Z-3.2 R2. spot drilling in absolute mode with return point by
R level
N185 G68 G91 X0. Y0. R60. incremental coordinate system rotation with an angle
of 60°
work step 7 : peck drilling the core diameter Ø8.5 mm for M10 treads
Following we work with the peck drilling cycle G83 which has more functions than G81. With this cycle we can
set a chip breaking with the pecking depth parameter. We are practising different modes in order to use G83.
-1
N43 S1500 F0.15 M3 spindle speed, feedrate mm/min , rotation direction
N45 G43 G0 Z10. H8 rapid traverse with safety distance in Z coordinate and
activating the tool length compensation
N46 G98 G90 G83 X-38.184 Y-38.184 Z-23. Q4. R-7. spot drilling 1 in absolute mode with return point by
initial level
N48 G98 G91 G83 X76.368 Z-16. Q4. R-17. spot drilling 2 in incremental mode with return point by
initial level
N49 G80
cancel drilling cycle
N50 G99 G91 G83 Y76.368 Z-16. Q4. R-17. spot drilling 3 in incremental mode with return point by
R level
N52 G98 G90 G83 X-38.184 Y38.184 Z-23. Q4. R-7. spot drilling 4 in absolute mode with return point by
initial level
Now we can see the advantage of creating subprograms, because we are apply a second time subprogram
number O1113 in order to make the 6 drill holes with Ø6.4 mm like in work step 6.
N57 G90 G43 G0 Z10 H12 programming in absolute mode, rapid traverse with
safety distance in Z coordinate and activating the tool
length compensation
N58 G99 G90 G83 X30. Y0. Z-27. Q4. R2. spot drilling in absolute mode with return point by
R level
N185 G68 G91 X0. Y0. R60. incremental coordinate system rotation with an angle
of 60°
work step 9 : pre-drilling for slot and circular pocket with Ø19
In Fanuc 21iM control we haven’t got pocket cycles, were we can work with different feedrates for infeed and
geometry planes.
So it is usefully to make pre-drilling before cutting pockets to spare the milling tool when it dips into the
workpiece. In this case we work with G82 to see drilling with dwell time.
-1
N64 S670 F0.15 M3 spindle speed, feedrate mm/min , rotation direction
N66 G90 G43 G0 Z10. H13 programming in absolute mode, rapid traverse with
safety distance in Z coordinate and activating the tool
length compensation
N67 G98 G90 G82 X0. Y0. Z-11.9 R2. P1 spot drilling in absolute mode with return point by
initial level, dwell time one second
We are going to mill the circular pocket. To produce a roughly milled pocket we are using again a modified
correction value of tool number 3 with a cutting head of Ø20 mm and a radius correction value 10.5mm.
The depth will be cut with subprogram technology in a few of steps.
To create the slot in the middle of the workpiece we are using again a modified correction value of tool
number 6 with a cutting head of Ø12 mm and a radius correction value 6.5mm.
The depth will be cut also with subprogram technology in a few of steps with a solid carbide milling tool.
N196 G41 G1 X10 Y0 D6 linear interpolation to the slot contour and activating
the tool radius compensation
For the next work step we enter the same contour like in roughing directly in the main program.
In this work step we enter the same contour like in slot roughing directly in the main program.
N99 G43 G0 Z2 H14 rapid traverse with safety distance in Z coordinate and
activating the tool length compensation
N101 G41 G1 X10 Y0 D14 linear interpolation to the slot contour and activating
the tool radius compensation
For tapping we use the canned cycle G84 – right hand tapping. The feedrate is the lead of the thread.
N112 G43 G0 Z10 H9 rapid traverse with safety distance in Z coordinate and
activating the tool length compensation
N113 G98 G90 G84 X38.184 Y38.184 Z-18. R-7. tapping cycle in absolute mode with return point by
initial level for tapped hole 1
Now we are starting the burr removing on all contour elements with a chamfer 0.2 mm by 45 degrees. At first
the circular pocket.
The tool we are using is an angular cutter tool type B with a cutting head of Ø16 mm by 45 degrees. The
practical application of this tool is a changed radial offset from 4 mm to 4.5 mm to produce a chamfer not with
the bottom cutting edge (avoidance sharp edges at the chamfer). If we want to mill a chamfer 0.2mm x 45° we
have to give a depth value of 0.7 mm.
N123 G43 G0 Z2 H11 rapid traverse with safety distance in Z coordinate and
activating the tool length compensation
N125 G41 G1 X25 Y0 D11 linear interpolation to the circular pocket contour and
activating the tool radius compensation
N129 G41 G1 X10 Y0 D11 linear interpolation to the slot contour and activating
the tool radius compensation
N140 G41 G1 X67. Y30. D11 start point for softly approaching with R30 mm to P1
and activating the tool radius compensation
N148 G3 X67 Y-30 I30 J0 circular interpolation as softly departure away from
contour point P1 with R30 mm
N149 G40 G1 X80 Y0 cancel cutter radius compensation and move to the
X and Y start point like in the main program
N153 G41 X50 Y50 D11 start point for linear approaching and activating the
tool radius compensation
N158 G40 X70 Y70 cancel cutter radius compensation and move to the
X and Y start point
face end mill Ø80mm end mill rough HSS short Ø30mm
• T01 • T02
• vc= 200 m/min • vc= 50 m/min
• fz= 0.1 mm • fz= 0.1 mm
• z=6 • z=5
• R=40 mm • R=15.5 mm
• T04
indexable insert drill Ø32mm • vc= 50 m/min
• fz= 0.1 mm
• T03 • z=4
• vc= 150 m/min • R=9.5 mm
-1
• n= 1273 min
• F= 0.15 mm
• M3= rotation direction
• T07
• vc= 50 m/min
• fz= 0.06 mm end mill finish HSS short Ø30mm
• z=4
• R=3.5 mm • T08
• vc= 70 m/min
• fz= 0.08 mm
• z=5
• R=15 mm
• T11
• vc= 70 m/min
• fz= 0.05 mm spotting drill tool shank diameter Ø12mm
• z=4
• R=3 mm • T12
• vc= 30 m/min
-1
• n= 795 min
• F= 0.1mm – 0.15mm
• M3= rotation direction
In this example we have to grip a cylindrically workpiece with a jaw chuck with three jaws. Because of the
avoidance of tool collision with the jaws we have to pay attention to the orientation of the jaw chuck.
• T05
• vc= 40 m/min
indexable insert drill Ø20 mm
• fz= 0.05 mm
• z=6
• T06
• R=9 mm
• vc= 150 m/min
• H=8 mm -1
• n= 2390 min
• F= 0.15 mm
• M3= rotation direction
• T07
• vc= 50 m/min end mill finish HSS short Ø30mm
• fz= 0.08 mm
• z=4 • T08
• R=5.5 mm • vc= 70 m/min
• fz= 0.08 mm
• z=5
• R=15 mm
• T15
• vc= 50 m/min
• fz= 0.05 mm
• z=6
• angle= 90°
• R=0.55 mm