CNC Programming Handbook - Text
CNC Programming Handbook - Text
CNC
Programming
Handbook
Second Edition
CNC
Programming
Handbook
Second Edition
Peter Smid
Smid, Peter.
CNC programming handbook: comprehensive guide to practical CNC programming/
Peter Smid.
p. cm.
ISBN 0-8311-3158-6
1. Machine-tools— Numerical Control-Programming -Handbooks, manuals, etc.. I.
Title.
Second Edition
5 6 7 8 9 10
Dedication
To my father Frantisek and my mother Ludmila,
who taught me never to give up.
Acknowledgments
In thissecond edition of the CNC Programming Handbook, would like to express my I
thanks and appreciation to Peter Eigler for being the bottomless source of new ideas,
knowledge and inspiration - all that in more ways than one. My thanks also go to Eugene
Chishow, for his always quick thinking and his ability to point out the elusive detail or two
that might have missed otherwise. To Ed Janzen, thank for the many suggestions he of-
I I
fered and for always being able to see the bigger picture. To Greg Prentice, the President of
GLP Technologies, Inc., - and my early mentor - you will always be my very good friend.
Even after three years of improving the CNC Programming Handbook and developing the
enclosed compact disc, my wife Joan will always deserve my thanks and my gratitude. To
my son Michael and my daughter Michelle - you guys have contributed to this handbook in
more ways than you can ever imagine.
I have also made a reference to several manufacturers and software developers in the
book. It is only fair to acknowledge their names:
Mr. Smid's long time association with advanced manufacturing companies and CNC ma-
chinery vendors, as well as his affiliation with a number of Community and Technical Col-
lege industrial technology programs and machine shop skills training, have enabled him to
broaden his professional and consulting skills in the areas of CNC and CAD/CAM training,
computer applications and needs analysis, software evaluation, system benchmarking,
programming, hardware selection, software customization, and operations management.
Over the years, Mr. Smid has developed and delivered hundreds of customized educa-
tional programs to thousands of instructors and students at colleges and universities
across United States, Canada and Europe, as well as to a large number of manufacturing
companies and private sector organizations and individuals.
He has actively participated in many industrial trade shows, conferences, workshops and
various seminars, including submission of papers, delivering presentations and a number
of speaking engagements to professional organizations. He is also the author of articles
and many in-house publications on the subject of CNC and CAD/CAM. During his many
years as a professional in the CNC industrial and educational field, he has developed tens
of thousands of pages of high quality training materials.
The author welcomes comments, suggestions and other input from educators, students and industrial users.
You can e-mail him through the publisher of this handbook from the Main Menu of the enclosed CD.
You can also e-mail him from the CNC Programming Handbook page at www.industrialpress.com
TABLE OF CONTENTS
5
1 - NUMERICAL CONTROL 1 Axes and Planes 16
Point of Origin 16
Quadrants 16
DEFINITION OF NUMERICAL CONTROL . . . 1
Right Hand Coordinate System 17
NC and CNC Technology 1
MACHINE GEOMETRY 17
CONVENTIONAL AND CNC MACHINING ... 2
Axis Orientation - Milling 17
NUMERICAL CONTROL ADVANTAGES ... 2 Axis Orientation - Turning 18
Setup Time Reduction 3 Additional Axes 18
Lead Time Reduction 3
Accuracy and Repeatability 3
Contouring of Complex Shapes 3 - CONTROL SYSTEM 19
Simplified Tooling and Work Holding 3
Cutting Time and Productivity Increase 4
GENERAL DESCRIPTION 20
TYPES OF CNC MACHINE TOOLS 4 Operation Panel 20
Millsand Machining Centers 4 Screen Display and Keyboard 21
Lathes and Turning Centers 5 Handle 22
PERSONNEL FOR CNC 5 SYSTEM FEATURES 22
CNC Programmer 5 6 Parameter Settings 22
4 CNC Machine Operator 6 System Defaults 23
SAFETY RELATED TO CNC WORK 6 Memory Capacity 24
IX
8
X Table of Contents
Control System 31
PART COMPLEXITY 32
- PREPARATORY COMMANDS 47
MANUAL PROGRAMMING 32
DESCRIPTION AND PURPOSE 47
Disadvantages 32
Advantages 32 APPLICATIONS FOR MILLING 47
9
CAD/CAM AND CNC 32 APPLICATIONS FOR TURNING 49
Integration
Future of Manual Programming
33
33
G CODES IN A PROGRAM BLOCK .... 50
Modality of G-commands 50
TYPICALPROGRAMMING PROCEDURE . . . 33 Conflicting Commands in a Block 50
Word Order in a Block 51
PART DRAWING 34
34
GROUPING OF COMMANDS 51
Title Block
Dimensioning 34 Group Numbers 51
PROGRAMMING FORMATS . . 42
10 -SEQUENCE BLOCK 61
POSITION REGISTER COMMAND .... 113 TOOL LENGTH OFFSET COMMANDS ... 132
Position Register Definition 113 Distance-To-Go in Z Axis 132
Programming Format 113 TOOL LENGTH SETUP 133
Tool Position Setting 114
On-Machine Tool Length Setting 133
MACHINING CENTERS APPLICATION . . . 114 Off-Machine Tool Length Setting 134
Tool Set at Machine Zero 114 Tool Length Offset Value Register 134
Tool Set Away from Machine Zero 114
Z AXIS RELATIONSHIPS 134
Position Register in Z Axis 115
Preset Tool Length 135
Programming Example 115 20
ToolLength by Touch Off 135
LATHE APPLICATION 115 Using a Master Tool Length 136
Tool Setup 116 G43-G44 Difference 136
Three-Tool Setup Groups 116 PROGRAMMING FORMATS 137
Center Line Tools Setup 116
Tool Length Offset not Available 137
External Tools Setup 117
Internal Tool Setup 117
Tool Length Offset and G92 138
Tool Length Offset and G54-G59 139
Corner Tip Detail 117
Tool Length Offset and Multiple Tools 139
Programming Example 117
CHANGING TOOL LENGTH OFFSET. ... 140
DESCRIPTION 119
Programming Commands 119 - RAPID POSITIONING 143
Programming Format 119
Incremental Mode 120
Motion Length Calculation 120 RAPID TRAVERSE MOTION 143
Position Compensation Along the Z axis 122 GOO Command 143
Using G47 and G48 122
RAPID MOTION TOOL PATH 144
Face Milling 122
Single Axis Motion 144
Multiaxis Motion 144
Straight Angular Motion 146
18- WORK OFFSETS 123 Reverse Rapid Motion 146
Left or Right - not CW or CCW 251 High Speed Steel End Mills 276
Offset Commands 251 Solid Carbide End Mills 276
Radius of the Cutter 252 Indexable Insert End Mills 276
History of Offset Types 252 Relief Angles 276
Programming Format 253 End Mill Size 276
Address H or D ? 253 Number of Flutes 277
Geometry and Wear Offsets 254
SPEEDS AND FEEDS 277
APPLYING CUTTER RADIUS OFFSET ... 254 Coolants and Lubricants 278
Startup Methods 254 Tool Chatter 278
33
Offset Cancellation 256
STOCK REMOVAL 279
Cutter Direction Change 256
Plunge Infeed 279
HOW THE RADIUS OFFSET WORKS ... 256 In and Out Ramping 279
Look-Ahead Offset Type 257 Direction of Cut 279
Rules for Look-Ahead Cutter Radius Offset 257 Width and Depth of Cut 280
Radius of the Cutter 258
Radius Offset Interference 259
Single vs. Multiaxis Startup 260 - SLOTS AND POCKETS 281
OVERVIEW OF GENERAL RULES .... 261
PRACTICAL EXAMPLE MILLING - .... 262 OPEN AND CLOSED BOUNDARY .... 281
Part Tolerances 262 Open Boundary 281
Measured Part Size 262 Closed Boundary 281
Programmed Offsets 263 PROGRAMMING SLOTS 281
D Offset Amount - General Setting 263
Open Example
Slot 281
31Offset Adjustment 264
Closed Slot Example 283
Offset for External Cutting 264
Offset for Internal Cutting 265 POCKET MILLING 284
One Offset or Multiple Offsets? 265 General Principles 284
Preventing a Scrap 265 34
Pocket Types 285
Program Data - Nominal or Middle? 266
RECTANGULAR POCKETS 285
TOOL NOSE RADIUS OFFSET 266 Stock Amount 286
Tool Nose Tip 266 Stepover Amount 286
Radius Offset Commands 266 Length of Cut 287
Tool Tip Orientation 266 Semifinishing Motions 287
Nose Radius Offset
Effect of Tool 267 Finishing Tool Path 287
Sample Program 267 Rectangular Pocket Program Example 288
Minimum Clearance Required 268
CIRCULAR POCKETS 239
32
Change of Motion Direction 268
Minimum Cutter Diameter 289
Method of Entry 289
Linear Approach 289
- PLANE SELECTION 269
Linear and Circular Approach 290
Roughing a Circular Pocket 291
WHAT A PLANE?
IS 269
CIRCULAR POCKET CYCLES 292
MACHINING IN PLANES 269
Mathematical Planes 269
Machine Tool Planes 270 - TURNING AND BORING 293
Program Commands for Planes Definition 270
Default Control Status 271
TOOL FUNCTION -TURNING 293
STRAIGHT MOTION IN PLANES 271 T Address 293
CIRCULAR INTERPOLATION IN PLANES . . 271 LATHE OFFSETS 294
G 1 7-G 8-G 9 as Modal Commands
1 1 272 Offset Entry 294
Absence of Axis Data in a Block 272 Independent Tool Offset 294
Cutter Radius Offset in Planes 273 Tool Offset with Motion 295
PRACTICAL EXAMPLE 273 Offset Change 295
FUNCTIONS FOR GEAR RANGES .... 298 G70 Cycle Format - All Controls 320
AUTOMATIC CORNER BREAK 299 BASIC RULES FOR G70-G73 CYCLES . . . 321
Chamfering at 45 Degrees 299
G74 PECK DRILLING CYCLE
- 321
Blend Radius at 90 Degrees 301
Programming Conditions 301 G74 Cycle Format- 10T/1 1T/15T 321
Programming Example 301
G74 Cycle Format - 0T/1 0T/1 8T/20T/2 IT 321
G90- STRAIGHT CUTTING CYCLE .... 308 SIMPLE GROOVE PROGRAMMING .... 325
Cycle Format 308 PRECISION GROOVING TECHNIQUES ... 326
Straight Turning Example 309 Groove Width Selection 327
Taper Cutting Example 309 Machining Method 327
Straight and Taper Cutting Example 311 Finishing Allowances 328
G94 - FACE CUTTING CYCLE 312 Groove Tolerances 329
Groove Surface Finish 330
Cycle Format 312
1
2 Chapter 1
technology, described in this handbook under the abbrevia- ish quality are the most typical problems in conventional
tion ofNC. The letter 'C’stands for Computerized and it is ,
machining. Individual machinists may have their own time
not applicable to the hardwired system. All control systems ‘proven’ methods, different from those of their fellow col-
manufactured today are of the CNC design. Abbreviations leagues. Combination of these and other factors create a
such as C&C or C'n ‘C are not correct and reflect poorly on great amount of inconsistency.
anybody that uses them.
The machining under numerical control does away with
the majority of inconsistencies. does not require the same
CONVENTIONAL AND CNC MACHINING It
some bad moments. The results of these moments, when more powerful manual mill. Equally unreasonable are ex-
pectations of great improvements in cutting speeds and
applied to machining a part, are difficult to predict. There
feedrates over a conventional machine. If the machining
will be some differences and inconsistencies within each
and tooling conditions are the same, the cutting time will be
batch of parts. The parts will not always be exactly the
very close in both cases.
same. Maintaining dimensional tolerances and surface fin-
NUMERICAL CONTROL 3
Some of the major areas where the CNC user can and Long lead time, required to design and manufacture sev-
should expect improvement: conventional machines, can often
eral special fixtures for
be reduced by preparing a part program and the use of sim-
Setup time reduction
plified fixturing.
General productivity increase at will, but once proven, no changes are usually required
scheduling and work allocation to individual machine tools Benders, Winding and Spinning machines, etc.
can be done very accurately.
CNC machining centers and lathes dominate the number
The main reason companies often purchase CNC ma- of installations in industry. These two groups share the
chines is strictly economic - it is a serious investment. Also, market just about equally. Some industries may have a
having a competitive edge is always on the mind of every higher need for one group of machines, depending on their
plant manager. The numerical control technology offers One must remember
needs. that there are many different
excellent means to achieve a significant improvement in
kinds of lathes and equally many different kinds of ma-
the manufacturing productivity and increasing the overall chining centers. However, the programming process for a
quality of the manufactured parts. Like any means, it has to vertical machine is similar to the one for a horizontal ma-
be used wisely and knowledgeably. When more and more chine or a simple CNC mill. Even between different ma-
companies use the CNC technology, just having a CNC chine groups, there is a great amount of general applica-
machine does not offer the extra edge anymore. The com- tionsand the programming process is generally the same.
panies that get forward are those who know how to use the For example, a contour milled with an end mill has a lot in
technology efficiently and practice it to be competitive m common with a contour cut with a wire.
the global economy.
essential that users understand the fundamental principles Standard number of axes on a milling machine is three -
on which CNC technology is based. These principles take the X, Y and Z axes. The part set on a milling system is al-
many forms, for example, understanding the electronic cir- ways stationary, mounted on a moving machine table. The
cuitry, complex ladder diagrams, computer logic, metrol- cutting tool rotates, it can move up and down (or in and
ogy, machine design, machining principles and practices out), but it does not physically follow the tool path.
and many others. Each one has to be studied and mastered
by the person in charge. In this handbook, the emphasis is CNC mills - sometimes called CNC milling machines -
on the topics that relate directly to the CNC programming are usually small, simple machines, without a tool changer
and understanding the most common CNC machine tools, or other automatic features. Their power rating is often
the Machining Centers and the lathes (sometimes also quite low. In industry, they are used for toolroom work,
called the Turning Centers). The part quality consideration maintenance purposes, or small part production. They are
should be very important to every programmer and ma- usually designed for contouring, unlike CNC drills.
Lathes and Turning Centers offset adjustment and other production enhancing and time
saving devices.
Drilling machines
NUMERICAL CONTROL 5
There are two basic designs of a typical CNC machining PERSONNEL FOR CNC
center. They are the vertical and the horizontal machining
centers. The major difference between the two types is the
nature of work that can be done on them efficiently. For a
Computers and machine tools have no intelligence. They
vertical CNC machining center, the most suitable type of
cannot think, they cannot evaluate a situation in a rational
way. Only people with certain skills and knowledge can do
work are flat parts, either mounted to the fixture on the ta-
the field of numerical control, the skills are usually
that. In
ble,or held in a vise or a chuck. The work that requires ma-
in thehands of two key people - one doing the program-
chining on two or more faces in a single setup is more de-
ming, the other doing the machining. Their respective
sirable to be done on a CNC horizontal machining center.
numbers and duties typically depend on the company pref-
An good example is a pump housing and other cubic-like
erence, its size, as well as the product manufactured there.
shapes. Some multi-face machining of small parts can also
However, each position is quite distinct, although many
be done on a CNC vertical machining center equipped with
companies combine the two functions into a one, often
a rotary table.
called a CNC Programmer/Operator.
The programming process is the same for both designs,
but an additional axis (usually a B axis) is added to the hori- CMC Programmer
zontal design. This axis is either a simple positioning axis
The CNC programmer is usually the person who has the
(indexing axis) for the table, or a fully rotary axis for simul-
most responsibility in the CNC machine shop. This person
taneous contouring.
is often responsible for the success of numerical control
This handbook concentrates on the CNC vertical ma- technology in the plant. Equally, this person is held respon-
chining centers applications, with a special section dealing sible for problems related to the CNC operations. Although
with the horizontal setup and machining. The program- duties may vary, the programmer is also responsible for a
ming methods are also applicable to the small CNC mills or variety of tasks relating to the effective usage of the CNC
drilling and/or tapping machines, but the programmer has machines. In fact, this person is often accountable for the
to consider their restrictions. production and quality of all CNC operations.
Lathes and Turning Centers
Many CNC programmers are experienced machinists,
who have had a practical, hands-on experience as machine
A CNC lathe is usually a machine tool with two axes, the tool operators. They know how to read technical drawings
vertical X axis and the horizontal Z axis. The main feature and they can comprehend the engineering intent behind the
of a lathe that distinguishes it from a mill is that the part is design. This practical experience is the foundation for the
rotating about the machine center line. In addition, the cut- 'machine ’a part in an office environment. A good
ability to
ting tool is normally stationary, mounted in a sliding turret. CNC programmer must be able to visualize all the tool mo-
The cutting tool follows the contour of the programmed tionsand recognize all restricting factors that may be in-
tool path. For the CNC lathes with a milling attachment, so volved. The programmer must be able to collect, analyze,
called live tooling, the milling tool has its own motor and process and logically integrate all the collected data into a
rotates while the spindle is stationary. single, cohesive program. In simple terms, the CNC pro-
grammer must be able to decide upon the best manufactur-
The modem lathe design can be horizontal or vertical.
ing methodology in all respects.
Horizontal type is far more common than the vertical type,
but both designs have their purpose in manufacturing. Sev- In addition to the machining skills, the CNC programmer
eral different designs exist for either group. For example, a has to have an understanding of mathematical principles,
typical CNC lathe of the horizontal group can be designed mainly application of equations, solution of arcs and an-
with a flat bed or a slant bed, as a bar type, chucker type or a gles. Equally important is the knowledge of trigonometry.
universal type. Added to these combinations are many ac- Even with computerized programming, the knowledge of
cessories that make a CNC lathe an extremely flexible ma- manual programming methods is absolutely essential to the
chine tool. Typically, accessories such as a tailstock, steady thorough understanding of the computer output and the
rests or follow-up and
rests, part catchers, pullout-fingers control of this output.
even a third axis milling attachment are popular compo-
nents of the CNC lathe, fr. CNC lathe can be very versatile -
The last important quality of a truly professional CNC
programmer is his or her ability to listen to the other people
so versatile in fact, that it is often called a CNC Turning
Center. All text and program examples in this handbook
- the engineers, the CNC operators, the managers. Good
use the more traditional term CNC lathe, yet still recogniz-
listening skills are the first prerequisite to become flexible.
CNC Machine Operator panies talk about safety, conduct safety meetings, display
posters, make speeches, call experts. This mass of informa-
The CNC machine tool operator is a complementary po-
tion and instructions presented to all of us for some very
is
sition to the CNC programmer. The programmer and the
good reasons. Quite afew are based on past tragic occur-
operator may exist in a single person, as is the case in many
rences - many laws, rules and regulations have been written
small shops. Although the majority of duties performed by
as a result of inquests and mquiries into serious accidents.
a conventional machine operator has been transferred to
the CNC programmer, the CNC operator has many unique At first sight, it may seem that in CNC work, the safety is
responsibilities. In typical cases, the operator is responsible a secondary issue. There is a lot of automation, a part pro-
for the tool and machine setup, for the changing of the gram that runs over and over again, tooling that has ben
parts, often even for some in-process inspection. Many used in the past, a simple setup, etc. All this can lead to
companies expect quality control at the machine - and the complacency and false assumption that safety is taken care
operator of any machine tool, manual or computerized, is of. This is a view that can have serious consequences.
also responsible for the quality of the work done on that
machine. One of the very important responsibilities of the Safety is few points that relate to the
a large subject but a
CNC machine operator is to report findings about each pro- CNC work Every machinist should know
are important.
gram to the programmer. Even with the best knowledge, the hazards of mechanical and electrical devices. The first
skills, attitudes and intentions, the ‘final’ program can al- step towards a safe work place is with a clean work area,
ways be improved. The CNC operator, being the one who where no chips, oil spills and other debris are allowed to
is the closest to the actual machining, knows precisely what accumulate on the floor. Taking care of personal safety is
extent such improvements can be. equally important. Loose clothing, jewelry, ties, scarfs, un-
protected long hair, improper use of gloves and similar
infractions, is dangerous in machining environment. Pro-
SAFETY RELATED TO CNC WORK tection of eyes, ears, hands and feet is strongly recom-
mended.
On the wall of many companies is a safety poster with a
simple, yet powerful message: While a machine is operating, protective devices should
be in place and no moving parts should be exposed. Special
The first rule of safety is to follow all safety rules care should be taken around rotating spindles and auto-
matic tool changers. Other devices that could pose a hazard
are pallet changers, chip conveyors, high voltage areas,
The heading of this section does not indicate whether the
safety is oriented at the programming or the machining
hoists, etc. Disconnecting any interlocks or other safety
features is dangerous - and also illegal, without appropriate
The reason is that the safety is totally independent. It
level.
standson its own and it governs behavior of everybody in a skills and authorization.
machine shop and outside of it. At first sight, it may appear In programming, observation of safety rules is also im-
that safety is something related to the machining and the portant. A tool motion can be programmed in many ways.
machine operation, perhaps to the setup as well. That is Speeds and feeds have to be realistic, not just mathemati-
definitely true but hardly presents a complete picture.
cally ‘correct’. Depth of cut, width of cut, the tool charac-
teristics, all have a profound effect on overall safety.
Safety is the most important element in programming,
setup, machining, tooling, fixturing, inspection, shipping,
All these ideas are just a very short summary and a re-
and you-name-it operation within a typical machine shop minder that safety should always be taken seriously.
daily work. Safety can never be overemphasized. Com-
2 CNC MILLING
Many different types of CNC machines are used in indus- Types of Milling Machines
try, and the majority of them areCNC machining centers
Milling machines can divided into three categories:
and CNC lathes. They are followed by wire EDM, fabricat-
ing machines and machines of special designs. Although By the number of axes - two, three or more
the focus of this on the two types that domi-
handbook is
By the orientation of axes - vertical or horizontal
nate the market, many general ideas can be applied to other
CNC equipment. By the presence or absence of a tool changer
axes - and for this reason, they are called the XY machines.
7
8 Chapter 2
These simplified definitions do not really reflect reality Each machining center is described by its specifications
art in machine tool manufacturing.
of the current state of as provided by the machine tool manufacturer. The manu-
The machine tool industry is constantly changing. New and facturer lists many specifications as a quick method of
more powerful machines are designed and produced by comparison between one machine and another. It is not un-
many manufacturers worldwide, with more features. usual to find a slightly biased information in the descriptive
brochure - after all, it is a sales tool.
The majority of modern machines designed for milling
are capable of doing a multitude of machining tasks, not In the area of milling systems, three most common ma-
only the traditional milling. These machines are also capa- chine tools are available:
ble of many other metal removing operations, mainly drill-
CNC Vertical Machining Center - VMC
ing, reaming, boring, tapping, profiling, thread cutting and
many others. They may be equipped with a multi-tool mag- CNC Horizontal Machining Center - HMC
azine (also known as a carousel), a fully automatic tool
CNC Horizontal Boring Mill
changer (abbreviated as ATC) and a pallet changer (abbre-
viated as APC), a powerful computerized control unit (ab- Programming methods do not vary too much for either
breviated as CNC), and so on. Some machine models may type, except for special accessories and options. Some of
have additional features, such as adaptive control, robot in- the major differences be the orientation of machine
will
terface, automatic loading and unloading, probing system, axes, additional axis for indexing or full rotary motion, and
high speed machining features and other marvels of mod- the type of work suitable for individual models. Descrip-
ern technology. The question is - can machine tools of these tion of the most common type of a machining center - the
capabilities be classified as simple CNC milling machines? Vertical Machining Center (VMC) - presents a fairly accu-
In two words - certainly not. Milling machines that have at rate sample of describing other machines of the group.
leastsome of the advanced features built-in, have become a
new breed of machine tools - CNC Machining Centers. Vertical Machining Centers
This term is strictly CNC related - a manual machining
center is a description that does not exist. Vertical machining centers are mainly used for flat type
of work, such as plates, where the majority of machining is
Machine Axes done on only one face of the part in a single setup.
Milling machines and machining centers have at least A vertical CNC machining center can also be used with
three axes - X,Y and Z. The machines become more flexi- an optional fourth axis, usually a rotary head mounted on
ble if they have the fourth axis, usually an indexing or a ro- the main table. The rotary head can be mounted either ver-
of all axes has certain limitations. For example, a four-axis of the spindle, not the operator's. That means the view is
vertical machine has X, Y and Z axis as primary axes, plus as if looking straight down, at ninety degrees towards
an indexing table, designated as an A axis. The indexing ta- the machine table for development of the tool motion.
ble is used for positioning, but it cannot rotate simulta- Programmers always view the top of part!
neously with the motion of primary axes. That type of a TWO -
various markers located somewhere on the machine
machine is often called a 'three and a half axis’ machine. show the positive and the negative motion of the machine
By contrast, a more complex but similar machine that is axes. For programming, these markers should be ignored!
equipped with a fully rotating table, is designed as a four These indicate operating directions, not programming
axis machine. The rotary table can move simultaneously directions. As a matter of fact, typically the programming
with the cutting motion of the primary axes. This is a good directions are exactly the opposite of the markers on the
example of a true four am' machine tool. machine tool.
CNC MILLING 9
Table dimensions
780 x 400 mm 500 x 500 mm
31x16 inches 20 x 20 inches
Number of tools 20 36
AC 7. 5/5. 5 kW AC 1 1/8 kW
Spindle output
AC 10/7 HP AC 15/11 HP
30000 mm/min (XY) - 24000 mm/min (Z) 30000 mm/min (XY) - 24000 mm/min (Z)
Rapid traverse rate
1181 in/min (XY) - 945 in/min (Z) 1181 in/min (XY) - 945 in/min (Z)
6 kg 20 kg
Maximum tool weight
13 lbs 44 lbs
Horizontal Machining Centers There are many applications in this area. Common exam-
Horizontal CNC Machining Centers arc also categorized
ples are large parts, such as pump housings, gear cases,
manifolds, engine blocks and so on. Horizontal machining
as multi-tool and versatile machines, and are used lor cu-
centers always include a special indexing table and are
bical parts, where the majority of machining has to be done
typically equipped with a pallet changer and other features.
on more than one face in a single setup.
10 Chapter 2
Because of their flexibility and complexity, CNC hori- part of the way towards They both meet in the
the spindle.
zontal machining centers are priced significantly higher area of the part that could be machined using all the ma-
than vertical CNC machining centers. chine tool resources.
From the programming point of view, there are several Horizontal boring mill may be called a 3-1/2 axis CNC
unique differences, mainly relating to the Automatic Tool machine, but certainly not a 5-axis CNC machine, even if
Changer, the indexing table, and - in some cases - to the ad- the count of the axes is live. Programming procedures for
ditional accessories, for example, the pallet changer. All CNC boring mills are very similar to the horizontal and
differences are relatively minor. Writing a program for the vertical CNC machining centers.
horizontal machining centers is no different than writing a
program for vertical machining centers. Typical Specifications
or two cutting tools mounted at a time, but has more ma- REAR lathe ... a unique slant bed type
chining power.
Slant bed type is very popular for general work, because
Typical lathe work controlled by a CNC system uses ma- its design allows cutting chips to fall away from the CNC
chinesknown in industry as the CNC Turning Centers or - operator and, in case of an accident, forces the part to fall
more commonly - the CNC lathes. down into a safe area, towards the chip conveyer.
The term ‘turning center' is rather unpopular, but an ac- Between the categories of flat bed and slant type lathes,
curate overall description of a computerized lathe (a CNC frontand rear lathes, horizontal and vertical lathe designs,
lathe) that can be used for a great number of machining op- there is another variety of a lathe. This category describes
erations during a single setup. For example, in addition to CNC lathes by the number of axis, which is probably the
the standard lathe operations such as turning and boring, a simplest and most common method of lathe identification.
CNC lathe can be used for drilling, grooving, threading,
knurling and even burnishing. can also be used in differ-
It
spindle, a tailstock, a steadyrest and many other features are perpendicular to each other and represent the typical
not always associated with a conventional lathe design. two-axis lathe motions. The X axis also represents the cross
Lathes with more than four axes are also common. With travel of the cutting tool, the Z axis represents its longitudi-
constant advances in machine tool technologies, more nal motion. All varieties of cutting tools are mounted in a
CNC lathes appear on the market that are designed to do a turret (a special tool magazine) and can be external or inter-
number of operations in a single setup, many of them tradi- nal. Because of this design, the turret loaded with all cut-
tionally reserved for a mill or a machining center. ting tools moves along the X and Z axes, which means all
the vertical CNC lathe and the horizontal CNC lathe. Of ing or punching, is the Z axis.
11
12 Chapter 3
t z-
t
<- -+z+ <n
v This
Two-axis Lathe
Three-axis Lathe
The third axis has its own power source but the power rat-
ing is relatively lower when compared with the majority of
machining centers. Another limitation may be the smallest
increment of the third axis, particularly on the early three
axis lathes. Smallest increment of one degree is certainly
more useful than an increment of two or five degrees. Even
better is an increment of 0. °, 0.01 °, and commonly 0.00 0
1
on the latest models. Usually the lathes with three axes of-
fer a very fine radial increment that allows a simultaneous
rotary motion. Those with low increment values are usually
Schematic representation of a vertical CNC lathe designed with an oriented spindle slop only.
This is true for both the front and rear lathes and for lathes From the perspective of CNC part programming, the ad-
with three or more axes. The chuck face is oriented verti- ditional knowledge required a subject not difficult to
is
cally to the horizontal spindle center line for all horizontal learn. General principles of milling apply and many pro-
lathes. Vertical lathes, due to their design, are rotated by gramming features are also available, for example, fixed
90°, where the chuck face is oriented horizontally to the cycles and other shortcuts.
vertical spindle center line.
CNC TURNING 13
Not every lathe job benefits from the 4-axis machining. Tool size round
040 mm
01.57 inches
There are cases when it is more costly to run a job on a
Indexing time 0.1 second
4-axis lathe inefficiently and it may be very efficient to run
the same job on a 2-axis CNC lathe. Axis travel in X axis
222 mm
8.75 inches
A small to medium size six-axis lathe is popular CNC Spindle speed 35 - 3500 rpm
choice of screw machine shops and industries with similar
Minimum input increment
0.001 mm
.0001 inch
small parts and large volume applications.
Motorized head:
FEATURES AND SPECIFICATIONS Number of rotating tools 12
well done. It is the purpose of the brochure to make a good Tap size
M3 M16 - metric
#5 - 5/8 inches
marketing tool and attract the potential buyer.
14 Chapter 3
It is very important to understand the specifications and u Thread cutting of various forms (including taper and
features of the CNC machine tools in the shop. Many fea- circular) can be performed, depending on the control model
tures relate to the control system, many others to the ma- Dwell can use the P, U or X address (G04)
chine tool itself. In CNC programming, many important
decisions are based on one or several of these features, for Tool selection uses 4-digit identification
example number of tool stations available, maximum spin- Feedrate selection (normal) in mm/rev or in/rev
dle speed and others.
Feedrate selection (special) in m/min or in/min
The last item in understanding the overall description of a Multiple repetitive cycles for turning, boring, facing, contour
CNC lathe is the look at some control features unique to repeat, grooving, and threading are available
lathes and how they differ form a typical milling control.
Feedrate override is common from 0 to 200% in 1 0%
The subject of control features is described in more detail
increments (on some lathes only from 0 to 1 50%)
in Chapter 5.
X axis can be mirrored
At this time, some features and codes may not make
Tailstock can be programmable
much sense - they are included for reference only. Com-
mon and typical features are listed: Automatic chamfering and corner rounding
R and / K in G01 mode
I
The major step towards the basic understanding of CNC The length of each division on the scale represents the
principlesand geometrical concepts is the understanding of unit ofmeasurement a convenient and generally ac-
in
a subject known
in mathematics as the system of coordi- cepted scale. It may come as a surprise that this concept is
nates. System of coordinates is founded on a number of used every day. For example, a simple ruler used in schools
mathematical principles dating back over four hundred is based on the number scale concept, regardless of mea-
years. The most important of these principles are those that suring units. Weight scales using tons, pounds, kilograms,
can be applied to the CNC technology of today. In various grams and similar units of mass are other examples. A
publications on mathematics and geometry, these princi- simple household thermometer uses the same principle.
ples are listed under the headings like the real number sys- Other similar examples are available as well.
tem and the rectangular coordinates.
RECTANGULAR COORDINATE SYSTEM
REAL NUMBER SYSTEM
Rectangular coordinate system is a concept used to de-
The key to understanding the rectangular coordinates is fine a planar 2D point, using the XY coordinates, or a spa-
the knowledge of arithmetic, algebra and geometry. The cial 3D point, using the XYZ coordinates. It was first de-
key knowledge in this area is the knowledge of the real fined in the 17th century by a French philosopher and
number system. Within the real number system, there are mathematician Rene Descartes (1596-1650). His name is
ten available numerals (digits), 0 to 9 (zero to nine), that used as an alternative to the rectangular coordinate system,
can be used in any of the following groups: called the Cartesian Coordinate System - see Figure 4-2.
J Positive integers . . 1 , 2 ,
+3 ,
10 12943 , , +45
(with or without sign)
Fractions... 1 /8 , 3 / 16 , 9/ 32 35/64 ,
Figure 4-2
Computerized Numerical Control means control by the
numbers using a computer. All information in a drawing Rectangular coordinate system (Cartesian coordinate system
of a real number system can be expressed graphically on a matically defined on a plane (two coordinate values) or in
l l l I l l l l l l i l I I l l
be specified. In programming, point represents an exact lo-
cation. If such a location is on a plane, the point is defined
as a 2D point, along two axes. If the location is in a space,
Figure 4- the point is defined as a 3D point, along three axes.
Graphical representation of the Number Scale
15
16 Chapter 4
Point of Origin
When two number scales that intersect at right angles are
used, mathematical basis for a rectangular coordinate sys- Another term that emerged from the rectangular coordi-
tem is created. Several terms emerge from this representa- nate system is called the point of origin, or just origin. It is
tion, and all have an important role in CNC programming.
the point where the two perpendicular axes intersect. This
Their understanding is very important for further progress. point has a zero coordinate value in each axis, specified as
planar XOYO and spacial X0Y0Z0 - Figure 4-4.
Axes and Planes
Each major line of the number scale is called an axis.
This old principle, when applied to CNC programming,
means that at least two axes - two number scales - will be
used. This is the mathematical definition of an axis:
Viewing the two intersecting axes and the new plane, four
distinct be clearly identified. Each area is
areas can
bounded by two axes. These areas are called quadrants.
Mathematically defined,
Top View or a Plan View. Other planes are also used in tion from the horizontal X axis and the naming convention
CNC, but not to the same extent as in CAD/CAM work. uses Roman numbers, not Arabic numbers normally used.
COORDINATE GEOMETRY 17
A Y axis
Quadrant II - Quadrant I
X-Y+ - X+Y+
• I- -I- -t
—1-^prH i — ——
i i
i i X axis
Quadrant III
“ Quadrant IV
X-Y- " X+Y-
Figure 4-5
distance along an axis, relative to the origin - Figure 4-6. If these directions were superimposed over a human right
hand, they would correspond to the direction from the root
COORDINATE of thumb or finger towards its tip. The thumb would point
POINT LOCATION
X AXIS Y AXIS in the X direction, the index finger in the Y direction and
+ Z direction.
QUADRANT 1 + the middle finger in the
QUADRANT III
- - X0Y0Z0. This absolute method of pro-
the point of origin
gramming follows very strictly the rules of rectangular co-
QUADRANT IV + - ordinate geometry and all concepts covered in this chapter.
Figure 4-6
MACHINE GEOMETRY
Algebraic signs for a point location in plane quadrants
axis. Opposite directions are negative. nal direction, the Y axis is the saddle cross direction and
Chapter 4
18
, x+ z+
* REAR LATHE
FRONT LATHE
VERTICAL LATHE
X+
Figure 4-10
Standard orientation of planes and CNC machine tool axes zontal lathe rotated 90°. Typical axes for the horizontal and
vertical machine axes, as applied to turning, are illustrated
Ihe Z axis is the spindle direction. For horizontal machining in Figure 4-10.
centers, the terminology is changed due to the design of
these machines. The X axis is the table longitudinal direc- Additional Axes
tion, the Y axis is the column direction and the Z axis is the
indexing B axis. Typical machine axes applied to CNC ver- mally parallel to the primary X, Y
and Z axes respectively.
machines are illustrated in Figure 4-9. For a rotary or an indexing applications, the additional axes
tical
are defined as A, B and C
axes, as being rotated about the
X, Y and Z axes, again in their respective order. Positive di-
t* rection of a rotary (or an indexing) axis is the direction re-
quired to advance a right handed screw in the positive X, Y
i
Y+ or Z axis. The relationship of the primary and the second-
1 ary (or supplementary) axes is shown in Figure 4-11.
S'
Primary
— A
X+ 1 \
N. X Y Z axes
u V w Secondary
axes
ISOMETRIC VIEW Arc center
TOP VIEW 1 J K ]
vectors
Figure 4-9 Rotary
Typical machine axes of a vertical CNC machining center A B C J axes
What is more common for CNC lathes in industry, is the Arc center modifiers (sometimes called the arc center
double orientation of the XZ axes. Lathes arc distinguished vectors) are not true axes, yet they are also related to the
as front and a rear lathes. An example of a front
lathe is
primary axes XYZ. This subject will be described in the
similar to the conventional engine lathe. All the slant bed section on Circular Interpolation, in Chapter 29.
types of a lathe are of the rear kind. Identification of the
axes have often not followed mathematical principles.
5 CONTROL SYSTEM
A machine unit equipped with a computerized numerical In order to fully understand the CNC programming pro-
control system is commonly known as a CNC machine. In cess, it is important to understand not only the intricacies of
an analogy of the machine tool as the body of a CNC ma- how to machine a part, what tools to select, what speeds
chine system, the control unit is its brain ,
its nerve center. and feeds to use, how to setup the job and many other fea-
There are no levers, no knobs and no handles on a CNC tures. It is equally important to know how the computer, the
machine the way they function on conventional milling CNC unit, actually works without the need to be an expert
machines and lathes. All the machine speeds, feeds, axes in electronics or a computer scientist. Figure 5-1 shows an
motions and hundreds of other tasks are programmed by a actual Fanuc control panel.
CNC programmer and controlled by a computer that is ma-
jor part of the CNC unit. To make a program for a CNC ma-
The machine manufacturers add their own operation
panel, with all the switches and button needed to operate
chine tool means to make a program for the control system.
True, the machine tool is a major consideration as well, but
the CNC all its features. A typical operation
machine and
panel Figure 5-2. Another item required for
is illustrated in
it is the control unit that determines th e format of the pro-
the system, the handle, will be described as well.
gram, its structure and its syntax.
SELECTION KEYS
FUNCTION
MENU KEY
SOFTKEYS OPERATION
MENU KEY
SHIFT KEY \ \
CURSOR KEYS
ON /OFF BUTTONS
END-OF-BLOCK KEY
PAGE CHANGE KEYS CANCEL KEY
INPUT KEY
Figure 5-
A typical example of a Fanuc control panel - actual layout and features will vary on different models (Fanuc 16Mj
19
20 Chapter 5
GENERAL DESCRIPTION The control unit - the CNC system - contains features that
only work in it does not do
conjunction with the program,
anything useful on own. Some features can be used only
its
Even a brief look at any control unit reveals that there are
if the program itself supports them. All switches and but-
two basic components - one is the operation panel full of ,
tons and keys are used by the machine operator, to exercise
rotary switches, toggle switches and push buttons. The
control over the program execution and machining process.
other component is the display screen with a keyboard or a
keypad. The programmer who does not normally work on
Operation Panel
the CNC machine will seldom, if ever, have a reason to use
either the operation panel or the display screen. They are Depending on the type of the CNC machine, the follow-
available at the machine to the CNC machine operator, and ing table covers the most typical and common features
used for the machine setup as well as to control the activi- found on the modern operation panel. There are some small
ties of the machine. differences for the operation of a machining center and a
lathe, but As with any
both operation panels are similar.
Should the CNC programmer be ma-
interested in the
general reference book, always a good idea to double
it is
chine operation? Is it necessary for the programmer to check with the manufacturer specifications and recommen-
know and understand all functions of the control system? dations. It is common that many machines used in the shop
There is only one answer to both questions - definitely yes. have some special features.
A typical operation panel of a CNC machining center - actual layout and features will vary on different models
CONTROL SYSTEM 21
ON /OFF Power and control switch for AUTO Mode Allows automatic operations
switch the main power and the control unit
MEMORY Allows program execution from the
Starts program execution mode memory of the CNC unit
Cycle Start
or MDI command
Allows program execution from an
Emergency Stops machine activity and
all external device, such as a desktop
Stop turns off power to the control unit computer or a punched tape
Feedhold Temporarily stops motion of all axes EDIT Allows changes to be made to a
mode program stored in the CNC memory
Single Block Allows program run one block at a time
MANUAL
Allows manual operations during setup
Temporarily stops the program Mode
Optional Stop
execution (M01 required in program)
JOG Mode Selects the jog mode for setup
Ignores blocks preceded with
a forward slash ( / ) in the program RAPID Mode Selects the rapid mode for setup
Spindle Overrides the programmed spindle speed, Error Lights Red light indicating an error
Override usually within 50-120% range
Tool Change Switch allowing a manual tool change structions to the control. Existingprograms can be modi-
fied or deleted, new programs can be added. Using the key-
Switches and lights relating to setup of
board input, not only the machine axes motion can be
the machine from reference position controlled, but the spindle speed and feedrate as well.
Changing the internal parameters and evaluating various
Manual Pulse Generator (MPG).
diagnostics are more means of control, often re-
specific
used for Axis Select and Handle
stricted to service people. Keyboard and screen arc used to
Increment switches
set the program origin and to hook up to external devices,
Tailstock Tailstock and/or quill switch to manually such as a connection with another computer. There are
Switch position the tailstock many other options. Every keyboard allows the use of let-
ters, digits and symbols for data entry. Not every keyboard
Indexing Manually indexes machine table allows the use of all the alphabet letters or all available
Table Switch during setup symbols. Some control panel keys have a description of an
operation, rather than a letter, digit or symbol, for example,
Manual Data Input mode
Read and Punch keys or the Offset key.
22 Chapter 5
cated on the operation panel as well as on the handle) and the computer has to be designed by a company that has ex-
the range of increment (that is the least increment X X 1 ,
1
pertise in this type of special purpose computers. Unlike
and X100). The letter X in this case is the multiplier and many business types of computers, each CNC unit is made
stands for ‘X times'. One handle division will move the se- for a particular customer. The customer is typically the ma-
lected axis by X times the minimum increment of the active chine manufacturer, not the end user. The manufacturer
units of measurement. In Figure 5-3 and the following table specifies certain requirements that the control system has to
are the details of a typical handle. meet, requirements that reflect the uniqueness of the ma-
chines they build. The basic control does not change, but
some customized features may be added (or taken away)
for a specific machine. Once the control system is sold to
the machine manufacturer, more features are added to the
system. They mainly relate to the design and capabilities of
the machine.
Parameter Settings
#6 #5 #4 #3 #2 #1 #0
Handle
Multiplier
One handle
xxxx
D
#7
1 1 0
IS K9 0
D
one of
The Fanuc control system parameters belong to
XI 0.001 mm .0001 inch three groups, specified within an allowed range:
Units inputs
X100 0.100 mm .0100 inch
Setting values
CONTROL SYSTEM 23
Units input , for example, is used to set the increment sys- settings away from the control, in a sate place, just in case.
control
to the user and the parameter setting, whether the
will recognize 0.001 mm or .0001 inches as the least incre- Many parameters are periodically updated during pro-
ment. Another example a parameter setting that stores
is gram processing. The CNC operator is usually not aware
the maximum feedrate for each axis, the maximum
spindle going on at all. need to
There is no real
that this activity is
even if it is possible. Such a setting is wrong and can required, an authorized person should be assigned to do
cause serious damage! them - nobody else.
cation for a typical Fanuc control system (many of them are Many parameter settings stored in the control at the time
meaningful to the service technicians only): of purchase have been entered by the manufacturer as ei-
ther the only choices the most suitable choices or the most
, ,
A computer is fast and accurate but has no intelligence. Modern methods of measuring memory
People are often slow and make errors, but have one unique capacity prefer
touse bytes as the unit, rather that a length of an
obsolete
ability- they think. A
computer is just a machine that does tape. A byte is the smallest unit of storage
not assume anything, does not consider, does capacity and is
not feel - very roughly equivalent to one character in the
program.
computer does not think. A
computer does not do anything
that a human effort and ingenuity has not done during The memory capacity of the control system should be
the
design process, in form of hardware and software. large enough to store the longest CNC program expected
on a regular basis. That requires some planning before the
When the CNC machine
powered, the internal soft-
is CNC machine is purchased. For example, in three dimen-
ware sets certain existing parameters to their default condi-
sional mold work or high speed machining, the
cost of ad-
tion, designed by engineers. Not all system
parameters, ditional memory capacity may be very high. Although any
only certain parameters can have an assumed condition - a
cost a relative term, there are reliable and inexpensive
is
al-
condition that is known as the default value (condition). ternatives, well worth looking into.
which the G01 requires. Had the default setting been the To find the program length in meters ,/when the capacity
rapid motion GOO, a rapid motion would be performed, as it
is known in characters, use the following formula:
does not need programmed feedrate.
O Formula 3 :
block are processed as a single instruction. The blocks are
received by the control system in sequential order, from the
To find the number of characters in a given program, if
top down and in the order they appear in the program.
the system memory capacity is known in meters: Normally, a CNC machine is run in a continuous mode,
while the blocks are processed automatically, one after an-
. .
gle block mode, only one block of the program will be pro-
cessed each time the Cycle Start key is pressed. On the op-
C = Number of available characters
eration panel, the single block mode can be used separately
m = Memory capacity in meters
or in combination with other settings that make program
Virtually the same results can be achieved by a slightly proving faster and more accurate.
restructured formula:
Feedhold
m x 1000
Feedhold is a special push button located on the operation
2.54 panel, usually close to the Cycle Start button. When this
button is pressed during a rapid, linear or circular axes mo-
tion, immediately stop the motion. The action ap-
will
O Formula 4:
plies to
it
To find the number of characters, if the system memory for a machine setup or a first part run. Some types of mo-
capacity is known in feet, use the following formula: tion restrict the function of the feedhold or disable it alto-
gether. For example, threading or tapping modes make the
switch inoperative.
C = f x 120
Activating feedhold at the machine will not change any
other program values - it will only affect the motion. The
eg* where . .
Latest Fanuc controls show the available memory as the Emergency Stop
number of free screen display pages. This type of data is
not easy to convert as the others. Every CNC machine has at least one special mushroom
shaped push button, red in color, that is located in an acces-
In cases where the available memory capacity is too sible place on the machine. It is marked the Emergency
small to accept a large program, several techniques are Stop or E-stop. When this button is pressed, all machine ac-
available to minimize the problem, for example, the pro- tivities will cease immediately. The main power supply will
gram length reduction methods, described in Chapter 50.
be interrupted and the machine will have to be restarted.
The emergency slop switch is a mandatory safety feature
MANUAL PROGRAM INTERRUPTION on all CNC machines.
chine tool automatically and sequentially in a continuous For some machine actions, the effect of Emergency Stop
mode. Every program is a series of formatted commands
-
is not always apparent. For example, the spindle requires a
or instructions - written as individual lines of code, called certain time for deceleration to stop.
blocks. Blocks and their concepts will be described in the
following chapters. All program commands in a single
26
Chapter 5
MANUAL DATA INPUT - MDI Override switches can be used individually or together.
They are available on the control to make the work easier
for both the operator and the programmer.
A CNC machine is not always operated by the means of a The operator
program. During a part setup, the CNC operator has to do a does not need to ‘experiment’ with speeds and feeds by
number constantly editing the program and the programmer has a
of operations that require physical movements of
certain latitude in setting reasonable values for the cutting
the machine slides, rotation of spindle, tool change, etc.
feedrates and the spindle speed. The presence of the over-
There are no mechanical devices on a CNC machine. The
ride switches is not a licence to program unreasonable
handle (Manual Pulse Generator) is an electronic, not a
mechanical unit. In order to operate a CNC machine with- cutting values. The overrides are fine tuning tools only - the
out conventional mechanical devices the control system of-
program must always machining conditions of
reflect the
the work. The usage of override switches does not make
fers a feature called the Manual Data Input - or MDI.
any program changes, but gives the CNC operator the op-
The Manual Data Input enables the input of a program portunity to edit the program later to reflect the optimum
data into the system one program instruction at a time. If cutting conditions. Used properly, the override switches
too many instructions were to be input repeatedly, such as a can save a great amount oi valuable programming time as
long program, the procedure would be very inefficient. well as the setup time.at the CNC machine.
During a setup and for similar purposes, one or a few in-
structions at a time will benefit from the MDI. Rapid Motion Override
To access the MDI mode, the MDI key on the operation Rapid motions are selected in the CNC program by a pre-
panel must be selected. That opens the screen display with paratory command without a specified feedrate. If a ma-
the current status of the system. Not all, but the majority of chine is designed to move at 500 in/min (12700 mm/min)
programming codes are allowed in the MDI mode. Their in the rapid mode, never appear in the pro-
this rate will
format is CNC
identical to the format of a program in writ- gram. Instead, you motion mode by program-
call the rapid
ten form. This is one area where the CNC operator acts as a ming a special preparatory command GOO. During the pro-
CNC programmer. It is very important that the operator is
gram execution, all motions in the GOO mode wifi be at the
trained at least in the basics of CNC programming, cer- manufacturer’s fixed rate. The same program wifi run faster
tainly to the point of being able to handle the setup instruc- on a machine with high rapid motion rating then on a ma-
tions for Manual Data Input. chine with low rapid motion rating.
feedrate or the spindle speed by editing the program, but the actual reduced rates are250 in/min or 6350 mm/min at
this method is not very efficient. A
certain ‘experimenta- the 50% setting and 125 in/min or 3175 mm/min at the
tion’ may be necessary during the actual cut to find the opti- 25% setting. Each of the reduced rates is more comfortable
mum setting value. The manual override switches come to to work with during setup.
the rescue, because they can be used by trial during
operation. There are four override switches found on most
The fourth position of the switch often has
no percentage
assigned and is identified as an FI or
by a small symbol. In
control panels:
this setting, the rapid motion rate is even slower than that of
Rapid feedrate override (rapid traverse) 25% setting. Why is it not identified as 10% or 15%, forex-
(modifies the rapid motion of the machine tool) ample? The reason is simple - the control system allows a
Spindle speed override
customized selection as to what the value wifi be. It may be
a setting of between 0 and 100%. The default setting is also
(modifies the programmed spindle r/min)
the most logical - usually 10% of the maximum rapid tra-
Feedrate override (cutting feedrate) verse rate. This setting should never be higher than 25%
(modifies the programmed feedrate) and can be done only through a setting of a system parame-
Dry run mode ter. Make sure that all persons who work on such a machine
The same logic used for the application of the rapid rate The most commonly used override switch is one that
override can be used for the spindle speed override. The re- changes programmed feedrates. For the milling controls,
quired change can be established during the actual cutting the feedrate is programmed in in/min or m/min. For lathe
controrpanei. For example, if the programmed spindle The feedrate per minute on lathes is used only in cases
speed of 1000 r/min is too high or too low, it may be when the spindle is not rotating and the feedrate needs to be
changed temporarily by the switch. During the actual cut- controlled.
speed up or down when needed. A simple human oversight have the 0% percent setting and start at 10%. The maxi-
may ruin the part, the cutting tool or both. The recom- mum of 150% or 200% cutting feedrate will cut ,5x or 2x 1
mended method is to find out the optimum speed for each faster than the programmed value.
ple: x- the control panel by the Dry Run switch. only has a direct It
S„ = Optimized -or new -r/min What is the purpose of the dry run and what are its bene-
Sp = Originally programmed r/min fits? Its purpose is to test the integrity of the program before
p = Percentage of spindle override
the CNC operator cuts the first part. The benefits are
mainly in the time saved during program proving when no
Overriding the programmed spindle speed on the CNC
machining takes place. During a dry run, the part is nor-
machine should have only one purpose - to establish the
mally not mounted in the machine. If the part is mounted in
spindle speed rotation for the best cutting conditions.
28
Chapter 5
those that relate to the actual contact of the cutting tool with put by the Manual Data Input key. The operation of this
the material. function is closely tied to the machine tool design. More in-
formation on the usage can be found in the machine tool
The dry run is a very efficient setup aid to prove the over- manual. This function is very handy when a tool breaks
all of the CNC program. Once the program is
integrity during processing of long programs. It can save valuable
proven during a dry run, the CNC operator can concentrate production time, if used properly.
on the sections of the program that contain actual machin-
ing. Dry run can be used in combination with several other Auxiliary Functions Lock
features of the operation panel. .
There are three functions available to the operation of a
Make sure to disable the dry run before machining!
CNC machine that are part of the auxiliary functions' '
>
Z Axis Neglect
a program by locking all the tool motions, but there is a Once machine operator finds what values must be
the
good reason to use this feature. It gives the CNC operator changed program itself, the program must be edited
in the
the chance to test the program with virtually no chance of a to reflect these changes. Not only for the job currently
collision. worked on, but also for any repetition of the job in the fu-
ture. After all, it should be the goal of every programmer
When machine lock is enabled, only the axis motion
the
is locked. All other program functions are executed nor-
and CNC operator to run any job at one hundred percent ef-
ficiency. This efficiency is most likely reached as a com-
mally, including the tool change and spindle functions.
bined effort of the operator and the programmer. A good
This function can be used alone or in combination with
other functions in order to discover possible program er-
CNC programmer will always make the effort to reach
100% efficiency at the desk and then improve the program
rors. Probably the most typical errors are syntax errors and
even further.
the various tool offset functions.
tested with a rapid motion set to 25% or 50% of the avail- Graphic representation of the tool path on the display
able rapid rate. This relatively slow setting allows the oper- screen is one of the most important, as well as sought after,
ator to monitor the integrity of the program processing, as control options. Do not confuse this option with any type of
well as specific details. The may
include items such
details conversational programming, which also uses a graphic-
as a possibility of insufficient clearance between the tool tool path interface. In the absence of a computer assisted
and the material, checking if the Tool Path looks reason- programming (CAM), a graphic display on the control
able, and so on. panel is a major benefit. Whether in monochrome or in
color, the convenience of seeing the tool motions before ac-
The CNC operator will have a number of tasks to perform tual machining is much appreciated by CNC operators and
simultaneously. Some
of the tasks include monitoring the programmers alike.
spindle speed, feedrate, tool motions, tool changes, cool-
ant, etc. A careful and conscious approach results in build- A typical graphics option shows the machine axes and
ing the confidence in the integrity of the CNC program. It two cursors for zooming. When
the tool path is tested, indi-
may be the second or even the third part of the job when the vidual tools are distinguished by different colors, if avail-
CNC operator starts thinking of the optimization of the cut- able or different intensity. Rapid motions are represented
ting values, such as the spindle speed and the cutting fee- by a dashed motions by a continuous line
line type, cutting
drates. This optimization will truly reflect the ideal speeds type. If the graphics functionis applied during machining,
and feeds for a particular workpiece under given setup. the tool motions can be watched on the display screen -
very helpful for those CNC machines that have dirty, oily
A production supervisor should not arbitrarily criticize an and scratched safety shields.
override setting less than 100%.Many managers consider
the CNC program as an unchangeable document. They Upwards or downwards scaling of the display allows for
take the altitude that what is written is infallible - which evaluation of a tool motion overall or for detail areas. Many
is
not always true. Often, the CNC controls also include actual tool path simulation, where the
may have no
operator
other choice but to override the programmed values. What shape of the part and the cutting tool can be set first, then
is most important, is the modification of the program that seen on the screen.
reflects the optimized cutting conditions.
Chapter 5
30
Technological decisions
are the type and the size of the CNC machine, particularly
its work space or work area. Other features, equally impor-
Work sketch and calculations tant, are the machine power rating, spindle speed and
feedrate range, number of tool stations, tool changing sys-
Quality considerations in CNC programming
tem. available accessories, etc. Typically, small ma- CNC
The steps in the list are suggestions only - a guideline. chines have higher spindle speeds and lower power rating,
They are quite flexible and should always be adapted for large machines have lower spindle speeds available, but
each job and to the specific conditions of the work. their power rating is higher.
Control System
INITIAL INFORMATION
The control system is the heart of a CNC machine. Being
Most drawings define only the shape and size of the com- familiar with all the standard and optional features avail-
pleted part and normally do not specify data about the able-on all controls is a must. This knowledge allows the
initial blank material. For programming, a good knowledge use of a variety of advanced programming methods, such
of the material is an essential start - mainly in terms of its as the machining cycles, subprograms, macros and other
size, type, shape, condition, hardness, etc. The drawing and timesaving features of a modern CNC system.
material data are the primary information about the part. At
this point, CNC
program can be planned. The objective of A programmer does not have to physically run a CNC
machine. Yet, the programs will become better and more
such a plan is to use the initial information and establish the
creative with good understanding of the machine and its
most efficient method of machining, with all related con-
control system. Program development reflects program-
siderations - mainly part accuracy, productivity, safety and
convenience. mer’s knowledge of the CNC machine operation.
31
32 Chapter 6
Disadvantages
One of the main concerns in program planning should be
the operator’s perception of the program. To a large degree,
There are some disadvantages associated with manual
such a perception is quite subjective, in the sense that dif- programming. Perhaps the most common is the length of
ferent operators will express their personal preferences. On time required to actually develop a fully functioning CNC
the other hand, every operator appreciates an error-free, program. The manual calculations, verifications and other
concise, well documented and professionally prepared part
related activities in manual programming are very time
program, consistently and one after another. A poorly de- consuming. Other disadvantages, also very high on the list,
signed program is disliked by any operator, regardless of are a large percentage of errors, a lack of tool path verifica-
personal preferences. tion, the difficulty in making changes to a program, and
many others.
PART COMPLEXITY
Advantages
At the time the drawing, material and the available CNC On manual part programming does have
the positive side,
equipment are evaluated, the complexity of the program- quite a few unmatched qualities. Manual programming is
ming task becomes much clearer. How difficult is to pro- so intense that it requires the total involvement of the CNC
gram the part manually? What are the capabilities of the programmer and yet offers virtually unlimited freedom in
machines? What are the costs? Many questions have to be
the development of the program structure. Programming
answered before starting the program. manually does have some disadvantages, but it leaches a
tight discipline and organization in program development.
Simple programming jobs may be assigned to a less
It forces the programmer to understand programming tech-
experienced programmer or the CNC operator. It makes
also a niques to the last detail. In fact, many useful skills learned
sense from the management perspective and it is
in manual programming are directly applied to CAD/CAM
good way to gain experience.
programming. Programmer has to know what is happening
complex jobs will benefit from a computer-
Difficult or at all times and why it is happening. Very important is the
ized programming system. Technologies such as Computer- in-depth understanding of every detail during the program
Aided Design (CAD) and Computer Aided Manufacturing development.
(CAM) have been a strong part of the manufacturing pro-
CAD/CAM system many beliefs, a thorough knowledge of man-
Contrary to
cess for many years. The cost of a is
ual programming methods is absolutely essential lor effi-
only a fraction of what it used to be only a few years ago.
cient management of CAD/CAM programming.
Even small shops now find that the benefits offered by mo-
dern technology are too significant to be ignored. Several
programming systems are available various computers and CAD/CAM AND CNC
can handle virtually any job. For a typical machine shop, a
Windows based programming software can be very benefi- The need for improved efficiency and accuracy in CNC
cial. A typical example of this kind of application is the programming has been the major reason for development
very popular and powerful Mastercam ™, from CNC Soft- of a variety of methods that use a computer to prepare part
ware, Inc., Tolland, CT. There are several others. programs. Computer assisted CNC programming has been
around for many years. First, in the form of language based
MANUAL PROGRAMMING programming, such as APT rM or Compact II™. Since the
late '1970’s, CAD/CAM has played a significant role by
adding the visual aspect to the programming process. The
Manual programming (without a computer) has been the
acronym CAD/CAM means Computer Aided Design and
most common method of preparing a part program for
Computer Aided Manufacturing. The first three letters
many years. The latest CNC controls make manual pro- area of engineering design and drafting.
(CAD) cover the
gramming much easier than ever before by using fixed or
The second three (CAM), cover the area of comput-
letters
repetitivemachining cycles, variable type programming,
erized manufacturing, where CNC programming is only a
graphic tool motion simulation, standard mathematical in-
small part. The whole subject ofCAD/CAM covers much
put and other time saving features. In manual program-
more than just design, drafting and programming. It is a
ming, all calculations are done by hand, with the aid of a
part of modern technology also known as C1M - Computer
pocket calculator - no computer programming is used. Pro-
Integrated Manufacturing.
grammed data can be transferred to the CNC machine via a
cable, using an inexpensive desktop or a laptop computer. In the area of numerical control, computers have played a
This process is faster and more reliable than other methods. major role for a long time. Machine controls have become
Short programs can also be entered manually, by keyboard more sophisticated, incorporating the latest techniques of
entry, directly at the machine. A punched tape used to be
data processing, storage, tool path graphics, machining cy-
media of the
the popular past but has virtually disappeared cles, etc. Programs can now be prepared with the use of
from machine shops.
PROGRAM PLANNING
33
inexpensive computers, using graphical interface. Cost is the price, may handle to an absolute satisfaction. If the con-
no longer an issue, even small machine shops can afford a trol system can handle it, manual programming is the way
programming system in house. These systems are also to the ultimate control over such a project, when any other
popular because of their llexibility. A typical computerized methods may not be suitable.
programming system does not have to be dedicated only to
programming - all related tasks, often done by the pro- Even with a well customized and organized computer-
grammer, can be implemented on the same computer. For ized programming system, how can the generated program
example, cutting tool inventory management, database of output be exactly as intended? How can the CNC operator
part programs, material information sheets, setup sheets change any part of the program on the machine, without
and tooling sheets, etc. The same computer could also be knowing its rules and structure?
used for uploading and downloading CNC programs.
Successful use of computerized programming requires
Integration understanding of manual programming methods.
CAD/CAM computer software is: proached in a logical and methodical way. The first deci-
sions relate to what tasks have to be done and what goals
NEVER DO ANYTHING TWICE !
have to be reached. The other decisions relate to how to
achieve the set goals in an efficient and safe manner. Such a
When progressive method not only isolates individual problems
a drawing is made in a CAD software (such as
as they develop,
AutoCAD), then done again in a CAM software (such as it also forces their solution before the next
Mastercam), there step can be taken.
a duplication. Duplication breeds er-
is
rors. Inorder to avoid duplication, most of the sys- CAD The following items form a fairly common and logical
tems incorporate a transfer method of the design to the se-
sequence of tasks done in CNC programming. The items
lected CAMsystem to be used for CNC programming. are only in a suggested order, offered for further evaluation.
Typical transfers are achieved through special DXF or
This order may be changed to reflect special conditions or
ICES files. The DXF stands for Data Exchange Files or
working habits. Some items may be missing or redundant:
Drawing Exchange Files, and the ICES abbreviation is a
short lorm of Initial Graphics Exchange Specification files. 1 . Study of initial information (drawing and methods)
Once the geometry is transferred from the CAD system to 2. Material stock (blank) evaluation
the CAM system, only the tool path related process is 3. Machine tool specifications
needed. Using a post processor (special kind of formatter), 4. Control system features
the computer software will prepare a part program, ready to 5. Sequence of machining operations
be loaded directly to the CNC machine. 6. Tooling selection and arrangement of cutting tools
7. Setup of the part
Future of Manual Programming 8. Technological data (speeds, feedrates, etc.)
9. Determination of the tool path
It may seem that the manual programming is on the de- 1 0. Working sketches and mathematical calculations
cline. In terms of actual use, this is probably true. However, 1 1 . Program writing and preparation for transfer to CNC
it is necessary to keep in perspective that any computerized 1 2. Program testing and debugging
technology is based on the already well established meth- 13. Program documentation
ods of manual programming. Manual programming for
CNC machines serves as the source of the There is only one goal in CNC program planning and that
new technology
is the completion of all instructions in the form of a pro-
- it is the very elementary concept on
which the computer-
izedprogramming is based. This knowledge base opens the gram that will result in an error-free, safe and efficient CNC
door for development of more powerful hardware and soft- machining. The suggested procedures may require some
ware applications. changes - for example, should the tooling be selected be-
fore or after the part setup is determined? Can the manual
The manual programming may be used somewhat less partprogramming methods be used efficiently? Are the
frequently today and eventually will be used even less - but working sketches necessary? Do not be afraid to modify
knowing it well - really understanding it - is and always any so called ideal procedure - either temporarily, for a
will be the key to control the power of CAM
software. Even given job, qj- permanently, to reflect a particular CNC
pro-
computers cannot do everything. There are some special gramming style. Remember, there are no ideal procedures.
programming projects that a CAM software, regardless of
Chapter 6
34
and sections. The programmer first evaluates all the draw- cate how current is the drawing version. Only the latest ver-
then isolates those that are relevant for the de- sion of the part design is important to manufacturing.
ing data first,
Title Block
Figure 6-2
cri
OU DU 60 - Q A drawing dimension specifies a hole as
075+O.OO/-O.O5 mm. What actual dimension
1 1
should appear in the program?
Drawings in English units often contain fractions. A frac- A particular programming approach can control the fre-
tional dimension was sometimes used to identify a less im- quency of such manual adjustments to a great degree. Con-
portant dimensional tolerances (such as ±.030 inches from sider the 075 mm
mentioned earlier. If it is an external dia-
the nominal size). The number of digits following the deci- meter, the tool edge wear will cause the actual dimension
mal point often indicated a tolerance (the more digits speci- during machining to become larger. In the case of an inter-
smaller the tolerance range). These methods are
fied, the nal diameter, the actual dimension will become smaller as
not an ISO standard and are of no use in programming. the cutting edge wears out. By programming X74.95 for
Fractional dimensions have to be changed into their deci- the external diameter (the bottom limit) or X75.0 for the in-
mal equivalents. The number of decimal places in the pro- ternal diameter (the top limit), the wear of the cutting edge
gram determined by the minimum increment of the con-
is will move into the tolerance range, rather than away from
trol. A
dimension of 3-3/4 is programmed as 3.75, and a it. The manual tool offset adjustment by the machine
oper-
dimension of 5-1 1/64 inches is programmed as 5.1719, its ator may still be required, but less frequently. Another ap-
closest rounding. Many companies have upgraded their proach is to select the middle size of the tolerance range -
design standards to the ISO system and adhere to the prin- this method will also have a positive effect but more man-
ciples of CNC
dimensioning. In this respect, drawings us- ual adjustments may be necessary during machining.
ing the metric units are much more practical.
Surface Finish
Some dimensioning problems are related to an improper
use of a CAD software, such as AutoCAD. Some designers Precision parts require a certain degree of surface finish
do not change the default setting of the number of decimal quality. Technical drawing indicates the required finish for
places and every dimension ends up with four decimal various features of the part. English drawings indicate the
places (inches) or three decimal places (metric). This is a finish in micro inches, where I micro inch =. 000001".
poor practice and should be avoided. The best approach is Metric drawings use specifications expressed in microns,
to specify dimensional tolerances for all dimensions that where / micron = 0.001 mm. Symbol for a micron is a
require them, and even use Geometric Dimensioning and Greek letter p. Some drawings use symbols - Figure 6-4.
Tolerancing standards (GDT).
Tolerances
The most important factors influencing the quality of sur- METHODS SHEET
face finish are spindle speed, feedrate, cutting tool radius
and the amount of material removed. Generally, a larger manufacturing
Some companies have a staff of qualified
cutter radius and slower feedrates contribute towards finer
technologists or process planners responsible for determi-
surface finishes. The cycle time will be longer but can often
nation of the manufacturing process. These people develop
be offset by elimination of any subsequent operations such
a series of machining instructions, detailing the route of
as grinding, honing or lapping.
each part through the manufacturing steps. They allocate
the work to individual machines, develop machining se-
Drawing Revisions
quences and setup methods, select tooling, etc. Their in-
Another important section of the drawing, often over- structions arc written in a methods sheet ( routing sheet ) that
accompanies the part through all stages of manufacturing,
looked by CNC programmers, shows the engineering
typically in a plastic folder. If such a sheet is available, its
changes (known as revisions ) made on the drawing up to a
certain date. Using reference numbers or letters, the de- copy should become a part of the documentation. One of
- the purposes of a methods sheet is to provide the CNC pro-
signer identifies such changes, usually with both values
the previous and the new value - for example: grammer with as much information as possible to shorten
the turnover between programs. The greatest advantage of
REV. DIMENSION 5.75 WAS 5.65 a methods sheet in programming comprehensive cov-
is its
3 /
erage of all required operations, both CNC and conven-
Only the latest changes are important to the program de- tional, thus offering a complete overview of the manufac-
velopment. Make sure the program not only reflects the turing process. A good quality methods sheet will save a lot
current engineering design, but also is identified in some of decisions - it is made by a manufacturing engineer, who
unique way to distinguish it from any previous program specializes in work detailing. The ideal methods sheet is
versions. Many programmers keep a copy of the part draw- one where the recommended manufacturing process
ing corresponding to the program in the files, thus prevent- closely matches established part programming methods.
ing a possible misunderstanding later.
For whatever reason, a large number of CNC machine
shops does not use methods sheets, routing sheets or simi-
Special Instructions
lar documentation. The CNC programmer acts as a process
Many drawings also include special instructions and planner as well. Such an environment offers a certain de-
comments that cannot be expressed with the traditional gree of flexibility but demands a large degree of knowl-
drafting symbols and are therefore spelled out independ- edge, skills and responsibility at the same time.
ently, in words. Such instructions are very important for
CNC program planning, as they may significantly influ- MATERIAL SPECIFICATIONS
ence the programming procedure. For example, an element
of the part is identified as a ground surface or diameter. The
drawing dimension always shows the finished size. In the Also important consideration in program planning is eva-
luation of the material stock. Typical material is raw and
program, this dimension must be adjusted for any grinding
unmachined (a bar, billet, plate, forging, casting, etc).
allowance necessary - an allowance selected by the pro-
Some material be already premachined, routed from
may
grammer and written as a special instruction in the pro-
another machine or operation. It may be solid or hollow,
gram. Another example of a special instruction required in
with a small or a large amount to be removed by CNC ma-
the program relates to the machining performed during part
chining. The size and shape of the material determines the
assembly. For example, a certain hole on the drawing
setup mounting method. The type of material (steel, cast
should be drilled and tapped and is dimensioned the same
iron, brass, etc.) will influence not only the selection of cut-
way as any other hole, but a special instruction indicates the
ting tools, but the cutting conditions for machining as well.
drilling and tapping must be done when the part is handled
during assembly. Operations relating to such a hole are not
A program cannot be planned without knowing
programmed and if any overlook of a small instruction
the type, size, shape and condition of the material.
such as this, may result in unusable part.
({>12 - REAM 2 HOLES specifications within a particular batch or from one batch to
another. For example, a material ordered from two suppli-
This is a requirement to ream 2 holes with a reamer that ers to be used for the same part may have slightly different
has 1 2 mm diameter.
PROGRAM PLANNING 37
sizes, hardness and even shape. A similar example is a ma- MACHINING SEQUENCE
terial cut into single pieces on a saw, where the length of
each piece varies beyond an acceptable range. This incon-
sistency between blank parts makes programming more
Machining sequence defines the order of machining op-
and time consuming. and machine shop experience does
erations. Technical skill
difficult It also creates potentially un-
help in program planning, but some common sense ap-
safe machining conditions. If such problems are encoun-
proach is equally important. The sequence of machining
tered, the best planning approach is to place emphasis on
must have a logical order - for example, drilling must be
machining safety than on machining time. At worst, there
will be some air cutting or slower than needed cutting feed,
programmed before tapping, roughing operations before
finishing, first operation before second, etc. Within this
but no cuts will be too heavy for the tool to handle.
logical order, further specificationof the order of individual
Another approach is to separate non-uniform material tool motions is required for a particular tool. For example,
into groups and make separate programs for each group, in turning, a face cut may be programmed on the part first,
properly identified. The best method is to cover all known then roughing all material on diameters will take place. An-
and predictable inconsistencies under program control, for other method is to program a roughing pass for the first dia-
example, using the block skip function. meter, then face and continue with the remainder of the dia-
meter roughing afterwards. In drilling, a center drill before
Machinability Rating drilling may be useful for some applications, but in another
program a spot drill may be a better choice. There are no
Another important aspect of material specification is its
fixed rules on which method is better - each CNC program-
machinability. Charts with suggested speeds and feeds for ming assignment has to be considered individually, based
most common materials are available from major tooling on the criteria of safety and efficiency.
companies. These charts arc helpful in programming, par-
ticularly when an unknown material is used. The suggested The basic approach for determining the machining se-
values are a good and can be optimized
starling point, later, quence is the evaluation of all related operations. In gen-
when the material properties are better known. eral, program should be planned in such a way that the cut-
ting tool, once selected, will do as much work as possible,
Machinability rating in the English units is given in units before a tool change. On most CNC machines, less time is
called feet per minute (ft/min). Often the terms surface feet needed for positioning the tool than for a tool change. An-
per minute, constant surface speed (CSS or CS), periph- other consideration is in benefits gained by programming
eral speed or just surface speed are used instead. For metric all heavy operations first, then the lighter semifinishing or
designation of the machinability rating, the meters per min- finishing operations. It may mean an extra tool change or
ute (m/min) are used. In both cases, the spindle speed two, but this method minimizes any shift of the material in
(r/min) for a given tool diameter (for a mill) or a given part the holding fixture while machining. Another important
diameter (for a lathe) is calculated, using common formu-
factor the current position of a tool when a certain opera-
is
las.For the English system, the spindle speed can be calcu- tion completed. For example, when drilling a pattern of
is
lated in revolutions per minute (r/min): holes in the order of 1 -2-3-4, the next tool (such as a boring
bar, reamer or a tap) should be programmed in the order of
4-3-2- to minimize unnecessary tool motions - Figure 6-5.
1
TOOLING SELECTION Some machine types are designed to make the setup time
more productive. Multispindle machining centers or lathes
can handle two or more parts at the same time. Special fea-
Selecting tool holders and cutting tools is another impor-
tures, such as barfeeder for a lathe, an automatic pallet
tant step in planning a CNC program. The category of tool- changer or dual setup on the table, also help. Other solu-
ing covers a lot more than the cutting tools and tool holders
tions can be added as well.
- it includes an extensive line of accessories, including nu-
merous vises, fixtures, chucks, indexing tables, clamps,
Setup Sheet
collets and many other holding devices. Cutting tools re-
quire special attention, due to the large variety available At this stage of program planning, once the setup is de-
and their direct effect in machining. cided, making a setup sheet is a good idea. A setup sheet
can be a simple sketch, designed mostly for the use at the
The cutting tool itself is usually the most important selec-
machine, that shows the part orientation when mounted in a
tion. It should be selected by two main criteria:
holding device, tool offset numbers used by the program,
Efficiency of usage datum points and, of course, all the necessary identifica-
tions and descriptions. Other information in the setup sheet
Safety in operation
should relate to some unique requirements established
during planning stages of the program (such as the position
Many supervisors responsible for CNC programming try
of clamps, bored jaws dimensions, limits of tool extension,
to make work at all times. Often they
the existing tooling
etc.). Setup sheet and tooling sheet can be combined into a
ignore the fact that a suitable new tool may do the job faster
single source of information. Most programmers use their
and more economically. A thorough knowledge of tooling
a separate technical profession the
own various versions.
and its applications is -
All tool offset numbers and other program entries should Cutter Path
be documented in a form known as the tooling sheet. Such
a document serves as a guide to the operator during job
The core of any CNC programming is the determination
of the cutler path - the tool path. This process involves indi-
setup. It should include basic documentation re-
at least the
vidual cutter movements in its relationship to the part.
lating to the selected tool.For example, the documentation
may include the tool description, its length and diameter,
In CNC programming, always look at the cutting
the number of flutes, the tool and offset numbers, speed and
tool as being moved around the work !!
feed selected for that tool and other relevant information.
This principle applies to all CNC machine tools.
%
PART SETUP The key factor for understanding this principle is to visu-
alize the tool motion, not the machine motion. The most
Another decision program planning relates to the part
in noticeable difference between programming a machining
setup - how the raw or premachined material,
to mount center as compared to a lathe is the cutter rotation com-
what supporting tools and devices should be used, how pared to the part rotation. In both cases, the programmer al-
many operations are required to complete as many machin- ways must think in terms of the cutter moving around the
ing sequences as possible, where to select a program zero, part Figure 6 6.
etc. Setup is necessary and it should be done efficiently.
PROGRAM PLANNING 39
Positioning is used for a point location operations, such The topic of power and forces in machining can be com-
as drilling, reaming, tapping and similar operations; con- plex and is not always needed in everyday programming.
tinuous path generates a profile (contour). In either case, Work experience is often a better teacher than formulas.
the programmed data refer to the position of the cutter
when a certain motion is completed. This position is called Coolants and Lubricants
the tool target position - Figure 6-7.
When the tool contacts the material for an extended pe-
riod of time, a great amount of heat is generated. The cut-
tingedge gets overheated, becomes dull and may break. To
prevent these possibilities, a suitable coolant must be used.
The start and end positions of the profile are identified The CNC operator is responsible for a suitable coolant in
and so are the positions fqr each contour change. Each tar- The coolant should be clean and mixed in
the machine.
get position is called the contour change point, which has recommended proportions. Water soluble oils should be
to be calculated. The order of target locations in the pro- biodegradable to preserve the environment and properly
gram is very important. That means the tool position I is disposed of. The CNC programmer decides when to pro-
the target position commencing at the Start point, position
gram the coolant and when not. Ceramic cutting tools are
2 is the target position beginning at point position 3 is the
1
, normally programmed dry, without a coolant. Some cast
target from point 2 and so on, until the End position is
irons do not require flood coolant, but air blast or oil mist
reached. If the contour is for milling, the targets will be in X may be allowed. These coolant functions vary between ma-
and Y axes. In turning, they will be in X and Z axes. chines, so check the machine reference manual for details.
40 Chapter 6
Flood coolant may be used to cool down the part and gain Identification Methods
better tolerances. can also be used to Hush away chips
It
coolant smells. With proper management, all problems re- point in the drawing, use point reference numbers and cre-
lated to coolants can be controlled. ate a separate coordinate sheet form using the reference
numbers, as illustrated in Figure 6-8.
A coolant related programming issue is when to turn the
coolant on in the program. As the coolant function M08 Position X axis Y axis Z axis
only turns on the pump motor, make sure the coolant actu-
ally reaches the tool edge before contact with work. Pro-
gramming the coolant on early is better than late.
calculations, etc. - are required for programming complex only the applicable columns. The aim is to develop a con-
molds, dies and similar shapes. In such cases, a CAD/CAM sistent programming style from one program to another.
should be smaller or larger than the others, the relationship QUALITY IN CNC PROGRAMMING
of individual elements, the shape of an extremely small de-
tail, etc. However, there is one purpose you should never
An important consideration in program planning is a per-
use the sketch for: sonal approach and attitudes. Our attitudes have a signifi-
cant influence on the program development. Ask yourself
Never use a scaled sketch to guess unknown dimensions !
some questions.Are you attentive to detail, well organized,
concerned? Can a program be improved, is it safe, is it effi-
Scaling a sketch is a poor and unprofessional practice, cient? CNC program quality is more than writing an error
that creates more problems than it solves. It is a sign of lazi- free program. Part complexity is only related to your
ness or incompetence. knowledge level and willingness to solve problems. It
should be a personal goal to make a program that is the best
program possible. Set your standards high!
7 PART PROGRAM STRUCTURE
gram can be defined as an arrangement of the machining other for real numbers (numbers with a decimal point).
and related instructions, written in the format of the CNC Numbers can have positive or negative values. On some
system and aimed at a particular machine tool. numbers can be used with or without the deci-
controls, real
mal point. Numbers applied in either mode can only be en-
Various controls have a different format, but most are tered within the range that is allowed by the control system.
similar.Subtle differences exist among CNC machines
from different manufacturers, even those equipped with the Letters
Letter
program entered into the control system consists of individ-
ual lines of instructions, sequenced in a logical order. Each
Symbol called a sequence block or simply a block
line - - iscom-
posed of one or several words and each word is composed
Characters are combined into meaningful words. This
of two or more characters.
combination of digits, letters and symbols is called the
alpha-numerical program input.
41
42 Chapter 7
Program Figure 7-
Since the early days of numerical control, three formats Any one word is a series of characters (at least two) that
had become significant in their time. They are listed in the define a single instruction to the control unit and the ma-
order of their original introduction: chine.The above examples of typical words have the fol-
lowing meaning in a CNC program:
Tab Sequential Format NC only - no decimal point
the much more convenient Word Address Format. HO 1 Tool length offset number
mented by a symbol, 'such as a minus sign or a decimal /MO 1 Miscellaneousfimetion w/block skip symbol
point. Each letter, digit or symbol represents one character B180 0 . Indexing table junction
in the program and in the control memory. This unique al-
pha-numerical arrangement creates a word, where the letter Individual words are instructions grouped together to
is the address, followed by numerical data with or without form sequences of programming code. Each sequence that
symbols. The word address refers to a specific register of will process a series of instructions simultaneously, forms a
the control memory. Some typical words are: unit called a sequence block or simply a block. The series of
blocks arranged in a logical order that is required to ma-
G01 M30 D25 X5.75 N105 HOI YO S2500 chine a complete part or a complete operation is the part
Z-5.14 F12.0 T0505 T05 /M01 B180.0 program also known as a CNC program.
PART PROGRAM STRUCTURE
43
The next block shows a rapid tool motion to the absolute Address X accepts positive or negative data with the maximum
position of X 1 3.0Y4.6, with a coolant turned on: of five digits in front of a decimal point and three digits
maximum behind the decimal point - decimal point is allowed.
N25 G90 GOO X13 . 0 Y4.6 M08
The absence of a decimal point in the notation means the
decimal point is not used; the absence of a plus (+) sign in
csr where . .
G90 Absolute mode These samples of format notation explain the shorthand:
GOO Rapid motion mode
G2 Two digits maximum, no decimal point or sign
X13.0Y4.6 Coordinate location
M08 Coolant ON function N5 Five digits maximum, no decimal point or sign
number of digits allowed in a word, depending on the ad- of the short forms may vary significantly. The list of ad-
dress and maximum number of decimal places, is set by the dresses, their format notation and description is listed in the
control manufacturer. Not all letters can be used. Only let- following tables. They contain address notations based on a
ters with an assigned meaning can be programmed, except typical Fanuc control system.
in a comment. Symbols can be used in only some words,
and their position in the word is fixed. Some symbols are Milling System Format
used only in custom macros. Control limitations are impor-
tant. Symbols supplement the digits and letters and provide
The address description varies for many addresses, de-
pending on the input units. The table below lists English
them with an additional meaning. Typical programming
format descriptions (metric format is in parenthesis, if ap-
symbols are the minus sign, decimal point, percent sign and
plicable). Listed are format notations for milling units. The
a few others. All symbols are listed in a table below.
first column is the address, the second column is the format
Control manufacturers often specify the input format in Address Notation Description
an abbreviated form - Figure 7-2.
Rotary or Indexing axis - unit is
A A+5.3
degrees - used about the X axis
X ± 5 . 3
Rotary or Indexing axis - unit is
• • • • •
B B+5.3
degrees - used about the Y axis
Number of digits
after decimal point Cutter radius offset number
D2
(sometimes uses address H)
— Decimal point allowed
F5.3 Feedrate function - may vary
Number of digits
— before decimal point G G2 Preparatory commands
Positive or negative Offset number (tool position and/or
• - value possible H H3
tool length offset)
L L4
Fixed cycle repetition count
Subprogram repetition count
E
EaE2.6
Relief amount in G74 and G75
Depth of first thread in G76
m
T T4 Tool function P4 Custom macro number call
P Offset number with G10
X axis coordinate value
P53 Dwell time in milliseconds
designation
X
Q Q5 End block number in G71 and G72
X5.3 Dwell function with G04
Arc radius designation
Y
Y axis coordinate value
designation
R
inn Arc radius for corners
m
Z t—
(Z+5.3) designation T4 Tool function
Similar chart as for milling, this one is for lathe systems. U5.3 Dwell function with G04
A number of definitions are the same and are included only Incremental value in Z axis
for convenience.
ric notation is in
Notation is in
parenthesis, if
the English format, the met-
applicable to the address.
w wmm Stock allowance in Z axis
Multiple Word Addresses The table lists both standard and special symbols. Special
symbols are used only with optional features, such as the
One feature that is noticeable in both tables is the abun-
dance of different meanings for some addresses. This is a
custom macro option. These symbols cannot be used in
standard programming, as they would cause an error. Typi-
necessary feature of a word address format. After all. there
cal standard symbols are found on the computer keyboard.
are only 26 letters in the English alphabet, but more than
Ctrl, Shift and Alt character combinations are not allowed.
that number of commands and functions. As new control
features are added, even more variations may be necessary.
Plus and Minus Sign
Some of the addresses have such an established meaning
(for example, X, Y and Z are coordinate words), that giving
One of the most common symbols in CNC programming
them an additional meaning would be confusing. Many let-
isan algebraic sign - plus or minus. Any data in a motion
ters, on the other hand, are not used very often and a multi- command can be either positive or negative. For conven-
ple meaning for them is quite acceptable (addresses I, J. K.
ience, virtually all control systems allow for an omission of
P, for example). In addition, the meaning of addresses var-
a plus sign for all positive values. This feature is sometimes
ies between the milling and turning systems.
called positive bias of the control system. Positive bias is a
term indicating an assumed positive, value, if no sign is pro-
The control system has to have some means of accepting
grammed in a word:
a particular word with a precisely defined meaning in the
program. In most cases, the preparatory command G will
define the meaning, at other limes it will be the M function X+125.0 is the same as X125.0
or a setting of system parameters.
The minus sign must always be programmed. If the mi-
nus sign is missing, the number becomes positive, with an
SYMBOLS IN PROGRAMMING incorrect results value (in this case the tool position):
In addition to the basic symbols, Fanuc can accept other X- 12 5 . 0 Negath’e value
symbols for different applications. The following table de-
X12 5 0 . Posith’e value
scribes all symbols available on the Fanuc controls:
X+125.0 Posith’e value ( + sign is ignored)
Symbol Description Comment Symbols supplement the letters and digits and are an inte-
gral part of the program structure.
Decimal point Fractional part of a number
Slash Block skip function symbol or tures are identified. The next example is an exaggerated
/
(front slash) division sign in Fanucmacros sample of items that may be used in the program header:
% Percent sign Stop code (end of program file) (LAST VERSION DATE 07-DEC-01)
(LAST VERSION TIME 19:43)
Colon Program number designation (PROGRAMMER . . . PETER SMID)
(MACHINE OKK - VMC)
i
Comma Used only within comments (CONTROL FANUC 15M)
(UNITS INCHES)
wm Brackets
*
Arguments in Fanuc macros
Within the program, each tool may be identified as well: of the X and Y axes. If the absolute position is unknown,
change the block to the incremental version:
(*** TO 3 - 1/4-20 PLUG TAP ***)
N88 G91 G28 X0 Y0
Other comments and messages to the operator can be
added to the program as required. If a toolhas to be repeated, make sure not to include the
tool change block for the current tool. Many CNC systems
will generate an alarm if the tool change command cannot
TYPICAL PROGRAM STRUCTURE find the tool in the magazine. In the following program ex-
ample, the tool repeat blocks will be N5, N38 and N67.
Although it may be a bit early to show a complete pro-
gram, it will do no harm to look at a typical program struc- The program structure example is for a machine with
ture. Developing a solid program structure is
absolutely es- random tool selection mode and a typical control system,
sential - it is going to be used all the time. Each block of the with some minor changes to be expected. Study the How ot
comment. the program, rather than exact contents. Note the repeti-
its
program is identified with a
tiveness of blocks for each tool and also note the addition of
Note - Program blocks use only sample block numbers. a blank line (empty block) between individual tools for eas-
Blocks in parentheses are not required for fixed cycles. The ier orientation in the program.
XY value in the block N88 should be the current position
N62 GOO G80 Z2.0 M09 (CLEAR ABOVE PART - COOLANT OFF)
N63 G28 Z2.0 M05 (HOME IN Z ONLY - SPINDLE OFF)
N64 M01 (OPTIONAL STOP)
( —BLANK LINE —
N65 TO (TOOL T03 INTO WAITING POSITION - CHECK ONLY)
N66 M0 (T03 INTO SPINDLE)
N67 G90 G54 GOO X.. Y. . S. . M03 T01 (TO 3 RESTART BLOCK - T01 INTO WAITING POSITION)
N68 G43 Z2.0 H03 M08 (TOOL LG OFFSET - CLEAR ABOVE WORK - COOLANT ON)
(N69 G01 Z-. F. .) .
(FEED TO Z DEPTH IF NOT A CYCLE)
( CUTTING MOTIONS WITH TOOL TO 3 )
N2 G90
DESCRIPTION AND PURPOSE N3 GOO
N4 ...
N5 ...
A one block example will illustrate the purpose of the N6 ...
preparatory commands in the following program entry: N7 X13.0 Y10.0
N7 X13.0 Y10.0 All fourexamples have the same machining result, pro-
is no change of any G code mode between
viding that there
Even a casual look at this block shows that the coordi- blocks N4 and N6 in the examples B, C and D.
nates X13.0Y10.0 relate to the end position of the cutting
tool, when the block N7 is executed (i.e., processed by the
One G code in a modal group replaces
control). The block does not indicate whether the coordi- another G code from the same group
nates are in the absolute or the incremental mode. It does
For example, in order to make the block N7 a tool desti- of G codes must be kept separate.
nation in a rapid mode using absolute dimensions, all these
instructions - or commands - must be specified before the Check machine documentation for available G codes !
N7 G90 GOO X13.0 Y10.0 The G code table on the next page is a considerably de-
tailed list of the most common preparatory commands used
O Example B :
*
for programming CNC milling machines and CNC ma-
chining centers. The listed G codes may not be applicable
N3 G90 to a particular machine and control system, so consult the
N4 ... machine and control reference manual to make sure. Some
N5 ...
G codes listed are a special option that must be available on
N6 ...
the machine and in the control system.
N7 GOO X13.0 Y10.0
47
48 Chapter 8
G09 Exact stop check - one block only G57 Work coordinate offset 4
GIO Programmable data input (Data Setting) G58 Work coordinate offset 5
G22 Stored stroke check ON G67 Custom macro modal call cancel
G25 Spindle speed fluctuation detection ON G69 Coordinate system rotation cancel
G26 Spindle speed fluctuation detection OFF G73 High speed peck drilling cycle (deep hole)
G27 Machine zero position check G74 Left hand threading cycle
G28 Machine zero return (reference point 1) G76 Fine boring cycle
G40 Cutter radius compensation cancel G83 Peck-drilling cycle (deep hole drilling cycle)
G41 Cutter radius compensation - left G84 Right hand threading cycle
S
G42 Cutter radius compensation - right G85 Boring cycle
G52
Tool position register /
Fanuc lathe controls use three G code group types - A, B G54 Work coordinate offset 1
the table below. Only one type can be set at a time. Types A G56 Work coordinate offset 3
and B can be set by a control system parameter, but type C
G57 Work coordinate offset 4
is optional. Generally, most G codes are identical, only a
few are different in the A and B types. More details on the G58 Work coordinate offset 5
subject of G code groups is listed at the end of this chapter.
G59 Work coordinate offset 6
G code Description
G61 Exact stop mode
Tool nose radius offset cancel G96 Constant surface speed mode (CSS)
G40
Tool nose radius offset G97 Direct r/min input ( CSS mode cancel)
G41 left
G42 Tool nose radius compensation right G98 Feedrate per minute ( Group type A
G99 Feedrate per revolution (Group type A)
50 Chapter 8
Most of the preparatory commands are discussed under Note motion command GOO - how many times
the rapid
the individual applications, for example G01 under Linear does it appear program? Just once - in the block N30.
in the
Unlike the miscellaneous functions, known as the M in a certainmode until canceled by another mode.
functions and described in the next chapter, several prepa-
ratory commands may be used in a single block, providing
As most G codes are modal, there is no need to repeat a
they are not in a logical conflict with each other:
modal command in every block. Using the earlier example
C once more, the control will make the following interpre-
N25 G90 GOO G54 X6.75 Y10 .
Earlier, the following example C was used to demonstrate two or more modes of operation. If the rapid motion com-
the general placement of G codes into a program block: mand GOO is selected, it is a specific command relating to a
tool motion. As it is impossible to have a rapid motion and
Such
impossible to
a combina-
N3 G90 GOO tion creates a conflict in a block. If conflicting G codes are
N4 ... used in the same block, the latter G code will be used.
N5 ...
N6 ... N74 G01 GOO X3.5 Y6.125 F20.0
N7 X13.0 Y10.0
%
In the example, the two commands G01 and GOO are in
If the structure is changed slightly and filled with realistic conflict. As GOO is the latter one in the block, it will be-
data, these five blocks may be the result:
come effective. The feedrate is ignored in this block.
O Example C • modified (as programmed) N74 GOO G01 X3.5 Y6.125 F20.0
plication of this feature can be illustrated in this example: sometimes using the descriptions unmodal or non-modat.
They are only active in the block in which they were pro-
(G20) grammed. If unmodal G codes are to be effective in several
N45 G90 GOO G54 XI. 0 Y1.0 S1500 M03 (G90) consecutive blocks, they must be programmed in each of
N46 G43 Z0.1 H02 those blocks. In majority of unmodal commands, this repe-
N47 G01 Z-0.25 F5.0 tition will not be used very often.
N48 X2.5 G91 Y1.5 (G90 MIXED WITH G91)
N49 . .
For example, a dwell is a programmed pause measured in
all subsequent blocks, until the G90 is programmed. Most All three blocks contain the same function, a dwell, one
likely, the block N48 will be written in absolute mode: alter another. The program can be made much more effi-
cient by simply entering the total dwell value into a single
• • « block:
N48 X2.5 Y2.5
N56 G04 P6000
Normally, there is no reason to switch between the two The following groups are typical for the Fanuc control
modes. It can result in some very unpleasant surprises. systems. Applications for milling and turning controls are
There are some occasions when this special technique specially distinguished by the and M T letters respectively,
brings benefits, for example, in subprograms. in the Type column of the table:
52 Chapter 8
Group Description G codes Type Group 01 is not affected by G codes from Group 09. In a
summary ...
G61 G62 G64 M/T stalled, before any programs have been written for it.
13 Cutting Modes
G63 M Change of the G code type at random is a guaranteed way
to create an organizational nightmare. Keep in mind that a
14 Macro Mode G66 G67 M/T
change of one code meaning will affect the meaning of an-
Coordinate other code. Using the units example for a lathe, if G70
16 G68 G69 M
Rotation means an English input of dimensions, you cannot use it to
G96 G97 T program a roughing cycle. Fanuc provides a different code.
17 CSS
Always stay with the standard G code type. All G codes in
18 Polar Input G15 G16 M this handbook use the default group of the Type A, and also
»
The address Min a CNC program identifies a miscella- All machine tools designed for metal removal by cutting
neous function, sometimes called a machine function. Not have certain common features and capabilities. For exam-
all miscellaneous functions are related to the operation of a ple, spindle rotation can have three - and only three - possi-
CNC machine - quite a few are related to the processing of ble selections in a program:
the program itself. The more suitable term miscellaneous
Spindle normal rotation
functions is used throughout this handbook.
Spindle reverse rotation
ON OFF
terruption of a program execution requires an M
function,
Coolant operation or
for instance, during the change of a job setup, such as a part
a Tailstock or quill motion IN or OUT reversal. Another example is a situation, where one pro-
gram calls one or more subprograms. In such a case, each
These operations vary between machines, due to the dif- program has to have a program call function, the number of
ferent designs by various machine manufacturers. A ma- repetitions, etc. M functions handle these requirements.
chine design, from the engineering point of view, is based
on a certain primary machining application. A CNC mill- Based on the previous examples, the use of miscellane-
ing machine will require different functions related to the ous functionsfalls into two main groups, based on a partic-
Even two machines designed for the same type of work, This handbook covers only the most common miscella-
forexample, two kinds of a vertical machining center, will neous functions, used by the majority of controls. Unfortu-
have functions different from each other, if they have a dif- nately, there are many functions that vaiy between ma-
ferent CNC system or significantly different options. Dif- chines and the control system. These functions are called
ferent machine models from the same manufacturer will machine specific functions. For this reason, always consult
also have certain unique functions, even with the same the documentation for the particular machine model and its
model of the CNC system. control system.
53
54 Chapter 9
M code Description
M13 Tailstock quill OUT
MOO Compulsory program stop Turret indexing forward
M17
Optional program stop
M18 Turret indexing reverse
M02 End of program (usually with reset, no rewind) be divided into several groups, based on the specific appli-
cation of the miscellaneous functions within each group. A
M03 Spindle rotation normal contained the following table:
typical distribution list is in
MISCELLANEOUS FUNCTIONS
55
Coolant M07 MO 8 MO example, block N56, the precise time the M08
In this
function will be activatedis not very important. In other
M10 Mil
Ml 2 M13
cases, the timing may be very important. Some func- M
tions must be in effect before or after certain action takes
Accessories M17 Ml
place. For example, look at this combination - a Z axis mo-
M21 M2
tion is applied together with the program stop function
M78 M7 9
MOO in the same block:
Threading M23 M2
N319 G01 Z-12.8456 F20.0 MOO
Gear ranges M41 M42 M43 M44
This is a far more serious situation and two answers are
Feedrate override M48 M49
needed. One is what exactly will happen, the other is when
Subprograms M98 M99 exactly it will happen, when the MOO function is activated.
There are three possibilities and three questions to ask:
Pallets M60
1 . Will the program stop take place immediately, when
The table does not cover all M functions or even all possi-
the motion is activated - at the start of the block?
ble groups. Neither does it distinguish between machines. 2. Will the program stop take place while the tool
On does indicate the types of applications
the other hand, it is on the way - during a motion?
the miscellaneous functions are used for in everyday CNC
programming. 3. Will the program stop take place when the motion
command is completed - at the end of the block?
chine control system arc cither not used or not needed. system interprets blocks containing a tool motion and a
However, the concepts for their applications are always miscellaneous function.
similar for most control systems and CNC machines.
Each M function is designed logically - it is also designed
In this chapter, only the more general functions are cov- to make a common sense.
ered in significant detail. Remaining miscellaneous func- The actual startup of a M function divided into two
is
tions are described in the sections covering individual ap- groups - not three:
plications. At this stage, the stress is on the usage and
behavior of the most common miscellaneous functions. M function activates at the start of a block
(simultaneously with the tool motion)
If a miscellaneous function is programmed in a block by No M function will be activated during the block execu-
itself, with no other data supplementing it, only the func- tion, there is no logic to it. What is the logical startup of the
tion itself will be executed. For example, coolant ON function M08 in the block N56 above? The
correct answer is that the coolant will be activated at the
N45 M01 same time as the tool motion begins. The correct answer for
the example block N319 is that the MOO program stop
is an optional stop. This block is correct - an functionM function will be activated after the tool motion has been
can be the only block entry. Unlike the preparatory com-
completed. Makes sense? Yes, but what about the other
mands (G codes), only one M
function is allowed in a block
functions, how do they behave in a block? Let’s look at
- unless the control allows multiple M
functions in the same
them next.
block, a program error will occur (latest controls only).
Chapter 9
56
Startup of M Functions
M functions completed in ONE BLOCK
Take a look at the list of typical M
functions. Add a tool
MOO Compulsory program stop
motion to each and try to determine the way the function is
Optional program stop
going to behave, based on the previous notes. A bit of logi- M01
cal thinking provides a good chance to arrive at the right M02 End of program (usually with reset, no rewind)
conclusion. Compare,the two following groups to confirm:
M06 Automatic tool change (ATC)
M30 Program end (always with reset and rewind) PROGRAM FUNCTIONS
M60 Automatic pallet change (APC)
Miscellaneous functions that control program processing
can be used either to interrupt the processing temporarily
If an uncertainty about how the function will in-
there is (in the middle of a program) or permanently (at the end of a
teract with the tool motion, the safest choice is to program program). Several functions are available for this purpose.
the M
function as a separate block. That way the function
willalways be processed before or after the relevant pro- Program Stop
gram block. In the majority of applications this will be a
The MOO function defined as an unconditional or com-
is
safe solution.
pulsory program stop. Any time the control system en-
Duration of M Functions counters this function during program processing, all auto-
matic operations of the machine tool will stop:
Knowledge of when the M function takes effect is logi-
axes
Motion of all
cally followed by the question about how long the function
will be active. Some miscellaneous functions are active Rotation of the spindle
in the block they appear. Others will continue to be
in
only
function. Coolant function
effect until canceled by another miscellaneous
This is similar to the modality of the preparatory G com- Further program execution
block or in a block containing other commands, usually necessary information. The comment section must be
axis motion. If the MOO function is programmed together enclosed in parentheses (three versions shown):
O MOO programmed after a motion command [B] N39 X13.5682 MOO (REMOVE CHIPS)
Q MOO programmed with a motion command Any one of the three methods will give the CNC operator
the necessary information. From the two options, the sec-
N39 GOO X13.5682 MOO ond one IB], the comment section in the program, is prefer-
able. The built-in instructions can be read directly from the
In both cases, the motion command will be completed display screen of the control panel.
first, program stop is executed. The difference
before the
between the two examples is apparent only in a single Optional Program Stop
block processing mode (for example, during a trial cut).
The program stop function MOO is used only In case there is no M01 function programmed, the setting
for a manual intervention during program processing
of the Optional Stop switch is irrelevant. Normally, it
should be in the OFF position for production work.
The control also offers an optional program stop M01,
described next. of using MOO is the need of a
The main rule When active, the M01 function behaves the same way as
manual intervention for every part machined. Manual tool the MOO function. The motion of all axes, spindle rotation,
change in a program qualifies for MOO, because every part coolant function and any further program execution will be
needs it. A dimensional check may not qualify, if is infre- temporarily interrupted. Feedrate, coordinate settings,
quent. M01 will be a better choice. Although the difference spindle speed setting, etc., arc retained. The further pro-
between the two functions is slight, the actual difference in cessing of the program can only be reactivated by the Cycle
cycle time can be significant for large number of parts. Start key. All programming rules for the MOO function also
apply to the MO I function.
When using the MOO function, always inform the opera-
tor why the function has been used and what its purpose is. A good idea is to program the M01 function at the end of
Make the intent known
to avoid a confusion. This intent each tool, followed by a blank line with no data. If the pro-
can be made available to the operator in two ways: gram processing can continue without stopping, the Op-
tional Stop switch will be set to OFF and no production
In the setup sheet, refer to the block number that contains time is lost. If there is a need to stop the program tempo-
the miscellaneous function MOO and describe the manual
rarily at the end of a tool, the switch will be set to ON and
operation that has to be performed:
the processing stops at the end of the tool. The time loss is
Every program must include a special function defining The percent sign (%) after M30 is a special stop code.
the end of current program. For this purpose, there are two This symbol terminates the loading of a program from an
M functions available - the M02 and M30. Both are similar, external device. It is also called the end-of-ftle marker.
but each has a distinct purpose. The M02 function will ter-
minate the program, but will cause no return to the first Subprogram End
block at the program top. The function M30 will terminate
the program as well but it will cause a return to the program The last M function for a program end is M99. Its pri-
top. The word return
‘
is often replaced by the 're- word mary usage is in the subprograms. Typically, the M99 func-
wind'. a leftover from the times when a reel-to-reel
It is tion will terminate a subprogram and return to the process-
tape reader was common on NC machines. The tape had to ing of the previous program. If M99 is used in a standard
be rewound when the program has been completed for each program, it creates a program with no end - such a situation
part. M30 function provided this rewind capability. is called an endless loop. M99 should be used only in
subprograms, not in the standard programs.
When the control reads the program end function M02 or
M30, it cancels all axis motions, spindle rotation, coolant
function and usually resets the system to the default condi-
MACHINE FUNCTIONS
tions. On some controls the reset may not he automatic and
any programmer should be aware of it. Miscellaneous functions relating to the operation of the
machine tool are part of another group. This section de-
If the program ends with the M02 function, the control scribes the most important of them in detail.
remains at the program end, ready for the next Cycle Start.
On modern CNC equipment there is no need for M02 at all, Coolant Functions
except for backward compatibility. This function was used
in addition to M30 for those machines (mainly NC lathes) Most metal removal operations require that the cutting
that had tape readers without reels, using a short loop tape. tool flooded with a suitable coolant. In order to control
is
The trailer of the tape was spliced to the tape leader, creat- the flow of coolant in the program, there are three miscella-
ing a closed loop. When the program was finished, the start neous functions usually provided for this purpose:
of the tape was next to the end, so no rewind was necessary.
Long tapes could not use loops and required reels and M30.
M07 Mist ON
So much for the history of M02 - just ignore its existence.
Is M02 the Same as M30 ?
M08 Flood ON
On most modern controls, a system parameter can be set M09 Mist or Flood OFF
to make the M02 function with the same meaning as that of
M30. This setting can give it the rewind capabilities, useful
in situations where an old program can be used on a ma-
Mist is the combination of a small amount of cutting oil
mixed with compressed air. It depends on the machine tool
chine with a new control without changes.
manufacturer whether this function is standard for a partic-
In a summary, if the end of program is terminated by the ular CNC machine tool or not. Some manufacturers replace
M30 function, the rewind will be performed; if the M02 the mixture of oil and air with air only, or with oil shot only,
function is used, the rewind will not be performed. etc. In these cases, it is typical that an additional equipment
is built into the machine. If this option exists on the ma-
When writing the program, make sure the last block in chine, the most common miscellaneous function to activate
the program Contains nothing else but M30 as the preferred the oil mist or air is M07.
end (sequence block is allowed to start the block):
The function similar to M07 is M08 - coolant flooding.
N65 . . . This by far the most common coolant application in CNC
is
N66 G91 G28 XO YO programming. It is standard for virtually all CNC machine.
N67 M30 (END OF PROGRAM) The coolant, usually a suitable mixture of soluble oil and
% water, is premixed and stored in the coolant tank of the ma-
chine tool. Flooding the cutting edge of the tool is impor-
On some controls, the M30 function can be used together
tant for three reasons:
with the axes motion - NOT recommended !:
Heat dissipation
N65 . . .
The primary reason to use a coolant flood aimed at the Coolant should always be programmed with two impor-
cutting edge is to dissipate the heat generated there during tant considerations in
mind:
cutting. The secondary reason is to remove chips from the
There will be no coolant splashing outside of
cutting area, using coolant pressure. Finally, the coolant
the work area (outside of the machine)
also acts as a lubricant to ease the friction between the
cutting tool and material. Lubrication helps to extend tool There will never be a situation when
life and improves the surface finish. the coolant reaches a hot edge of the tool
During initial tool approach towards the part or during fi- The first consideration is relatively minor. If the coolant
nal return to the tool change position, the coolant is nor- function is programmed in the ‘wrong’ place, the result
mally not required. To turn off the coolant function, use the may be just an inconvenience. The wet area around the ma-
M09 function - coolant off. M09 will turn off the oil mist or chine may present unsafe working conditions and should
Hood supply and nothing else. In reality, the M09 function be quickly corrected. Even more serious situation happens
will shut off the coolant pump motor. when Hooding a cutting tool
the coolant suddenly starts
that has already entered the material. The change in tem-
Each of the three coolant related functions may be pro- perature at the cutting edge may cause the tool to break and
grammed in separate blocks or together with an axis mo- damage the part. Carbide tools are far more easily affected
tion.There are subtle but important differences in the order by temperature changes than high speed steel tools. Such a
and liming of the program processing. The following ex- possibility can be prevented during programming, by using
amples explain the differences: the M08 function a few blocks ahead of the actual cutting
block. Long pipes or insufficient coolant pressure on the
O Example A - oil mist is turned ON, if available :
N110 MO
Spindle Functions
Coolant ON, when programmed with the axes motion, front of the lathe. However, M03 and M04 spindle direc-
becomes active simultaneously with the axes motion tions are established the same way as for machining cen-
(Example D) ters. A further complication is the fact that left hand tools
Coolant OFF, programmed with the axes motion, are used in lathe work more frequently than in the work for
becomes effective only upon completion of milling applications. Make an effort to study the instruction
the axes motion (Example E) manual for a specific machine carefully - also see details
described in Chapter 12.
The main purpose of M08 function is to turn the coolant
pump motor on. It does not guarantee that the cutting edge Spindle function to program a spindle stop is M05. This
receives any coolant immediately. On large machines with function will stop the spindle from rotating, regardless of
long coolant pipes, or machines with low coolant pump the rotation direction. On many machines, the miscella-
pressure, some delay is to be expected before the coolant neous function M05 must also be programmed before re-
covers the distance between the pump and cutting tool. versing the spindle rotation:
60 Chapter 9
MO 3 (SPINDLE CW) For example, most roughing operations require the power
of the spindle more than the spindle speed. In this case, a
<. . Machining at the current location . . .
low range is usually a better selection. For finishing work, a
medium or high range is better, because high spindle rota-
MO 5 (SPINDLE STOP)
< . Usually a tool change ... > tion can be more beneficial to the metal removing process.
.
MO 4 (SPINDLE CCW)
The distribution of the miscellaneous functions depends
< . . Machining at the current location . . .
entirely on the number of gear ranges the CNC lathe has
available. Number of ranges is 1, 2, 3 or 4. The following
table shows typical distribution of the M functions, but
The M05 function may also be required when changing check the actual commands in a machine tool manual.
gear ranges on CNC lathes. A spindle stop programmed in
a block containing an axis motion, will take place after the Ranges M function Gear Range
motion has been completed.
1 available N/A None programmed
The last spindle control function is the function Ml 9,
called the spindle orientation. Some control manufacturers
M41 Low range
call it the spindle key lock function. Regardless of the de- 2 available
M42 High range
scription, the M
9 function will cause the spindle to stop in
1
orientation for most CNC machining centers. The orienta- The rule of thumb is that the higher the gear range, the
tion is built into the automatic tool changing sequence and more spindle speed is possible and less spindle power is re-
guarantees the correct positioning of all cutting tool hold- quired. The opposite is also true. Normally, the spindle ro-
ers. Some programmers like to program the 19 with the M tation does not have to be stopped to change a gear, but con-
machine zero return for the tool change position, to save a sult the lathe manual anyway. In doubt, stop the spindle
second or two of the cycle time. first, change the gear range, then restart the spindle.
similar approach is used for backboring operations. How- ready covered, specifically the coolant control and the gear
ever, these special cutting operations use fixed cycles in the changes. The remaining M
functions in this group are de-
program, where the spindle orientation is built in. For more scribed in detail elsewhere in this handbook, so only a short
details, Chapter 25 describes Fixed Cycles. description is offered here. The most notable of the ma-
chine related M functions are:
In conclusion, the M 19 function is rarely used in the pro-
gram. It is available as a programming aid and to the ma-
chine operator for setup work, using MDI operations. M function Description Type
As many program words as necessary are allowed in a The next few examples compare a typical structure of
single block. Some controls impose a limit on the number blocks for milling operations and blocks for turning opera-
of characters in one block. There is only a theoretical maxi- tions. Each block is presented as a separate example.
mum for Fanuc and similar controls, irrelevant in practice.
The only restriction is that two or more duplicated words Block Structure for Milling
(functions or commands) cannot be used in the same block
(with the exception of G codes). For example, only one In milling operations, the structure of a typical program
miscellaneous Mfunction (exceptions do exist) or only one block will reflect the realities of a CNC machining center
coordinate word for the X axis in a single block are or a similar machine.
61
62 Chapter 10
N23 G02 X7.5 Z-2.8 RO . 5 F0.012 (EXAMPLE 2) If the program name is longer than the sixteen characters
Since the control screen display can show only the first
PROGRAM IDENTIFICATION sixteen characters of the program name, the program
names will be ambiguous when displayed:
A CNC program can be identified by its number and, on
some controls, also by its name. The identification by the 01005 (LOWER SUPPORT AR)
program number is necessary in order to store more than 01006 (LOWER SUPPORT AR)
one program in the CNC memory. Program name, if avail-
able,can be used to make a brief description of the pro-
To eliminate this problem, use an abbreviated description
that is within the sixteen characters and contains all the sig-
gram, readable on the control screen display.
nificant data:
Program Number
01005 (LWR SUPP ARM OP1)
The first any part program is commonly a
block used in
01006 (LWR SUPP ARM OP2)
program number, if required by the control system from the
If a more detailed description is required, the description
program. Two addresses are available for the program
has to be split over one or more comment lines:
number - the standard letter O
for EIA format, and the co-
lon | : |
for the ASCII (ISO) format. In memory operation,
01005 (LWR SUPP ARM OP1)
the control system always displays program number with
(OPERATION 1 - ROUGHING)
the letter O. The block containing the program number is
not always necessary to include in the CNC program. The comments in the block or blocks following the pro-
gram number will not appear on the directory screen list-
If the program uses program numbers, they must be
ing, but still will be a useful aid to the CNC operator. They
specified within an allowed range. Programs for typical
will be displayed during the program execution and, of
Fanuc controls must be within the range of - 9999, pro- 1
controls and N I to N99999 for the newer controls. Some crement is allowed and
its selection depends on the
rather old controls accept block number in the three digit personal programming style or the standard established
range only, N1 - N999. within the company. The typical sequence block incre-
ments other then one are:
The N address must always be the first word in the block.
For an easier orientation in programs that use subprograms,
there should be no duplication of the numbers between the
Increment Program example
two types of programs. For example, a main program start- 2 N2, N4, N6, N8, ...
ing with NI and a subprogram also starting with N1 may
cause a confusing situation. Technically, there is nothing 5 N5 , N10, N15 , N20 , ...
wrong with such a designation. Refer to Chapter 39 for 10 N10 , N2 0 , N3 0 N40 ...
, ,
suggestions on block numbering in subprograms.
100 N100 , N2 0 0, N300, N400, ...
Sequence Number Command
quence numbers the way they are used normally, the sec-
lastexample N100, usually programmed in the incre-
-
ond column shows the sequence numbers required in a for- ments of 100, 10, or less. There is nothing wrong with this
rather a large start and increment, but the CNC program
mat acceptable to the machine control system, as applied to
will become unnecessarily too long, too soon, and possibly
a CNC program:
difficult to manage.
Increment First block number In all cases of block increments other than one, the pur-
Note the change in block N40 and added blocks N61 to The block sequence number does not affect the order of
N64. Preference in this handbook is to program in incre- program processing, regardless of the increment. Even if
ments of one and if an addition is needed, the added blocks the blocks are numbered in a descending or mixed order,
will have no block numbers at all (check if the control the part program will always be processed sequentially, on
system allows block numbers to be omitted, most do). the basis of the block contents, not number. The incre-its
G Example A - one face cut sertion of up to 4 to 9 blocks respectively between any two
original blocks. That should be more than sufficient for the
N40 GOO G41 X3.5 Z0 T0303 M08 majority of program modifications.
N41 G01 X-0.07 F0.01
N42 GOO W0.1 For those CNC programmers who use a computer based
N43 G40 X3.5 programming system, just a few words relating to the pro-
gramming of sequence numbers. Although the computer
O Example B - two face cuts :
programming system allows the start number of the block
and its increment to almost any combination, adhere to the
N40 GOO G41 X3.5 Z0.05 T0303 M08
startand increment numbers of one (Nl, N2, N3, ...). The
N41 G01 X-0.07 F0.01
N42 GOO W0.1 purpose of a computer based programming is to keep an ac-
X3.5 curate database of the part geometry and the cutting tool
ZO path. If the CNC program is modified manually, the part
G01 X-0.07 computer database is not accurate any more. Any CNC
GOO W0.1 program change should always be reflected in the source of
N43 G40 X3.5 the program, as well as its result - never in the result alone.
The use of block numbers in a program is optional, as numbers, such as a machining cycle or tool change. In these
shown in the earlier example. A program containing block cases, select increments of two or five, for the operator’s
numbers is easier to read. For the CNC operator, search and convenience. Even limited use of sequence numbers will
increase the program length, but for a justifiable reason.
edit functions in program editing can be used easily. Note -
The semicolon symbol on the screen is only a graphic The name safe block - which is another name used for the
representation of the end-of-block character and is never startup block - does not become safe on its own - it must be
entered literally in the CNC program. Under no circum- made safe. Regardless of the name, this block should con-
stances it should be included in the program itself. Some tain control settings for the program or the cutting tool that
older control systems have an asterisk [
* ] as the display start the program in a ‘clean’ state. The most common en-
symbol for the end-of-block, rather then the semicolon [ ; ]. tries that set the initial status are the dimensioning system
Many controls use other symbols, that also represent the (English/metric and absolute/incremental), cancellation of
end of block, for example, some use the dollar sign $ ]. In [
any active cycle, cancellation of the active cutter radius
any case, remember the symbol is only the representation offset mode, the plane selection for milling, the feedrate de-
of the end-of-block character, not its actual character. fault selection for lathes, etc. The presented examples show
some startup blocks for both milling and turning controls.
STARTUP BLOCK OR SAFE BLOCK At the beginning of the program for milling, a startup
block may be programmed with the following contents:
A startup block (sometimes called a safe block or a status
block ) a special sequence block. It contains one or more
is N1 GOO G17 G20 G40 G54 G64 G80 G90 G98
modal words (usually preparatory commands of several G
N1 block is the first sequence number, GOO selects the
groups) that preset the control system into a desired initial
or default state. This block is placed at the beginning of rapid mode, G17 establishes the XY plane selection, G20
each program or even at the beginning of each tool and it is
selects the English units, G40 cancels any active cutter ra-
(or a tool within a program). In the CNC program, the cels any active fixed cycle, G90 selects the absolute mode,
startup block usually precedes any motion block or axis and G98 will retract to the initial level in a fixed cycle.
setting block, as well as the toolchange or tool index block. These conditions apply only when the startup block is pro-
This is the block to be searched for, if the program or the cessed as the first major block in the CNC program - any
desired cutting tool is to be repeated during a machine op- subsequent program changes will become effective only
eration. Such a block will be slightly different for the mill- with the block in which the change is applied. For example,
if a GO command is effective by default, any subsequent
ing and turning systems, due to the unique requirements of 1
each control system. usage of GOO, G02, or G03 will cancel the GO command. 1
Earlier in this handbook, in the Chapter 5, one topic cov- At the beginning of a CNC lathe program, the startup
ered the state of the control system when the main power block may contain these G codes:
has been turned on, which sets the system default condi-
tions. A CNC
programmer should never count on these de- N1 G20 GOO G40 G99
fault conditions, since they can be easily changed by the
N1 is number, G20 selects the English
the first block
machine tool operator, without the
programmer’s knowl-
units, GOO mode. G40 cancels any active
selects the rapid
edge. If such a change does happen, the programmed set-
tool nose radius offset, and the G99 selects feedrate per rev-
tings will nor correspond to those suggested by the machine
olution mode. Reference to the absolute or incremental
tool manufacturer or the engineers who designed the con-
system is usually not required, since the lathe controls use
trol system.
addresses X and Z for the absolute dimensioning and the
A professional CNC programmer should always assume addresses U and W
for the incremental dimensioning. For
the attitude of a safe programming approach and will not lathe controls that do not support the U and addresses, W
leave anything to chance. The programmer will try to pre- the standard G91 code is used for incremental values in X
set all the required conditions under the program control, and Z axes. As in the milling example, any of the words
rather that counting on the defaults of the CNC system. programmed in the safe block can be overridden by subse-
Such an approach is not only much safer, it will also result quent change of the G commands.
in the programs that are easy to use during the setup, the
and the tool repetition due
Some controls systems do not allow certain G codes on
tool path proving to the tool
the same line. For example, G20 or G21 may not be pro-
breakage, dimensional adjustments, etc. It is also very
beneficial to the CNC machine operators, particularly to
grammed with other G codes. If you are not sure, place the
the startup block will not increase the machining cycle time
N1 G20 G17 G40 G49 G80
at all.Another benefit of the startup block is that the pro-
gram is more transportable from one machine tool to an- two or more blocks can be safely used:
other, since it does not count on the default setting of a par-
ticular machine-control combination. N1 G20
N2 G17 G40 G49 G80
66 Chapter 10
Various comments and messages in the program can be The instructions in a program block must be logical and
included within the program body as separate blocks, or as reasonable - not impossible. For instance, the first block of
parts of an existing block, mostly in cases when the mes- the program contains the following words:
sage is short. In either case, the message must be enclosed
in parenthesis (for ASCII/ISO format): N1 G20 G21 G17
- what will
Definitely not possible, but also not realistic
N330 MOO (REVERSE PART / CHECK TOOL)
actually happen and how does the control interpret such a
statement? The XY plane is all right, but what about the se-
O Example C
lection of dimensions? Obviously, both selection are not
N330 MOO possible, the block contains conflicting words, opposite di-
(REVERSE PART / CHECK TOOL) mensional units. Some controls may give an error message,
Fanuc systems What will happen? The control
will not.
The purpose of a message or comment in the program is unit will evaluate thesequence block and check for any
to inform the machine operator of a specific task that must words within the same group. The distribution of command
be performed every time the program reaches the stage of groups have been described in the section dealing with the
processing where such message appears. Comments are preparatory commands - G codes, in Chapter 8.
also useful for understanding the program at a later date
and can be used for documenting the program. If the computer system finds two or more words that be-
long to the same group, it will not return an error message,
Typical messages and comments relate to information it word of the group. In
will automatically activate the last
about setup changes, chip removal from a hole, dimen- the example of conflicting dimensional selection, it will be
sional check, cutting tool condition check and many others. the preparatory function G21 - selection of metric dimen-
A message or a comment block should be included only if sions - that becomes active. That may or may not be the se-
the required task is not clear from the program itself - no lection required. Rather than counting on some kind of elu-
need to describe what happens in each block. Messages and sive luck, make sure there are no conflicting words in any
comments should be brief and focused, as they occupy a program block.
memory space in the CNC memory.
In the example illustrating the English and metric selec-
From the practical perspective, a series of messages and tion, the preparatory command G was used. What would
comment blocks can be provided at the beginning of each happen example, the address
if, for X was used? Consider
program, to list all significant drawing information and cut- the following example:
ting tools required for the job. This subject has been
covered in Chapter 7 - here is just a reminder: N120 G01 X11.774 X10.994 Y7.056 F15.0
01001 (SHAFT - DWG B451) There are two X addresses in the same block. The control
(SHAFT TOOLING - OP 1 - 3 JAW CHUCK) system will not accept the second X value, but it will issue
an alarm (error). Why? Because there is a great difference
(T01 - ROUGH TOOL - 1/32R - 80 DEG) between the programming rules for a G code as such and
(T02 - FINISH TOOL - 1/32R - 55 DEG) for the coordinate system words. Fanuc controls allow to
(T03 - OD GROOVING TOOL - 0.125 WIDE)
place as many G codes in the same block as needed, provid-
(T04 - OD THREADING TOOL - 60 DEG)
ing they are not in conflict with each other. But the same
program more than one co-
control system will not allow to
N1 G20 G99
ordinate word of the same address for each sequence block.
N2 ...
Some other rules may also apply. For example, the words in
If the available memory space of the CNC unit is limited, a block may be programmed in any order, providing the N
using comment blocks in this manner may prove impracti- address is the first one listed. For example, the following
cal. It will be better if the messages and comments are block is legal (but very nontraditional in its order):
As a matter of good programming practices, be sure to The answer may be surprising - in both cases, the control
write the entries for each sequence block in a logical order. will ignore the I and J values and will only process the value
The block number must be the first word and is usually fol- of radius R. The order of address definition is irrelevant in
lowed by G code(-s), primary axes in their alphabetical or- this special case. The address R has a higher control prior-
der X.., Y.., Z..), auxiliary axes or modifiers (I.., J.., K..), ity than the I and J addresses, if programmed in the same
miscellaneous functions and words, and the feedrate word block. All examples assume that the control system sup-
as the last item. Select only those words needed for the indi- ports the R radius input.
vidual block:
section dealing with this subject ( Chapter 29), specifies N15 G90 G01 XI. 5 Y6 5 F18. .
that an arc or a circle can be programmed either with arc N16 G90 G01 XI. 5 Y3.4 F18.0
modifiers I, J and K (depending whether a milling or a turn- N17 G90 GOO XI. 5 Y3.4 Z1.0
ing control system is used). It also specifies that a direct ra-
dius input, using the address R, can be used. Both of the
O Example B - with modal values :
N15 XI.
N16 Y3.4
N21 G01 X15.35 Y11.348 N17 GOO Z1.0
N22 G02 X16.85 Y12.848 11.5 JO
N23 G01 . .
Both examples will produce identical results. Compare
each block of the Example A with the corresponding block
O With the direct radius R address :
block N22, if it contains both, the I and J modifiers as well structions,such as tool change, indexing table, etc.). The M
as the radius input: functions behave in a similar fashion. For example, if the
program contains a machine zero return in two consecutive
N22 G02 X16.85 Y12.848 11.5 JO R1.5 blocks (usually for safety reasons), it may look like this:
There are special cases, mentioned earlier, where the or- MO 3 MO 4 M07 M08
der of commands in the block determines the priority in
which the commands are executed. To complete the subject Functions that will be executed after the cutting tool mo-
of a block, let’s look at another situation. tion hasbeen completed:
N410 GOO X22.0 Y34.6 S850 M03 Be careful here - if in doubt, program it safe. Some mis-
cellaneous functions require an additional condition, such
and
as another command or function to be active For example,
M03 and M04 will only work if the spindle function S is in
N560 GOO Z5.0 M05
effect (spindle is rotating). Other miscellaneous functions
N410, the rapid motion is programmed to-
In the block should be programmed in separate blocks, many of them
for logical or safety reasons:
gether with two spindle commands. What will actually
happen during the program execution? It is very important
MO 2 MO 6 M10 Mil Ml 9 M30 M60 M99
to know when the spindle will be activated in relationship
to the cutting tool motion. On Fanuc and many other con-
Functions indicating the end of a program or a sub-
trols, the spindle function will take effect simultaneously
program (M02, M30, M99) should stand on their own and
with the tool motion.
not combined with other commands in the same block, ex-
In the block N560, a Z axis tool motion is programmed cept in special cases. Functions relating to a mechanical ac-
(Z5.0), this time together with the spindle stop function tivity of the machine tool (M06, M10, Mil, Ml 9, M60)
(M05). Here, the result will be different. The spindle will should be programmed without any motion in effect, for
be stopped only when the motion is one hundred percent safety. In the case of M 19 (spindle orientation), the spindle
completed. Chapter 9 covering Miscellaneous Functions rotation must be stopped first, otherwise machine may get
explains this subject. damaged. Not all M
functions are listed in the examples,
but they should provide a good understanding of how they
Similar situations exist with a number of miscellaneous may work, when programmed together with a motion. The
functions (M codes), and any programmer should find out chapter describing the miscellaneous functions also covers
exactly how a particularmachine and control system han- the duration of typical functions within a program block.
dle a motion combined with an M
function address in the
same block. Here is a refresher in the form of a list of the It never hurts to play it safe and always program these
most common results: possible troublemakers in a sequence block containing no
tool motion. For the mechanical functions, make sure the
program is structured in such a way that it provides safe
working conditions - these functions are oriented mainly
towards the machine setup.
11 INPUT OF DIMENSIONS
Addresses in a CNC program that relate to the tool posi- During the program development, it is imperative to con-
tion at a given moment are called the coordinate words. Co- sider the impact of default conditions of the control system
ordinate words always take a dimensional value, using the on program execution. The default conditions come into ef-
currently selected units, English or metric. Typical coordi- fect the moment the CNC machine tool has been turned on.
natewords are X ,Y, Z, I, J, K, R, etc. They are the basis of Once a command is issued in theMDI mode or in a pro-
alldimensions in CNC programs. Tens, hundreds, even gram, the default value may be overwritten and will remain
thousands of values may have to be calculated to make the changed from that point on. The dimensional unit selection
program do what it is intended to do - to accurately ma- in the CNC program will change the default value (that is
chine a complete part. the internal control setting). In other words, if the English
unit selection is made, the control system will remain in
The dimensions in a program assume two attributes:
that mode until a metric selection command is entered.
The units of dimensions in a program can be of two kinds To select a specific dimensional input, regardless of the
- metric or English. The reference of dimensions can be ei- default conditions, a preparatory G command is required at
ther absolute or incremental. the beginning of the CNC program:
69
70 Chapter 1
Millimeter mm
G2 0 Initial unit selection (English)
dimensioning in a part program. If the program calls a mensional systems (older terms are in parentheses):
In fact, it is unwise to mix them, even if the results for the mm/min in/min (also IPM or ipm)
Offset values (the FI and D offsets for milling A dimension in either input units must have a specified
and tool preset val