0% found this document useful (0 votes)
539 views529 pages

CNC Programming Handbook - Text

Uploaded by

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

CNC Programming Handbook - Text

Uploaded by

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

Second Edition

CNC
Programming
Handbook

Second Edition
CNC
Programming
Handbook
Second Edition

A Comprehensive Guide to Practical CNC Programming

Peter Smid

Industrial Press Inc.


989 Avenue of the Americas, New York, NY 10018
http://www.industrialpress.com
Library of Congress Cataloging-in-Publication Data

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.

TJ1189 .S592 2000


621.9’023— dc21
00-023974

Second Edition

CNC Programming Handbook

Industrial Press Inc.


989 Avenue of the Americas, New York. NY 10018

Copyright © 2003. Printed in the United States of America.

All rights reserved.

This book or parts thereof may not be reproduced, stored in a retrieval

system, or transmitted in any form without the permission of the publishers.

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:

• FANUC and CUSTOM MACRO or USER MACRO or MACRO B


are registered trademarks of Fujitsu-Fanuc, Japan

• GE FANUC is a registered trademark of GE Fanuc Automation, Inc.,


Charlottesville, VA, USA
• MASTERCAM is the registered trademark of CNC Software Inc.,
USA
Tolland, CT,

• AUTOCAD is a registered trademark of Autodesk, Inc.,


San Rafael, CA, USA
• HP and HPGL are registered trademarks of Hewlett-Packard, Inc.,

Palo Alto, CA, USA


• IBM is a registered trademark of International Business Machines, Inc.,

Armonk, NY, USA

• WINDOWS is a registered trademarks of Microsoft, Inc.,


Redmond, WA, USA
About the Author
Peter Smid is a professional consultant, educator and speaker, with many years of practi-
cal,hands-on experience, in the industrial and educational fields. During his career, he has
gathered an extensive experience with CNC and CAD/CAM applications on all levels. He
consults to manufacturing industry and educational institutions on practical use of Com-
puterized Numerical Control technology, part programming, CAD/CAM, advanced ma-
chining, tooling, setup, and many other related fields. His comprehensive industrial back-
ground in CNC programming, machining and company oriented training has assisted
several hundred companies to benefit from his wide-ranging knowledge.

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

MANUAL PROGRAM INTERRUPTION. ... 25


Single Block Operation 25
2 - CNC MILLING 7 Feedhold 25
Emergency Stop 25
CNC MACHINES MILLING - 7 MANUAL DATA INPUT MDI - 26
Types of Milling Machines 7 PROGRAM DATA OVERRIDE 26
Machine Axes 8
Rapid Motion Override 26
VerticalMachining Centers 8
Spindle Speed Override 27
Horizontal Machining Centers 9
Feedrate Override 27
Horizontal Boring Mill 10
Dry Run Operation 27
Typical Specifications 10
Z Axis Neglect 28
Manual Absolute Setting 28
Sequence Return 28
3 -CNC TURNING 11 Auxiliary Functions Lock 28
Machine Lock 28
CNC MACHINES -TURNING 11 Practical Applications 29
Types of CNC Lathes 11 SYSTEM OPTIONS 29
Number of Axes 11 Graphic Display 29
AXES DESIGNATION 11 In-Process Gauging 30
Stored Stroke Limits 30
Two-axis Lathe 12
Drawing Dimensions Input 30
Three-axis Lathe 12
Machining Cycles 30
Four-axis Lathe 13
Cutting Tool Animation 30
Six-axis Lathe 13
Connection to External Devices 30
FEATURES AND SPECIFICATIONS .... 13
Typical Machine Specifications 13
Control Features 14 - PROGRAM PLANNING 31

STEPS IN PROGRAM PLANNING 31


- COORDINATE GEOMETRY 15
INFORMATION
INITIAL 31

REAL NUMBER SYSTEM 15 MACHINE TOOLS FEATURES 31


Machine Type and Size 31
RECTANGULAR COORDINATE SYSTEM . . . 15

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

Tolerances 35 G CODE TYPES 52


35
7 Surface Finish G Codes and Decimal Point 52
Drawing Revisions 36
Special Instructions 36

METHODS SHEET 36 - MISCELLANEOUS FUNCTIONS 53


MATERIAL SPECIFICATIONS 36
Material Uniformity 36 DESCRIPTION AND PURPOSE 53
Machinability Rating 37 Machine Related Functions 53
MACHINING SEQUENCE 37 Program Related Functions 53

TOOLING SELECTION 38 TYPICAL APPLICATIONS 54


Applications for Milling 54
PART SETUP 38
Applications for Turning 54
Setup Sheet 38 Special MDI Functions 54
TECHNOLOGICAL DECISIONS 38 Application Groups 54
Cutter Path 38 M FUNCTIONS IN A BLOCK 55
Machine Power Rating 39 M Functions
Startup of 56
Coolants and Lubricants 39 Duration of M Functions 56
WORK SKETCH AND CALCULATIONS ... 40 PROGRAM FUNCTIONS 56
Identification Methods . 40 Program Stop 56
QUALITY IN CNC PROGRAMMING .... 40 Optional Program Stop
Program End
57
58
Subprogram End 58
- PART PROGRAM STRUCTURE 41 MACHINE FUNCTIONS 58
Coolant Functions 58
BASIC PROGRAMMING TERMS . 41 Spindle Functions 59
Character 41 Gear Range Selection 60
Machine Accessories 60
Word 41
Block 41
Program 42

PROGRAMMING FORMATS . . 42
10 -SEQUENCE BLOCK 61

WORD ADDRESS FORMAT . . 42


BLOCK STRUCTURE 61
FORMAT NOTATION . . . . 43 Building the Block Structure 61
Short Forms 43 Block Structure for Milling 61
System Format
Milling
Turning System Format
a PROGRAM IDENTIFICATION 62

Multiple Word Addresses


45 Program Number 62
Program Name 62
SYMBOLS IN PROGRAMMING . 45
SEQUENCE NUMBERS 63
Plus and Minus Sign 45
Sequence Number Command 63
PROGRAM HEADER . . . . 45 Sequence Block Format 63
TYPICAL PROGRAM STRUCTURE. 46 Numbering Increment 64
Long Programs and Block Numbers 64

END OF BLOCK CHARACTER 64


STARTUP BLOCK OR SAFE BLOCK .... 65
Table of Contents XI

PROGRAM COMMENTS 66 Exact Stop Command 89


CONFLICTING WORDS IN A BLOCK .... 66 Exact Stop Mode Command 89

MODAL PROGRAMMING VALUES .... 67


Automatic Corner Override
Tapping Mode
89
89
EXECUTION PRIORITY 68 Cutting Mode 90
CONSTANT FEEDRATE 90
Circular Motion Feedrates 90
1 1 - INPUT OF DIMENSIONS 69
MAXIMUM FEEDRATE 91
Maximum Feedrate Considerations 91
ENGLISH AND METRIC UNITS 69 14
Comparable Unit Values 70 FEEDHOLD AND OVERRIDE 91
Feedhold Switch 91
ABSOLUTE AND INCREMENTAL MODES . . 70
Feedrate Override Switch 91
Preparatory Commands G90 and G91 71 Feedrate Override Functions 92
Absolute Data Input - G90 72
Incremental Data Input - G91 72 E ADDRESS IN THREADING 92
Combinations in a Single Block 72

DIAMETER PROGRAMMING 73 - TOOL FUNCTION 93


MINIMUM MOTION INCREMENT 73
FORMAT OF DIMENSIONAL INPUT .... 73 T FUNCTION FOR MACHINING CENTERS . . 93
FullAddress Format 74 Tool Storage Magazine 93
Zero Suppression 74 Fixed Tool Selection 94
Decimal Point Programming 75 Random Memory Tool Selection 94
Input Comparison 76 Registering Tool Numbers 94
Programming Format 95
CALCULATOR TYPE INPUT 76
Dummy Tool
Empty Tool or 95
TOOL CHANGE FUNCTION -M06 95
12 -SPINDLE CONTROL 77 Conditions for Tool Change 95
AUTOMATIC TOOL CHANGER ATC - . ... 96
SPINDLE FUNCTION 77 Typical ATC System 96
Spindle Speed Input 77 Maximum Tool Diameter 97
13
DIRECTION OF SPINDLE ROTATION .... 77
Maximum
Maximum
Tool Length
Tool Weight
97
97
Direction for Milling 78 ATC Cycle 98
Direction for Turning 78
MDI Operation 98
Direction Specification 79
15
PROGRAMMING THE ATC 98
Spindle Startup 79
Single Tool Work 98
SPINDLE STOP 80
Programming Several Tools 99
SPINDLE ORIENTATION 80 Keeping Track of Tools 99
SPINDLE SPEED R/MIN - 81 Any Tool in Spindle- Not the First 99
First Tool in the Spindle 100
SPINDLE SPEED -SURFACE 81 No Tool in the Spindle 101
Material Machinability 81 First Tool in the Spindle with Manual Change .... 101
Spindle Speed - English Units 82 No Tool in the Spindle with Manual Change 102
Spindle Speed - Metric Units 82 First Tool in the Spindle and an Oversize Tool .... 102
No Tool in the Spindle and an Oversize Tool 102
CONSTANT SURFACE SPEED 82
Maximum Spindle Speed Setting 84 T FUNCTION FOR LATHES 103
Part Diameter Calculation in CSS 85 Lathe Tool Station 103
Tool Indexing 103

TOOL OFFSET REGISTERS 104


- FEEDRATE CONTROL 87 Geometry Offset 104
Wear Offset 105
FEEDRATE CONTROL 87 Wear Offset Adjustment 106
The R and T Settings 106
FEEDRATE FUNCTION 87
Feedrate per Minute 87
Feedrate per Revolution 88
- REFERENCE POINTS 107
FEEDRATE SELECTION 88
ACCELERATION AND DECELERATION ... 88 REFERENCE POINT GROUPS 107
xii Table of Contents

Reference Point Groups Relationship 108 TOOL SETUP 129


MACHINE REFERENCE POINT Center Line Tools 129
108
Turning
19 Tools 130
= e*um to Machine Zero 109
Boring Tools 130
PART REFERENCE POINT 109 Command Point and Tool Work Offset 130
program Zero Selection 109
Program Zero - Machining Centers 110
program Zero - Lathes 112 - TOOL LENGTH OFFSET 131
TOOL REFERENCE POINT 112
GENERAL PRINCIPLES 131
Actual Tool Length 131
16 - REGISTER COMMANDS 113 Gauge Line 131
Table Top Face 132

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

17 POSITION COMPENSATION 119


HORIZONTAL MACHINE APPLICATION ... 141
-
21
TOOL LENGTH OFFSET CANCEL .... 141

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

TYPE OF MOTION & TIME COMPARISON . . 146


WORK AREAS AVAILABLE 123
124
REDUCTION OF RAPID MOTION RATE . . . 147
Additional Work Offsets
RAPID MOTION FORMULAS 147
WORK OFFSET DEFAULT AND STARTUP . . 124
Work Offset Change 125 APPROACH TO THE PART 148
Z Axis Application 126
HORIZONTAL MACHINE APPLICATION 127
. . .
- MACHINE ZERO RETURN 149
EXTERNAL WORK OFFSETS 128
LATHE APPLICATIONS 128 MACHINE REFERENCE POSITION .... 149
Types of Offsets 128 Machining Centers 149
Geometry Offset 128 Lathes 150
Wear Offset 129 Setting the Machine Axes 150
Tool and Offset Numbers 129 Commands
Program 151
Command Group 151
Table of Contents xiii

RETURN TO PRIMARY MACHINE ZERO. . . 151 LONG DWELL TIME 175


Intermediate Point 151 Machine Warm-Up 175
Absolute and Incremental Mode 152 X Axis is the Dwelling Axis 176
Return from the Z Depth Position 153
25Safety and Dwell 176
Axes Return Required for the ATC 155
FIXED CYCLES AND DWELL 176
Zero Return for CNC Lathes 155
22
RETURN POSITION CHECK COMMAND. . . 156
RETURN FROM MACHINE ZERO POINT. . . 157 - FIXED CYCLES 177
RETURN TO SECONDARY MACHINE ZERO. . 158
POINT-TO-POINT MACHINING 177
Single Tool Motions vs. Fixed Cycles 178
- LINEAR INTERPOLATION 159 FIXED CYCLE SELECTION 178
PROGRAMMING FORMAT 179
LINEAR COMMAND 159
GENERAL RULES 180
and End of the Linear Motion 159
23Start
Single Axis Linear Interpolation 159 ABSOLUTE AND INCREMENTAL VALUES . . 180
Two Axes Linear Interpolation 160
INITIAL LEVEL SELECTION 181
Three Axis Linear Interpolation 160
R LEVEL SELECTION 181
PROGRAMMING FORMAT 160
Z DEPTH CALCULATIONS 182
LINEAR FEEDRATE
Feedrate Range
161
161
DESCRIPTION OF FIXED CYCLES .... 183
Individual Axis Feedrate 161 G81 - DrillingCycle 183
G82 - Spot-Drilling Cycle 183
PROGRAMMING EXAMPLE 162 G83 Deep Hole Cycle Standard 184
26 - Drilling -

G73 - Deep Hole Drilling Cycle - High Speed 184


G84 - Tapping Cycle - Standard 186
24 - BLOCK SKIP FUNCTION 163 G74 - Tapping Cycle - Reverse 186
G85 - Boring Cycle 187
G86 - Boring Cycle 187
TYPICAL APPLICATIONS 163
G87 - Backbormg Cycle 187
BLOCK SKIP SYMBOL 163 G88 - Boring Cycle 188
G89 Boring Cycle 188
CONTROL UNIT SETTING 163 -

G76 - Precision Boring Cycle 189


BLOCK SKIP AND MODAL COMMANDS . . 164
FIXED CYCLE CANCELLATION 189
PROGRAMMING EXAMPLES 165
FIXED CYCLE REPETITION 189
Variable Stock Removal 165
Machining Pattern Change 166 The L or K Address 190
Trial Cut for Measuring 168 LO or KO in a Cycle 190
Program Proving 169
Barf eeder Application 170
Numbered Block Skip 170 - MACHINING HOLES 191

SINGLE HOLE EVALUATION 191


- DWELL COMMAND 171 Tooling Selection and Applications 191
Program Data 194
PROGRAMMING APPLICATIONS .... 171
DRILLING OPERATIONS 194
Applications for Cutting 171
Types of Drilling Operations 194
Applications for Accessories 171
Types of Drills 194
DWELL COMMAND 171 Programming Considerations 195
Dwell Command Structure 172 Nominal Drill Diameter 195
Effective Drill Diameter 195
DWELL TIME SELECTION 172 Drill Point Length 195
SETTING MODE AND DWELL 173 Center Drilling 196
Through Hole Drilling 196
Time Setting 173
Blind Hole Drilling 197
Number of Revolutions Setting 173
Flat Bottom Drilling 197
MINIMUM DWELL 173 Indexable Insert Drilling 198
NUMBER OF REVOLUTIONS 174 PECK DRILLING 199
System Setting 174 Typical Peck Drilling Application 199
Time Equivalent 174 Calculating the Number of Pecks 199
XIV Table of Contents
28
Selecting the Number of Pecks 200
Controlling Breakthrough Depth 200 - FACE MILLING 227
REAMING 201
Reamer Design 201 CUTTER SELECTION 227
Spindle Speeds for Reaming 201 Basic Selection Criteria 227
Feedrates for Reaming 201 Face Mill Diameter 227
Stock Allowance 202 Insert Geometry 228
Other Reaming Considerations 202
CUTTING CONSIDERATIONS 228
SINGLE POINT BORING 202 Angle of Entry 229
Single Point Boring Tool 202 29Milling Mode 229
Spindle Orientation 203 Number of Cutting Inserts 230
Block Tools 203
PROGRAMMING TECHNIQUES 230
BORING WITH A TOOL SHIFT 203 Single Face Mill Cut 231
Precision Boring Cycle G76 203 Multiple Face Mill Cuts 232
Backboring Cycle G87
Programming Example
204
204
USING POSITION COMPENSATION .... 233
Precautions in Programming and Setup 205
ENLARGING HOLES 205 - CIRCULAR INTERPOLATION 235
Countersinking 205
Counterboring 206
207
ELEMENTS OF A CIRCLE 235
Spotfacing
Radius and Diameter 235
MULTILEVEL DRILLING 207 Circle Area and Circumference 236
WEB DRILLING 208 QUADRANTS 236
TAPPING 209 Quadrant Points 236
Tap Geometry 210 PROGRAMMING FORMAT 237
Tapping Speed and Feedrate 210
Arc Cutting Direction 237
Pipe Taps 211
Circular Interpolation Block . 237
Tapping Check List 212
Arc and End Points
Start 238
HOLE OPERATIONS ON A LATHE .... 212 30
Arc Center and Radius
Arc Center Vectors
238
238
Tool Approach Motion 213
Tool Return Motion 213 Arc m Planes 239
Drilling and Reaming on Lathes 214 RADIUS PROGRAMMING 240
Peck Drilling Cycle - G74 214
Blend Radius 240
Tapping on Lathes 215
Partial Radius 240
Other Operations 216
FULL CIRCLE PROGRAMMING 240
Boss Milling 242
27 - PATTERN OF HOLES 217 Internal Circle Cutting • Linear Start 243
Internal Circle Cutting - Circular Start 243
Circle Cutting Cycle 244
TYPICAL HOLE PATTERNS 217
ARC PROGRAMMING 245
RANDOM HOLE PATTERN 217
STRAIGHTROW HOLE PATTERN .... 218
FEEDRATE FOR CIRCULAR MOTION ... 245

ANGULAR ROW HOLE PATTERN .... 218


Feedrate for Outside Arcs
Feedrate for Inside Arcs
246
246
Pattern Defined by Coordinates 218
Pattern Defined by Angle 219

CORNER PATTERN 220 - CUTTER RADIUS OFFSET 247


GRID PATTERN 220
Angular Grid Pattern 221
MANUAL CALCULATIONS 247
Tool Path Center Points 248
ARC HOLE PATTERN 222 Cutter Radius 249
BOLT HOLE CIRCLE PATTERN 223 Center Points Calculation 249
Bolt Circle Formula 224 COMPENSATED CUTTER PATH 250
Pattern Orientation 224
Types of Cutter Radius Offset 250
POLAR COORDINATE SYSTEM 225 Definition and Applications 250
Plane Selection 226 PROGRAMMING TECHNIQUES 250
Order of Machining 226 Direction of Cutting Motion 251
Table of Contents XV

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

FIXED CYCLES IN PLANES 274 MULTIPLE OFFSETS 295


General Approach 296
Diameter Tolerances 296
- PERIPHERAL MILLING 275 Shoulder Tolerances 297
Diameter and Shoulder Tolerances 297

END MILLS 275 OFFSET SETTING 298


XVI Table of Contents

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

ROUGH AND FINISHED SHAPE 302 G75 GROOVE CUTTING CYCLE


- 322

Rough Operations 302 G75 Cycle Format - 10T/1 IT/1 5T 322


Finish Operations 303
G75 Cycle Format - 0T/1 6T/1 8T/20T/2 IT 322
Stock and Stock Allowance 303 BASIC RULES FOR G74 AND G75 CYCLES . . 322
PROGRAMMING A RECESS 304
SPINDLE SPEED IN CSS MODE 305 36 - GROOVING ON LATHES 323
LATHE PROGRAM FORMAT 306
Program Format - Templates 306 GROOVING OPERATIONS 323
General Program Format 306
Main Grooving Applications 323
Approach to the Part 306
Grooving Criteria 323
GROOVE SHAPE 323
35- LATHE CYCLES 307 Nominal Insert Size 324
Insert Modification 324

STOCK REMOVAL ON LATHES 307 GROOVE LOCATION 324


Simple Cycles 307 GROOVE DIMENSIONS 324
Complex Cycles 307 Groove Position 325
PRINCIPLES OF LATHE CYCLES 307 Groove Depth 325

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

MULTIPLE REPETITIVE CYCLES 313 MULTIPLE GROOVES 330


General Description 313 FACE GROOVES 330
Cycle Format Types 313 Radial Clearance 331
Cutting Cycles and Part Contour 313 Face Grooving Program Example 331
Chipbreaking Cycles 313
CORNER GROOVES /NECK GROOVES ... 332
CONTOUR CUTTING CYCLES 314
GROOVING CYCLES 332
Boundary Definition 314
G75 Cycle Applications 332
Start Point and the Points P and Q 314
Single Groove with G75 333
TYPE AND TYPE
I II CYCLES 315 Multiple Grooves with G75 333
Programming Type and Type I II Cycles 315 SPECIAL GROOVES 333
Cycle Formatting

G71 -STOCK REMOVAL IN TURNING ...


315
315
GROOVES AND SUBPROGRAMS .... 334

G71 Cycle Format- 10T/1 IT/1 5T 316


G71 Cycle Format - 0T/16T/18T/20T/21T 316 37 - PART-OFF 335
G71 for External Roughing 316
G71 for Internal Roughing 317
Direction of Cutting in G71 317 PART-OFF PROCEDURE . 335

G72 - STOCK REMOVAL IN FACING . ... 317


Parting Tool Description
Tool Approach Motion
...
...
335
336
G72 Cycle Format- 10T/1 IT/1 5T 317 Stock Allowance ... 337
G72 Cycle Format - 0T/1 6T/1 8T/20T/2 1 T 318 Tool Return Motion ... 337
G73 - PATTERN REPEATING CYCLE . . . . 318 Part-off with a Chamfer ... 337
G73 Cycle Format - 10T/1 1T/15T 318 Preventing Damage to the Part ... 338
G73 Cycle Format - 0T/16T/18T/20T/2 IT 319
G73 Example of Pattern Repeating 319
38 SINGLE POINT THREADING 339
G70 -CONTOUR FINISHING CYCLE . ... 320
-
Table of Contents XVI

THREADING ON CNC LATHES 339


Form Thread
of a 339 39 - SUBPROGRAMS 367
Threading Operations 340
TERMINOLOGY OF THREADING 340 MAIN PROGRAM AND SUBPROGRAMS . . 367
THREADING PROCESS 341 Subprogram Benefits 367
Identification of Subprograms 368
Steps in Threading 341
Thread Start Position 342 SUBPROGRAM FUNCTIONS 368
Thread Cutting Diameter and Depth 342 Subprogram Call Function 368
Thread Cutting Motion 343 Subprogram End Function 368
Retract from Thread 344 BlockNumber to Return to 369
Return to Start Position 344 Number of Subprogram Repetitions 369
THREADING FEED AND SPINDLE SPEED . . 344 L0 in a Subprogram Call 370

Threading Feedrate Selection 345 SUBPROGRAM NUMBERING 371


Spindle Speed Selection 345 Organized Approach 372
Maximum Threading Feedrate 346 Protected Subprograms 373
Lead Error 347
SUBPROGRAM DEVELOPMENT 373
TOOL REFERENCE POINT 348 Repeating Pattern Recognition 373
BLOCK-BY-BLOCK THREADING 348 Tool Motionand Subprograms 374

BASIC THREADING CYCLE - G92 .... 349


Modal Values and Subprograms 375

MULTIPLE REPETITIVE CYCLE G76 - .... 350


MULTI LEVEL NESTING
One Level Nesting
376
376
G76 Cycle Format - 10T/1 1T/15T 350
Two Level Nesting 376
G76 Cycle Format 0T/16T/18T
- 351
Three Level Nesting 377
Programming Example 351
Four Level Nesting 377
First Thread Calculation 352
Nesting Applications 377
THREAD INFEED METHODS 353
CONTOURING WITH A SUBPROGRAM ... 378
Radial Infeed 353
Compound Infeed 353 TOOL CHANGE SUBPROGRAM 379
Thread Insert Angle - Parameter A 354 100 000 000 HOLE GRID 379
Thread Cutting Type - Parameter P 354

ONE-BLOCK METHOD CALCULATIONS. . . 355


Initial Considerations 355 40 - DATUM SHIFT 381
Z Axis Start Position Calculation 355
THREAD RETRACT MOTION 357 DATUM SHIFT WITH G92 OR G50 .... 381

Thread Pullout Functions 357 Program Zero Shift 381


Single Axis Pullout 357 LOCAL COORDINATE SYSTEM 383
Two-Axis Pullout 357
G52 Command 384
HAND OF THREAD
THREADING TO A SHOULDER
358
358
MACHINE COORDINATE SYSTEM .... 384
DATA SETTING 386
Insert Modification 358
Data Setting Command 386
Program Testing 360
Coordinate Mode 386
OTHER THREAD FORMS 360 WORK OFFSETS 386
Thread Depth 360
Standard Work Offset Input 386
TAPERED THREAD 361 Additional Work Offset Input 387
Depth and Clearances 361 External Work Offset Input 387
Taper Calculation 361 TOOL LENGTH OFFSETS 387
Block by Block Taper Thread 362
Valid Input Range 388
Tapered Thread Using a Simple Cycle 363
Tapered Thread and a Multi Repetitive Cycle 363 CUTTER RADIUS OFFSETS 388
MULTISTART THREAD 364 LATHE OFFSETS 388
Threading Feedrate Calculation 364 MDI DATA SETTING 389
Shift Amount 365
Application Example 366
PROGRAMMABLE PARAMETER ENTRY. . . 389
Modal G10 Command 389
THREAD RECUTTING 366 Parameters Notation 390
Program Portability 390
Bit Type Parameter 391
Effect of Block Numbers 392
xviii Table of Contents
41
BARFEEDER ATTACHMENT 413
- MIRROR IMAGE 393 Bar Stopper 413
ADDITIONAL OPTIONS 414
BASIC RULES OF MIRROR IMAGE .... 393 Part Catcher or Part Unloader 414
Tool Path Direction 393 Continuous Operation 414
Original Tool Path 394 Parts Counter 415
Mirror Axis 394 Pull-Out Finger 415
Sign of Coordinates 394
Milling Direction 395
PROGRAMMING EXAMPLE 415
Arc Motion Direction 395
Program Start and End 395
45 - HELICAL MILLING 417
MIRROR IMAGE BY SETTING 395
42Control Setting 395
HELICAL MILLING OPERATION 417
Programming - Manual Mirror Setting 396
PROGRAMMABLE MIRROR IMAGE .... 396
Helical Interpolation
Programming Format
417
417
Mirror Image Functions 396 Arc Modifiers for Helical Interpolation 418
Simple Mirror Image Example 397 Applications and Usage 418
Complete Mirror Image Example 398
THREAD MILLING 418
MIRROR IMAGE ON CNC LATHES
43 .... 398 Applying Thread Milling 418
Conditions for Thread Milling 418
Thread Milling Tool 419
- COORDINATE ROTATION 399 Premachining Requirements 419
Clearance Radius 419
Productivity of Thread Milling 419
ROTATION COMMANDS 399
Center of Rotation 399 THE HELIX 419
Radius of Rotation 399 THREAD MILLING EXAMPLE 421
44
Coordinate Rotation Cancel 401
Straight Thread 421
Common Applications 401
Calculations
Initial 421
PRACTICAL APPLICATION 401 Starting Position 422
Motion Rotation and Direction 422
Lead-In Motions 423
- SCALING FUNCTION 405 Thread Rise Calculation 424
Milling the Thread 424
Lead-Out Motions 425
DESCRIPTION 405 Complete Program 425
Scaling Function Usage 405 External Thread Milling 425
lapered hread Milling 425
PROGRAMMING FORMAT 405 I

Further Considerations 426


Scaling Center 406
Scaling Factor 406 THREAD MILLING SIMULATION METHOD . . 426
Rounding Errors in Scaling 407 HELICAL RAMPING 427
PROGRAM EXAMPLES 407

46 - HORIZONTAL MACHINING 429


- CNC LATHE ACCESSORIES 409
INDEXING AND ROTARY AXES 429
CHUCK CONTROL 409 INDEXING TABLE (B AXIS) 429
Chuck Functions 409 Units of Increment 429
Chucking Pressure 410 Direction of Indexing 430
Chuck Jaws 410 Table Clamp and Unclamp Functions 430
TAILSTOCK AND QUILL 410 Indexing in Absolute and Incremental Mode 430
Tailstock Body 410 B AXIS AND OFFSETS 431
Quill 411
Work Offset and B Axis 431
Center 411
Tool Length Offset and B Axis 432
Quill Functions 411
Programmable Tailstock 411 RETURN TO MACHINE ZERO 434
Safety Concerns 411 INDEXING AND A SUBPROGRAM .... 434
BI-DIRECTIONAL TURRET INDEXING ... 412 COMPLETE PROGRAM EXAMPLE . 436
Programming Example 412 AUTOMATIC PALLET CHANGER APC - 437
able of Contents XIX

Working Environment 438 RUNNING THE FIRST PART 459


Types of Pallets 438 PROGRAM CHANGES 460
E rogramming Commands 439
47= 3llet Changing Program Structure 439
Program Upgrading 460
Program Updating 461
HORIZONTAL BORING MILL 439 Documentation Change 461
ALTERNATE MACHINE SELECTION .... 461

- WRITING A CNC PROGRAM 441 MACHINE WARM UP PROGRAM .... 462


CNC MACHINING AND SAFETY 462
PROGRAM WRITING 441 SHUTTING DOWN A CNC MACHINE ... 463
-•agibility of Handwriting . 442 Emergency Stop Switch 463
= 'ogramming Forms 442 Parking Machine Slides 464
Confusing Characters 442 Setting the Control System 464
=ROGRAM OUTPUT FORMATTING .... 443 Turning the Power Off 464

-ONG PROGRAMS 445 EQUIPMENT MAINTENANCE 464


= 'ogram Length Reduction 445
Vemory Mode and Tape Mode 446
51 - INTERFACING TO DEVICES 465

48 - PROGRAM DOCUMENTS 447 RS-232C INTERFACE 465


PUNCHED TAPE 466
DATA FILES 447 Tape Reader and Puncher 466
=ROGRAM DOCUMENTATION 448 Leader and Trailer 468
Tape Identification 468
ExternalDocumentation 448
Non-printable Characters 468
•nernalDocumentation 448
Storage and Handling 468
=rogram Description 449
SETUP AND TOOLING SHEETS 449
DISTRIBUTED NUMERICAL CONTROL ... 468

Setup Sheet 450 TERMINOLOGY OF COMMUNICATIONS . . 469


~co rig Sheet 450 Baud Rate 469
Coordinate Sheet 451 Parity 469

DOCUMENTATION FILE FOLDER .... 451


Data Bits
Start and Stop Bits
469
469
oentification Methods 451
cerator's Suggestions 452 DATA SETTING 469
50!

- 'ng and Storage 452 CONNECTING CABLES 470


Null Modem 470
Cabling for Fanuc and PC 470
49 - PROGRAM VERIFICATION 453

DETECTION OF ERRORS 453 52 - MATH IN CNC PROGRAMMING 471


:- 453
e.entive Measures
I :"ective Measures 453 BASIC ELEMENTS 471
D-=APHIC VERIFICATION 454 Arithmetic and Algebra 471
Order of Calculations 471
-.OIDING ERRORS 454
'tax Errors 455 GEOMETRY 472
-OO'Cal Errors 455 Circle 472
PIConstant 473
: '.'MON PROGRAMMING ERRORS Circumference of a Circle 473
;
-ogram Input Errors 456 Length of Arc 473
Insulation Errors 456 Quadrants 473
- 5'dware Errors 456
soclloncous Errors 456 POLYGONS 474
TAPERS 475
Taper Definition 475
- CNC MACHINING 457 Taper Per Foot 476
Taper Ratio 476
•ACHINING A NEW PART 457 Taper Calculations - English Units 476
Taper Calculations - Metric Units 476
letup Integrity 458
^ogram Integrity 458 CALCULATIONS OF TRIANGLES 477
XX Table of Contents

. :=s z~ Angles and Triangles 477 Hardware Specifications 487


-.ignt Triangles 478 Typical Hardware Requirements 488
S.milar Triangles 478 Utilities and Special Features 488
Sme Cosine Tangent
- - 479
POST PROCESSORS 488
Inverse Trigonometric Functions 480
Degrees and Decimal Degrees 480 Customizing Post Processor 488
Pythagorean Theorem 480 IMPORTANT FEATURES 489
Solving Right Triangles 481
Input from User 489
ADVANCED CALCULATIONS 482 Machining Cycles 489
User Interface 489
CONCLUSION 482
CAD Interface 489
SUPPORT AND MANAGEMENT 489
53 - CNC AND CAD/CAM 483 Training 490
System Management 490
Technical Support 490
PROGRAMMING MANUALLY? 483
CAM Software. 483 THE END AND THE BEGINNING 490
Desktop Computer Programming 483
TOOL PATH GEOMETRY DEVELOPMENT . . 484
A REFERENCE TABLES
- 491
TOOL PATH GENERATION 484
COMPLETE ENVIRONMENT 484 Decimal Equivalents 491
Multi Machine Support 485 English Threads - UNC/UNF 494
Associative Operations 485
Job Setup 485 Straight Pipe Taps NPS 494
and Job Comments
Tooling List 485 Taper Pipe Taps NPT 495
Connection Between Computers 485
Program Text Editor 486
Metric Coarse Threads 495
Printing Capabilities 486 Metric Fine Threads 495
Pen Plotting 486
CAD Software Access 486
Support for Solids 486 Index 497
Software Specifications 487
1 NUMERICAL CONTROL

Numerical Control technology as it is known today, NC and CNC Technology


emerged in the mid 20th century. It can be traced to the year
In strict adherence to the terminology, there is a differ-
of 1952, the U.S. Air Force, and the names of John Parsons
ence in the meaning of the abbreviations NC and CNC. The
and the Massachusetts Institute of Technology in Cam-
bridge, MA, USA. It was not applied in production manu-
NC stands for the older and original Numerical Control
facturing until the early 1960’s. The real boom came in the
technology, whereby the abbreviation CNC stands for the
newer Computerized Numerical Control technology, a
form of CNC, around the year of 1972, and a decade later
with the introduction of affordable micro computers. The
modem spin-off of its older relative. However, in practice,
history and development of this fascinating technology has
CNC is the preferred abbreviation. To clarify the proper us-
age of each term, look at the major differences between the
been well documented in many publications.
NC and the CNC systems.
In the manufacturing field, and particularly in the area of
Both systems perform the same tasks, namely manipula-
metal working, Numerical Control technology has caused
tion of data for the purpose of machining a part. In both
something of a revolution. Even in the days before comput-
cases, the internal design of the control system contains the
ers became standard fixtures in every company and in
logical instructions that process the data. At this point the
many homes, the machine tools equipped with Numerical
similarity ends.
Control system found their special place in the machine
shops. The recent evolution of micro electronics and the The NC system (as opposed to the CNC system) uses a
never ceasing computer development, including its impact fixed logical functions, those that are built-in and perma-
on Numerical Control, has brought significant changes to nently wired within the control unit. These functions can-
the manufacturing sector in general and metalworking in- not be changed by the programmer or the machine opera-
dustry in particular. tor. Because of the fixed wiring of the control logic, the NC
control system is synonymous with the term 'hardwired'.
DEFINITION OF NUMERICAL CONTROL The system can program, but it does not al-
interpret a part
low any changes to the program, using the control features.
All required changes must be made away from the control,
In various publications and articles, many descriptions
typically in an office environment. Also, the NC system re-
have been used during the years, to define what Numerical
quires the compulsory use of punched tapes for input of the
Control is. It would be pointless to try to find yet another
program information.
definition, just for the purpose of this handbook. Many of
these definitions share the same idea, same basic concept,
The modem CNC system, but not the old NC system,
just use different wording. uses an internal micro processor (/.&, a computer). This
computer contains memory registers storing a variety of
The majority of all the known definitions can be summed
routines that are capable of manipulating logical functions.
up into a relatively simple statement:
That means the part programmer or the machine operator
can change the program on the control itself (at the ma-
Numerical Control can be defined as an operation of
coded chine), with instantaneous results. This flexibility is the
machine tools by the means of specifically
instructions to the machine control system greatest advantage of the CNC systems and probably the
key element that contributed to such a wide use of the tech-
nology in modem manufacturing. The CNC programs and
The instructions are combinations of the letters of alpha-
the logical functions are stored on special computer chips,
bet, digits and selected symbols, for example, a decimal
as software instructions, rather than used by the hardware
point, the percent sign or the parenthesis symbols. All in-
connections, such as wires, that control the logical func-
and a predetermined
structions are written in a logical order
form. The collection of all instructions necessary to ma-
tions. In contrast to the NC system, the CNC system is syn-
onymous with the term 'softwired ’.

chine a part is called an NC Program, CNC Program, or a


Part Program. Such a program can be stored for a future When describing a particular subject that relates to the
use and used repeatedly to achieve identical machining re- numerical control technology, customary to use either
it is
sults at any time. the termNC or CNC. Keep in mind that NC can also mean
CNC in everyday talk, but CNC can never refer to the older

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

physical involvement as manual machining. Numerically


controlled machining does not need any levers or dials or
What makes the CNC machining superior to the conven- handles, at least not in the same sense as conventional ma-
tional methods? Is it superior at all? Where are the main chining does. Once the part program has been proven, it
benefits? If the CNC and the conventional machining pro- can be used any number of times over, always returning
cesses are compared, a common general approach to ma- consistent results. That does not mean there are no limiting
chining a part will emerge: factors. The cutting tools do wear out, the material blank in
one batch is not identical to the material blank in another
1 . Obtain and study the drawing
batch, the setups may vary, etc. These factors should be
2. Select the most suitable machining method
considered and compensated for, whenever necessary.
3. Decide on the setup method (work holding)
4. Select the cutting tools The emergence of the numerical control technology does
5. Establish speeds and feeds not mean an instant, or even a long term, demise of all man-
6. Machine the part ual machines. There are times when a traditional machin-
ing method
is preferable to a computerized method. For ex-
This basic approach is the same for both types of machin-
ample, simple one time job may be done more efficiently
a
ing. The major difference is in the way how various data
on a manual machine than a CNC machine. Certain types
are input.A feedrate of 10 inches per minute (10 in/min) is
of machining jobs will benefit from manual or semiauto-
the same in manual or CNC applications, but the method of
matic machining, rather than numerically controlled ma-
applying it is not. The same can be said about a coolant - it
can be activated by turning a knob, pushing a switch or
chining. The CNC machine tools are not meant to replace
every manual machine, only to supplement them.
programming a special code. All these actions will result in
a coolant rushing out of a nozzle. In both kinds of machin- many
In whether certain machin-
instances, the decision
ing, a certain amount of knowledge on the part of the user is ing will be done on a CNC machine or not is
based on the
required. After metal working, particularly metal cut-
all,
number of required parts and nothing else. Although the
ting, is mainly a but it is also, to a great degree, an art
skill, volume of parts machined as a batch is always an important
and a profession of large number of people. So is the appli- criteria, it should never be the only factor. Consideration
cation of Computerized Numerical Control. Like any skill should also be given to the part complexity, its tolerances,
or art or profession, mastering it to the last detail is neces- the required quality of surface finish, etc. Often, a single
sary to be successful. It takes more than technical knowl- complex part will benefit from CNC machining, while fifty
edge to be a CNC
machinist or a CNC programmer. Work relatively simple parts will not.
experience and intuition, and what is sometimes called a
'gut-feel ', is a much needed supplement to any skill. Keep mind that numerical control has never machined
in
a single partby itself. Numerical control is only a process
In a conventional machining, the machine operator sets or a method that enables a machine tool to be used in a pro-
up the machine and moves each cutting tool, using one or ductive, accurate and consistent way.
both hands, to produce the required part. The design of a
manual machine tool offers many features that help the
process of machining a part - levers, handles, gears and di-
NUMERICAL CONTROL ADVANTAGES
als, to name just a few. The same body motions are re-
peated by the operator for every part in the batch. However, What are the main advantages of numerical control?
the word 'same ’in this context really means ‘similar 'rather
than ‘identical’. Humans are not capable to repeat every
It is important to know which areas of machining will

process exactly the same at


benefit from it and which done the conventional
are better
all of ma-
times - that is the job
work way. absurd to think that a two horse power CNC mill
It is
chines. People cannot at the same performance level
will win over jobs that are currently done on a twenty times
all the time, without a rest. All of us have some good and

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.

Lead time reduction


Accuracy and Repeatability
Accuracy and repeatability

The high degree of accuracy and repeatability of modern


Contouring of complex shapes
CNC machines has been the single major benefit to many
Simplified tooling and work holding users. Whether the part program is stored on a disk or in the
Consistent cutting time
computer memory, or even on a tape (the original method),
it always remains the same. Any program can be changed

General productivity increase at will, but once proven, no changes are usually required

any more. A given program can be reused as many times as


Each area offers only a potential improvement. Individ-
needed, without losing a single bit of data it contains. True,
ual users will experience different levels of actual improve-
program has to allow for such changeable factors as tool
ment, depending on the product manufactured on-site, the
wear and operating temperatures, it has to be stored safely,
CNC machine used, the setup methods, complexity of
but generally very little interference from the CNC pro-
fixturing, quality of cutting tools, management philosophy
grammer or operator be required. The high accuracy of
will
and engineering design, experience level of the workforce,
CNC machines and their repeatability allows high quality
individual attitudes, etc.
parts to be produced consistently time after time.

Setup Time Reduction


Contouring of Complex Shapes
In many cases, the setup time for a CNC machine can be
CNC lathes and machining centers are capable of con-
reduced, sometimes quite dramatically. It is important to
realize that setup is a manual operation, greatly dependent
touring a variety of shapes. Many CNC
users acquired their
machines only to be able to handle complex parts. good A
on the performance of CNC operator, the type of fixturing
examples are CNC applications in the aircraft and automo-
and general practices of the machine shop. Setup time is
tive industries. The use of some form of computerized pro-
unproductive, but necessary - it is a part of the overhead
gramming is virtually mandatory for any three dimensional
costs of doing business. To keep the setup time to a mini-
tool path generation.
mum should be one of the primary considerations of any
machine shop supervisor, programmer and operator. Complex shapes, such as molds, can be manufactured
without the additional expense of making a model for trac-
Because of the design of CNC machines, the setup time
ing.Mirrored parts can be achieved literally at the switch of
should not be a major problem. Modular fixturing, standard
a button. Storage of programs is a lot simpler than storage
tooling, fixed locators, automatic tool changing, pallets and
of patterns, templates, wooden models, and other pattern
other advanced features, make the setup time more efficient
making tools.
than a comparable setup of a conventional machine. With a
good knowledge of modern manufacturing, productivity
Simplified Tooling and Work Holding
can be increased significantly.
Nonstandard and ‘homemade’ tooling that clutters the
The number of parts machined under one setup is also
benches and drawers around a conventional machine can
important, in order to assess the cost of a setup time. If a
be eliminated by using standard tooling, specially designed
great number of parts is machined in one setup, the setup
for numerical control applications. Multi-step tools such as
cost per part can be very insignificant. A very similar re-
pilot drills, step drills, combination tools, counter borers
duction can be achieved by grouping several different oper-
and others are replaced with several individual standard
ations into a single setup. Even if the setup time is longer, it
tools. These tools are often cheaper and easier to replace
may be justified when compared to the time required to
than special and nonstandard tools. Cost-cutting measures
setup several conventional machines.
have forced many tool suppliers to keep a low or even a
nonexistent inventory, increasing the delivery time to the
Lead Time Reduction
customer. Standard, off-the-shelf tooling can usually be ob-
Once a part program is written and proven, it is ready to tained faster then nonstandard tooling.

be (Used again in the future, even at a short notice. Although


usually longer, virtually
Fixturing and work holding for CNC machines have only
the lead lime for the first run is it is
one major purpose - to hold the part rigidly and in the same
nil any subsequent run. Even if an engineering change
for
position for all parts within a batch. Fixtures designed for
of the part design requires the program to be modified, it
CNC work do not normally require jigs, pilot holes and
can be done usually quickly, reducing the lead time.
other hole locating aids.
4 Chapter 1

Cutting Time and Productivity Increase Boring mills and Profilers

The cutting time on the CNC machine is commonly EDM machines


known as the cycle time - and is always consistent. Unlike a
Punch presses and Shears
conventional machining, where the operator’s skill, experi-
ence and personal fatigue are subject to changes, the CNC Flame cutting machines
machining is under the control of a computer. The small
Routers
amount of manual work is restricted to the setup and load-
ing and unloading the part. For large batch runs, the high Water jet and Laser profilers

cost of the unproductive time is spread among many parts,


Cylindrical grinders
making it less significant. The main benefit of a consistent
cutting time is for repetitive jobs, where the production Welding machines

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.

Mills and Machining Centers


To reach the goal of a major increase in productivity, it is

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.

chine tool operator and this goal is also reflected in the


handbook approach as well as in the numerous examples.
CNC machining centers are far more popular and effi-
cient than drills and mills, mainly for their flexibility. The
main benefit the user gets out of a CNC machining center is
TYPES OF CNC MACHINE TOOLS the ability to group several diverse operations into a single
setup. For example, drilling, boring, counter boring, tap-
Different kinds of CNC machines cover an extremely ping, spot facing and contour milling can be incorporated
large variety. Their numbers are rapidly increasing, as the into a single CNC program. In addition, the flexibility is
technology development advances. It is impossible to iden- enhanced by automatic tool changing, using pallets to
tify all the applications, they would make a long list. Here minimize idle time, indexing to a different side of die part,
is a brief list of some of the groups CNC machines can be using a rotary movement of additional axes, and a number
part of: * of other features. CNC machining centers can be equipped
with special software that controls die speeds and feeds, the
Mills and Machining centers
life of the cutting tool, automatic in-process gauging and

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.

ing all its modem functions.


A good CNC programmer must be flexible in order to offer
high programming quality.
6 Chapter 1

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

Milling machines where the spindle motion is up and


CNC MACHINES -MILLING down, are categorized as vertical machines. Milling ma-
chines where the spindle motion is in and out are catego-
,

The description of CNC milling machines is so large, it


rized as horizontal machines - see Figure 2-1 and 2-2.
can fill a thick book all by itself. All machine tools from a
simple knee type milling machine up to a five axis profiler
can be included They vary in size, features,
in this category.
suitability for certain work, etc., but they do all have one

common denominator their primary axes are the X and Y


-

axes - and for this reason, they are called the XY machines.

In the category of the XY machines are also wire EDM


machine and water jet cutting machines, flame
tools, laser
cutters, burners, routers, etc. Although they do not qualify
as milling type machine tools, we mention them because
the majority of programming techniques applicable to the
mills is identical to these machines types as well. The best
example is a contouring operation, a process common to
many CNC machines.

For the purpose of this handbook, a milling machine can


be defined:

Schematic representation of a CNC vertical machining center


Milling machine machine capable of a simultaneous
is a
cutting motion, using an end mill as the primary cutting tool,
along at least two axes at the same time

This definition eliminates all CNC drill presses, since


their design covers positioning but not profiling. The defi-
nition also eliminates wire EDM
machines and a variety of
burners, since they are capable of a profiling action but not
with an end mill. Users of these machine tools will still
benefit from many subjects covered here. The general prin-
ciples are adaptable to the majority of CNC machine tools.
For example, a wire EDM
uses a very small cutter diame-
ter, in the form of a wire. A laser cutting machine uses the
laser beam as its cutter, also having a known diameter but
The focus will be concentrated
the term kerf is used instead.
on metal cutting machine tools, using various styles of end
mills as the primary tool for contouring. Since an end mill
can be used in many ways, first look will be at the various
types of available milling machines. Schematic representation of a CNC horizontal machining center

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-

tary axis (the A models or the B axis for


axis for vertical tically or horizontally, depending on the desired results and
horizontal models). Even higher of flexibility can be
level the model type. This fourth axis can be used either for in-
found on machines with live or more axes. A simple ma- dexing or a full rotary motion. In the combination with a
chine with five axes may be a boring mill that has three ma- tailstock (usually supplied), the fourth axis in the vertical
jor axes, plus a rotary axis (usually the B axis) and an axis configuration can be used for machining long parts that
parallel to the Z axis (usually the W
axis). However, true need support at both ends.
complex and flexible five-axis profiling milling machine is
The majority of vertical machining centers most opera-
the type used in aircraft industry, where a multi-axis, simul-
tors work with are those with an empty table and three-axes
taneous cutting motion is necessary to machine complex
configuration.
shapes and reach cavities and various angles.
From the programming perspective, there are at least two
At times, the expression two and a half axis machine or a
items worth mentioning:
three and a half axis machine is used. These terms refer to
the type of machines, where simultaneous cutting motion ONE programming always takes place from the viewpoint
-

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

Vertical and Horizontal Machining Center - Typical Specifications

Description Vertical Machining Center Horizontal Machining Center

Number of axes 3 axes (XYZ) 4 axes (XYZB)

Table dimensions
780 x 400 mm 500 x 500 mm
31x16 inches 20 x 20 inches

Number of tools 20 36

Maximum travel - X axis


575 mm 725 mm
22.5 inches 28.5 inches

Maximum travel - Y axis


380 mm 560 mm
15 inches 22 inches

Maximum travel - Z axis


470 mm 560 mm
18.5 inches 22 inches

Table indexing angle N/A 0.001 degree

Spindle speed 60-8000 rpm 40 - 4000 rpm

AC 7. 5/5. 5 kW AC 1 1/8 kW
Spindle output
AC 10/7 HP AC 15/11 HP

Spindle nose-to-table distance - Z axis


150 - 625 mm 150-710 mm
6 - 24.6 inches 6 - 28 inches

Spindle center-to-column distance - Y axis


430 mm 30 - 560 mm
17 inches 1.2-22 inches

Spindle taper No. 40 No. 50

Tool shank size BT40 CAT50

2 - 10000 mm/min 1 - 10000 mm/min


Feedrate range
0.100 - 393 in/min 0.04 - 393 in/min

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)

Tool selection Random memory Random memory

Maximum tool diameter


80 mm (150 w/empty pockets) 105 mm
3.15 inches (5.9 w/empty pockets) 4.1 inches

Maximum tool length


300 mm 350 mm
11.8 inches 13.75 inches

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

Horizontal Boring Mill On the preceding a comprehensive chart showing


page is

the typical specifications of a CNC Vertical Machining


Horizontal boring mill is just another CNC machine. It Center and a CNC Horizontal Machining Center. The spec-
closely resembles a CNC horizontal machining center, but ifications are side by side in two columns, strictly for con-
it does have its own differences. Generally, a horizontal venience, not for any comparison purposes. These are two
boring mill is defined by the lack of some common fea- different machine types and comparison is not possible for
tures, such as the Automatic Tool Changer. As the name of all features. In order to compare individual machine tools
the machine suggests, its primary purpose is boring opera- within a certain category, machine tool specifications prov-
tions, mainly lengthy bores. For that reason, the reach of ided by the machine manufacturer often serve as the basis
the spindle is extended by a specially designed quill. An- for comparison. These specifications are contained a list of
other typical feature is an axis parallel to the Z axis, called verifiable data,mainly technical in nature, that describes
the W axis. Although this is, in effect, the fifth axis Resig- the individual machine by its main features. Machine tool
nation (X, Y, Z, B, W), a horizontal boring mill cannot be buyers frequently compare many brochures of several dif-
called a true five axis machine. The Z axis (quill) and the W ferent machines as part of the pre purchase process. Man-
axis (table) work in the opposite directions towards each agers and process planners compare individual machines in
other, so they can be used for large parts and hard-to-reacli the machine shop and assign the available workload to the
areas. It also means, that during drilling, the machine table most suitable machine.
moves against an extended quill. The quill is a physical part
of the spindle. It is in the spindle where the cutting tool ro- A fair and accurate comparison can be made between two
tates - but the in-and-out motions are done by the table. vertical machining centers or between two horizontal ma-
Think of the alternate method offered on horizontal boring chining centers, but cannot be done fairly to compare be-
mills - if the quill were to be very long, it would lose its tween two different machine types.
strength and rigidity. The better way was to split the tradi-
In a typicalmachine specification chart, additional data
tional single Z axis movement into two - the quill extension
may be not included in the earlier chart. In this hand-
listed,
along the Z axis will move only part of the way towards the
book, the focus is on only those specifications that are of
table and the table itself, the new W
axis, will move another
interest to the CNC programmer and the CNC operator.
3 CNC TURNING

CNC MACHINES -TURNING Number of Axes


The most common distinction of different CNC lathes is
A conventional engine lathe or a turret lathe is a common by the number of programmable axes. Vertical CNC lathes
machine in just about every machine shop. A lathe is used have two axes in almost all designs available. The much
for machining cylindrical or conical work, such as shafts,
more common CNC horizontal lathes, commonly designed
rings,wheels, bores, threads, etc. The most common lathe with two programmable axes, are also available with three,
operation is removal of material from a round stock, using a
four or six axes, thus adding extra flexibility to manufactur-
turning tool for external cutting. A lathe can also be used
ing of more complex parts.
for internal operations such as boring, as well as for groov-
ing, threading, etc., if a proper cutting tool is used. Turret A horizontal CNC lathe can further be described by the
lathes are usually weaker in machining power than engine type of engineering design:
do have a special carousel that holds several
lathes, but they
mounted cutting tools. An engine lathe has often only one FRONT lathe ... an engine lathe type

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

ent modes, such as chuck work, collet work, barfeeder, or


AXES DESIGNATION
between centers. Many other combinations also exist. CNC
lathes are designed to hold several tools in special turrets, A typical CNC lathe is designed with two standard axes -
they can have a milling attachment, indexable chuck, a sub one axis is the X axis, the other axis is the Z axis. Both axes

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

tools are in the work area.

Types of CNC Lathes


Following the established standards of the milling ma-
Basically, CNC lathes can be categorized by the type of chines and machining centers, the only machine axis capa-
design and by the number of axes. The two basic types are ble of making a hole by methods of drilling, boring, pierc-

the vertical CNC lathe and the horizontal CNC lathe. Of ing or punching, is the Z axis.

the two, the horizontal type is by far the most common in

manufacturing and machine shops. A vertical CNC lathe


In CNC lathe work, the traditional axis orientation for a
horizontal type of lathe is upwards and downwards motion
(incorrectly called a vertical boring mill) is somewhat less
for the X axis, and left and right motion for the Z axis, when
common but is irreplaceable for a large diameter work. For
looking from the machinist’s position. This view is shown
a CNC programmer, there are no significant differences in
in the following three illustrations Figure 3-1, Figure 3-2,
the programming approach between the two lathe types.
and Figure 3-3.

11
12 Chapter 3

HEADSTOCK X and Z primary axes, the multi-axis


In addition to the
TURRET lathes have individual descriptions of each additional axis,
for example, the C axis is usually the third axis, used for
CHUCK
milling operations, using so called live tooling. More de-
JAWS on the subject of coordinate system and machine ge-
tails
'
TOOL ometry are available in the next chapter.
X+ TAILSTOCK

t z-
t
<- -+z+ <n
v This
Two-axis Lathe

is the most common type of CNC lathes. The work

holding device, usually a chuck, is mounted on the left side


J CENTER of the machine viewed by the operator). The rear type,
(as
X- QUILL with the slant bed, is the most popular design for general

work. For some special work, for example in the petroleum


Figure 3- industry (where turning tube ends is a common work), a
Typical configuration of a two axis slant bed CNC lathe - rear type Hat bed is usually more suitable. The cutting tools are held
in a specially designed indexing turret that can hold four,
six, eight, ten, twelve and more tools. Many such lathes
also have two turrets.

Advanced machine tool designs incorporate tool storage


away from the work area, similar to the design of machin-
ing centers. Tens, even hundreds, of cutting tools may be
stored and used for a single CNC program. Many lathes
also incorporate a quick changing tooling system.

Three-axis Lathe

Three-axis lathe is essentially a two-axis lathe with an ad-


ditional axis. This axis has its own designation, usually as a
C axis in absolute mode (H axis in incremental mode), and
is programmable. Normally, the third axis is used for
fully
cross-milling operations, slot cutting, bolt circle holes drill-
Typical configuration of a CNC lathe with two turrets
ing, hex faces, side faces, helical slots, etc. This axis can re-
place some simple operations on a milling machine, reduc-
ing the setup time for the job. Some
limitations do apply to
many models, for example, the milling or drilling opera-
tions can take place only at positions projecting from the
tool center line to the spindle center line (within
a machin-
ing plane), although others offer off-center adjustments.

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

Four-axis Lathe There more in the promotional brochure than just


is

attractive photographs - in fact, in a well designed bro-


By design, a four-axis CNC lathe is a totally different
chure, there is a wealth of technical information, describing
concept than a three-axis lathe. As a matter of fact, to pro-
the machine tool. These are the features and specifications
gram a four-axis lathe is nothing more than programming
two two-axis lathes at the same time. That may sound
the CNC machine tool manufacturer considers important to
the customer.
strange at first, until the principle of a four-axis CNC lathe
becomes clearer. In the majority of brochures, there are practical data that
can be used in a particular CNC machine, a
programming
There are actually two controls (and two sets of the XZ
lathe in the example.
axes), one for each pair (set) of axes. Only one program
may be used to do the external - or outside - diameter
Typical Machine Specifications
roughing (OD) and another program to do the inside - or in-
ternal - roughing (ID). Since a four-axis lathe can work A typical horizontal CNC lathe, with two axes and a slant
with each pair of axes independently, the OD and ID can be bed design, may have the following specifications (taken
machined at the same time, doing two different operations from an actual brochure):
simultaneously. The main keys to a successful 4-axis lathe
programming is coordination of the tools and their opera- Description Specification
tions, timing of the tool motions and a generous sense of
healthy compromise. Number of axes Two (X, Z) or three (X, Z and C)

Maximum swing over bed


560 mm
For several reasons, both pairs of axes cannot work all the 22.05 inches
time. Because of this restriction, special programming fea- Maximum turning diameter
350 mm
13.76 inches
tures such as synchronized waiting codes (typically Miscel-
Maximum 550 mm
laneous Function), the ability to estimate how much time turning length
21.65 inches
each tool requires to complete each operation, etc., are re-
Spindle bore
85 mm
3.34 inches
quired. There is a level of compromise here, because only
one spindle speed can be used for both active cutting tools, Bar capacity
71 mm
2.79 inches
although feedrate independent for both pairs of axes.
is
Number of tools 12
This means that some machining operations simply cannot
be done simultaneously. Tool size square
25 mm
1 inch

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

Axis travel in Z axis 635 mm


Six-axis Lathe 25 inches
16000 mm/min
Rapid traverse rate X axis
Six-axis CNC lathes are specially designed lathes with a 629 in/min
twin turret and a set of three axes per turret. This design in- 24000 mm/min
Rapid traverse rate Z axis 944 in/min
corporates many tool stations, many of them power driven,
0.01 - 500 mm/rev
as well as back-machining capabilities. Programming these Cutting feedrate .0001 - 19.68 in/rev
lathes is similar to programming a three-axis lathe twice.
Chuck size
254 mm
10 inches
The control system automatically provides synchroniza-
tion, when necessary. Main spindle motor
AC 1 5/1 1 kW
AC 20/14.7HP

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

Rotating tool speed 30 - 3600 r/min


A look at a typical promotional brochure describing a
CNC machine tool is very useful in many respects. In most Milling motor
AC 3. 7/2. 2 kW
AC 5/2.95 HP
cases, the artwork quality impressive, the printing, pho-
is
Collet size
1 - 16 mm
tographs, paper selection and the use of colors is equally .04 - .63 inches

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

Control Features Rapid traverse rate different for X and Z axes

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

X axis represents a diameter, not a radius


Thread cutting feedrate available with six-decimal
Constant surface speed (CSS) is standard control feature
place accuracy (for inch units)
(G96 for CSS and G97 for r/min)
Least input increment in X axis is 0.001 mm or .0001
Absolute programming mode is X or Z or C inches on diameter - one half of that value per side

Incremental programming mode is U or W or H


4 COORDINATE GEOMETRY

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.

Zero integer ... 0

J Positive integers . . 1 , 2 ,
+3 ,
10 12943 , , +45
(with or without sign)

Negative integers ... -


4 ,
- 381 ,- 25 -77 ,

(minus sign required)

Fractions... 1 /8 , 3 / 16 , 9/ 32 35/64 ,

I I l-H —l-H— — — —t-H —


I I I- I

Decimal fractions . . 0 185


.
, . 2 , . 546875 3.5 ,

All groups are used almost daily. These groups represent


the mainstream of just about all applications of numbers in
modern life. In CNC
programming, the primary goal is to
use the numbers to ’translate' the drawing, based on its di-
mensions, into a cutter path.

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

has to be translated into a CNC program, using primarily


numbers. Numbers are also used to describe commands, The concepts used in design, drafting and in numerical
functions, comments, and so on. The mathematical concept control are over 400 years old. A given point can be mathe-

of a real number system can be expressed graphically on a matically defined on a plane (two coordinate values) or in

straight line, called the number scale where all divisions ,


space (three coordinate values). The definition of one point
is relative to another point as a distance parallel with one of
have the same length - Figure 4-1.
three axes that are perpendicular to each other. In a plane,
only two axes arc required, in the space, all three axes must

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:

An axis is a straight line passing through


the center of a plane or a solid figure,
around which the parts are symmetrically arranged

The definition can be enhanced by a statement that an


axis can also be a line of reference. In CNC programming,
an axis used as a reference all the time. The definition
is

contains the word ‘plane’. A plane is a term used in 2D ap-


plications, while a solid object is used in 3D applications.
Figure 4-4
Mathematical definition of a plane is:
Point of origin - intersection of axes

A plane is a surface in which a straight line joining


This intersection has a special meaning in CNC program-
any two of its points will lie wholly in the surface
ming. The origin acquires a new name, typically the pro-
gram reference point. Other terms are also used: program
From the top viewpoint of the observer, looking straight zero, part reference point, workpiece zero, part zero, with
down on the illustration Figure 4-3, a viewing direction is the same meaning and purpose.
established. This is often called viewing a plane.
Quadrants

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,

A quadrant is any one of the four parts of the plane

formed by the system of rectangular coordinates

The word quadrant (from word quadrans or


the Latin
quadrantis, meaning the fourth part), suggests four
uniquely defined areas or quadrants. Looking down in the
top view at the two intersecting axes, the following defini-
tions apply to quadrants. They are mathematically correct
and are used in CNC/CAD/CAM applications:

Figure 4-3 Quadrant 1


UPPER RIGHT
Axis designation - viewing plane
Quadrant UPPER LEFT
Mathematical designation is fully implemented in CNC II

Quadrant III LOWER LEFT


tal axis, the letter Y identifies its vertical axis. This plane is

XY plane. Defined mathematically, the horizon- Quadrant IV LOWER RIGHT


called the
tal axis is always listed as the first letter of the pair. In draft-
ing and CNC programming, this plane is also known as the The quadrants are defined in the counterclockwise direc-

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

The counting starts at the positive side of the horizontal


axis. Figure 4-5 illustrates the definitions.

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

Quadrants in the XY plane and their identification

Any point coordinate value can be positive, negative or


Coordinate definition of points within the rectangular coordinate
zero. Any coordinate value is determined solely by the lo- system (point PI = Origin =X0Y0)
cation of the defined point in a particular quadrant and its

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

- + The majority of CNC machines are programmed using


QUADRANT II
the so called absolute coordinate method, that is based on

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

IMPORTANT: Machine geometry is the relationship of distances be-


... If the defined point lies exactly on the X axis, tween the fixed point of the machine and the selectable
it has the Y value equal to zero (YO). point of the part. Typical geometry of a CNC machine uses
... If the pointlies exactly on the Y axis, the right hand coordinate system. The positive and negative
it has the X value equal to zero (XO). axis direction is determined by an established viewing con-
the point lies exactly on both X and Y axes,
basic rule for the Z axis is that it is always the
... If
vention. The
both X and Y values are zero (XO YO).
axis along which a simple hole can be machined with a sin-
gle point tool, such as a drill, reamer, wire or a laser beam.
X0Y0Z0 is the point of origin. In part programming, pos-
itive values are written without the plus sign - Figure 4-7. The Figure 4-8 illustrates the standard orientation of an
XYZ type machine tools.

Right Hand Coordinate System


Axis Orientation - Milling
In the illustrations of the number scale, quadrants and
axes, the origin divides each axis into two portions. The A typical 3-axis machine uses three controlled axes of
zero point - the point of origin - separates the positive sec- motion. They are defined as the X axis, the Y axis, and the Z
tion of the axis from the negative section. In the right-hand
axis. The X axis is parallel to the longest dimension of the
coordinate system, the positive axis begins at the origin and machine table, Y axis is parallel to the shortest dimension
is directed towards the right for the X axis, upwards for the of the table and the Z axis is the spindle movement. On a
Y axis and towards the perpendicular viewpoint for the Z vertical machining center, the X axis is the table longitudi-

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

Typical machine axes of a CNC lathe Iturning center)

Figure 4-8 Another variety, a vertical CNC


lathe, is basically a hori-

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

spindle direction. Horizontal machine can be viewed as a


A CNC machine of any type can be designed with one or
more additional axes, normally designated as the second-
vertical machine rotated in space by ninety degrees. The
additional feature of a horizontal machining center is the
ary axes using the U, and V W
letters. These axes are nor-

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

Axis Orientation - Turning


X axis Y axis Z axis
X and Z. More axes are related related related
Most CNC lathes have two axes,
available, but they are not important at this point. A special
Figure 4- 1
third axis, the C axis, is designed for milling operations
(live tooling) and is an option on the typical CNC lathe. Relationship of the primary and the secondary machine 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.

CRT DISPLAY SCREEN RESET KEY EDIT KEYS

HELP KEY ADDRESS NUMERIC


KEYBOARD KEYBOARD

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

Feature Description Feature Description

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

Enables program testing at fast


Dry Run Key (switch) to allow program editing
feedrates (without a mounted part)

Spindle Overrides the programmed spindle speed, Error Lights Red light indicating an error
Override usually within 50-120% range

Even is some features may not be listed, virtually all of


Feedrate Overrides the programmed feedrate,
usually within 0-200% range
those in the table are somewhat related to the CNC pro-
Override
gram. Many control systems have unique features of their
Shows current status of the chuck own. These features must be known to the CNC operator.
clamping (Outside / Inside clamping) The program supplied to the machine should be flexible,
not rigid - it should be ‘user friendly’.
Table Clamp Shows current status of table clamping

Screen Display and Keyboard


Coolant
Coolant control ON / OFF / AUTO
Switch The screen display is the ‘window’ to the computer. Any
active program can be viewed, including the status of the
Gear Shows current status of working
control, current tool position, various offsets, parameters,
gear range selection
Selection
even a graphic representation of the Tool Path. On all CNC
units, individual monochrome or color screens can be se-
Spindle Indicates spindle rotation direction
(clockwise or counterclockwise) lected to have the desired display at any time, using the in-
Rotation
put keys (keyboard pads and soft keys). Setting for interna-
Spindle tional languages is also possible.
Manual orientation of the spindle
Orientation
The keyboard pads and keys are used to input in-
soft

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

Handle SYSTEM FEATURES


For the setup purposes, each CNC machine has a rotary
handle that can move one selected axis by as little as the The CNC unit is nothing more than a sophisticated spe-
least increment of the control system. The official Fanuc cial purpose computer. The ‘special purpose’ in this case is
name for the handle is Manual Pulse Generator. Associ- a computer capable of controlling the activities of a ma-
ated with the handle is the Axis Select switch (often dupli- chine tool such as a lathe or a machining center. It means
,

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.

A good example is a CNC unit for two machines that are


thesame in all respects except one. One machine has a
manual tool changer, the other has an automatic tool
changer. In order to support the automatic tool changer, the
CNC unit must have special features built-in, that are not

required for a machine without the tool changer. The more


complex the CNC system is, the more expensive it is. Users
that do not require all the sophisticated features, do not pay
a premium for features they do not need.

Parameter Settings

The information that establishes the built-in connection


between the CNC control and the machine tool is stored as
special data in internal registers, called the system parame-
ters. Some of the information in this handbook is quite spe-
cialized and listed for reference only. Programmers with
limited experience do not need to know system parameters
in a great depth. The original factory settings are sufficient
for most machining jobs.

When the parameter screen is displayed, it shows the pa-


rameter number with some data in a row. Each row of num-
Figure 5-3 bers represents one byte , each digit in the byte is called a
An example of a detached handle, called the Manual Pulse bit. The word bit is made from the words Binary diglT and
Generator (MPG), with a typical layout and features. is the smallest unit of a parameter input. Numbering of bits
Layout and features may vary on different machine models.
starts with 0, read from the right to the left :

#6 #5 #4 #3 #2 #1 #0
Handle
Multiplier
One handle

for Metric units


division motion is

for English units


...
Number

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:

X10 0.010 mm .0010 inch Binary codes

Units inputs
X100 0.100 mm .0100 inch
Setting values
CONTROL SYSTEM 23

The binary input Parameters related to High-Speed Skip Signal Input


The groups use different input values.
Parameters related to Automatic Tool Compensation
can only have an input ot a 0 or for the bit data format, 0
1

broader scope - Parameters related to Tool Life Management


to +1 27 for the byte type. Units input has a
Parameters related to T urret Axis Control
the unit can be in mm, inches, mm/min, in/min, degrees,
Parameters related to High Precision Contour Control
milliseconds, etc. A value can also be specified within a
Parameters related to Service ... and other parameters
given range, for example, a number within the range of
0-99, or 0-99999, or +127 to -127, etc. .
Quite a few parameters have nothing to do with daily pro-
gramming and are listed only as an actual example. All sys-
A typical example of a binary input is a selection be-
tem parameters should be set or changed only by a quali-
tween two options. For instance, a feature called dry run A
fied person, such as an experienced service technician.
can be set only as effective or ineffective. To select a prefer-
0 programmer or operator should not modify any parameter
ence, an arbitrary bit number of a parameter has be set to
settings. These changes require not only qualifications but
to make the dry run effective and to 1 to make it ineffective.
authorization as well. Keep the list ol original parameter

Units input , for example, is used to set the increment sys- settings away from the control, in a sate place, just in case.

tem - the dimensional units. Computers in general do not


distinguish between inch and metric, just numbers. It is up Take care when changing control system parameters !

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

etc. Such values must never be set higher than


the The once
safest rule to observe is that
speed, monitor this activity.
machine can support. An indexing axis with a minimum in- the parameters have been set by a qualified technician, any
crement of 1°, will not become a rotary axis with .001° in- temporary changes required for a given work should be
crement, just because the parameter is set to a lower value, done through the CNC program. If permanent changes are

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.

To better understand what the CNC


system parameters
System Defaults
can do, here is an abbreviated of parameter classifi-
listing

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
, ,

Parameters related to Setting


common selections. That does not mean they will be the
Parameters related to Axis Control Data
preferred settings - it means they were selected on the basis
Parameters related to Chopping
of their common usage. Many settings are rather conserva-
Parameters related to the Coordinate System
tive in their values, for safety reaspns.
Parameters related to Feedrate
Parameters related to Acceleration/Deceleration Control The set of parameter values established at the time of in-
Parameters related to Servo stallation are called the default settings.The English word
Parameters related to DI/D0 'default' is a derivative of a French word ‘defaut’, that can
Parameters related to MDI, EDIT, and CRT be translated as ‘assumed’. When the main power to the
Parameters related to Programs controlis turned on, there are no set values
passed to pa-
Parameters related to Serial Spindle Output rameters from a program, since no program has yet been
Parameters related to Graphic Display automati-
used. However, certain settings become active
Parameters related to 1/0 interface without an external program. For instance, a cutter ra-
cally,
Parameters related to Stroke Limit the
dius offset is automatically canceled at the startup of
Parameters related to Pitch Error Compensation canceled are the fixed cycle mode and
control system. Also
Parameters related to Inclination Compensation certain condi-
tool length offset. The control ‘assumes 'that
Parameters related to Straightness Compensation
tions arc preferable to others. Many operators will
agree
Parameters related to Spindle Control although not necessarily
with most of these initial settings,
Parameters related to Tool Offset
with of them. Some settings are customizable by a
all
Parameters related to Canned Cycle
change of a parameter settings. Such settings will become
Parameters related to Scaling and Coordinate Rotation
permanent and create a new 'default'.
Parameters related to Automatic Corner Override
Parameters related to Involute Interpolation
Always document any changes to the parameters!
Parameters related to Uni-directional Positioning |

Parameters related to Custom Macro (User Macro)


Parameters related to Program Restart
24
Chapter 5

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.

For example, a tool motion has three basic modes - a


One alternative is running the CNC program from a per-
rapid motion, a linear motion and a circular motion. The
sonal computer. An inexpensive communication software
default motion setting is controlled by a parameter.
Only and cabling is required to connect the computer with the
one setting can be active at the startup. Which one? The an-
CNC system. The simplest version is to transfer the CNC
swer depends on the parameter setting. Many parameters program from one computer
can be preset to a desired state. Only the rapid or the linear
to the other. More sophisti-
cated possibility includes software and cables that
mode can be can actu-
set as default in the example. Since the rapid ally run the machine from the personal
computer, without
motion is the first motion in the program, it seems to make
sense to make
loading it to the memory of the first. This method is CNC
it a default - but wait! often called 'drip-feeding' or 'bitwise input’. When
oper-
Most controls are set to the linear motion as the default ated from the personal computer, the program can be CNC
as long as the capacity of the storage device,
(GO command), to be in effect at the start - strictly for
I typically the
hard drive.
safety reasons. When the machine axes are moved manu-
ally, the parameter setting has no effect. If a manual input of Most CNC programs will fit into the internal memory of
an axis command
value takes place, either through the pro- the control system. Many controls use the number of avail-
gram or from the control panel, a tool motion results. If the able characters or the equivalent length of tape.
Here are
motion command is not specified, the system will use the some formulas that can be used to get at least the approxi-
command mode that had been preset as the default in the mate memory capacity calculations:
parameters. Since the default mode is a linear motion G01,
the result is an error condition, faulting the system/or
the
lack of a feedrate! There is no cutting feedrate in effect,
O Formula 1 :

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.

It is beneficial to know the default settings of


Sm = Nc x .00254
all controls
in the shop. Unless there is a good reason to do otherwise,
defaults for similar controls should be the same. US’ where . .

Memory Capacity Sm = Storage capacity in meters


Nc = Memory capacity (number of characters)
CNC programs can be stored in the control memory. The
program size is only limited by the capacity of the control. O Formula 2
This capacity is measured in a variety of ways, originally as
To find the length of program in feet, when the capacity is
the equivalent length of tape in meters or feet, lately as the
known in characters, use the following formula:
number of bytes or the number of screen pages. A common
minimum memory capacity of a CNC lathe control is 20 m
ol tape (66 This
an old fashioned method that some-
ft). is
- Nc
s
how persisted in staying with us. On CNC milling systems, °f
120
the memory requirements based on the same criteria are
generally larger and the typical minimum memory capacity
is 80 m or about 263 It. Optionally, larger memory capacity tar where . .

can be added to the control system. The minimum memory


capacity of the control varies from one machine to another - S, = Storage capacity in feet
always check control specifications carefully. Nc = Memory capacity (number of characters)
CONTROL SYSTEM 25

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-

r m other. This continuity is important for production, but not


v—
practical when proving a new program, for example.
.00254
To disable the continuous program execution, a Single
Block switch is provided on the operation panel. In the sin-
i® where
1

. .
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

axes active at the time. This feature is convenient


all

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 . .

feedhold switch will be illuminated (in red light), as long as


C = Number of available characters it is effective. The CNC
programmer can override the feed-
f = Memory capacity in feet hold from within the program, for special purposes.

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.

Pressing the emergency stop button is not always the best


If a program needsbe interrupted in the middle of pro-
to or even the only way to stop a machine operation. In fact,
cessing, the control system offers several ways to do that, the latest controls offer other features, far less severe, de-
using the machine operation panel. The most common fea- signed to prevent a collision between a cutting tool and the
tures of this type are toggle switches or push buttons for a part or fixture. Previously discussed feedhold button is only
single block operation, feedhold and the emergency stop. one option, along with other features. If the emergency stop
must be used at all, it should be used as the last resort, when
Single Block Operation any other action would require unacceptably longer time.
ma- There is no need for panic, if something does go wrong.
The normal purpose of a program is to control the

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.

During setup, the rapid motion rate may require some


PROGRAM DATA OVERRIDE program proving, when high rapid rates are un-
control for
comfortable to work with. After the program had been
All CNC units are designed with a number of special ro-
proven, rapid rate can be applied at its maximum. ma- CNC
tary switches that share one common feature - they allow chines are equipped with a rapid override switch to allow
the CNC operator to override the programmed speed of the temporary rapid motion settings. Located on the control
spindle or the programmed speed of the axis motion. For panel, this switch can be set to one of the four settings.
example, a 15 in/min feedrate in the program produces a Three of them are marked as the percentage of the maxi-
slight chatter. A knowledgeable operator will know that by mum rate, typically as 100%, 50% and 25%. By switching
increasing the feedrate or decreasing the spindle speed, the to one of them, the rapid motion rate changes. For example,
chatter may be eliminated. It is possible to change the if the maximum 500 in/min or 2700 mm/min,
rapid rate is 1

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

(changes cutting motions to a variable speed) are aware of the changes.


CONTROL SYSTEM 27

Spindle Speed Override Feedrate Override

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

by using the spindle speed override switch located on the ,


controls, the feedrate is programmed in in/rev or in mm/rev.

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.

ting, the CNC operator may experiment with the spindle


The new feedrate calculation, based on the overridden
speed override switch to find the optimum speed for the
feedrate setting, is similar to that for spindle speed:
given cutting conditions. This method is a much faster than

‘experimenting’ with the program values.


Fn = F x p x 0.01
p
The spindle speed override switch can be continuous on
some controls or selectable in increments of 10%, typically
US' where
within the range of 50-120% of the programmed spindle
. .

speed. A spindle programmed at 1000 r/min can be over-


F„ = Optimized - or new - feedrate
ridden during machining to 500, 600, 700, 800, 900,. 1000, programmed feedrate
F = Originally
1 100 and 1200 r/min. This large range allows the op- CNC p
= Percentage of feedrate override
p
erator the flexibility of optimizing the spindle rotation to
suit the cutting conditions. There is a catch, however. The Feedrate can be overridden within a large range, typically
optimized spindle speed change may apply to only one tool from 0% to 200% or at least 0% to 150%. When the
of the many used in the program. No CNC operator can be feedrate override switch machine is set to 0%, the CNC
expected to watch for that particular tool and switch the will stop the cutting motion. Some CNC machines do not

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.

tool, write it down, then change the program accordingly,


100% spindle override There are situations, where the use of a feedrate override
so cdl the tools can be used at the
would damage the part or the cutting tool - or both. Typical
setting for production.
examples are various tapping cycles and single point
Comparison of the increments on the spindle override threading. These operations require spindle rotation syn-
switch with the increments on switches for the rapid tra- chronized with the feedrate. In such cases, the feedrate
verse override (described earlier) and the feedrate override override will become ineffective. The feedrate override will
(described next), offers much more limited range. The rea- be effective, if standard motion commands GOO and G01
son for the spindle speed range of 50% to 120% is safety. are used toprogram any tapping or tread cutting motions.
To illustrate with a rather exaggerated example, no operator command G32, tapping fixed cycles
Single point threading
would want to mill, drill or cut any material at 0 r/min (no G74 and G84, as well as lathe threading cycles G92 and
spindle rotation), possibly combined with a heavy feedrate. G76 have the feedrate override cancellation built into the

software. All these and other related commands are de-


order to change the selected override setting into 100%
In
scribed later in the handbook, in more detail.
speed in the program, a new spindle speed has to be calcu-
lated. If a programmed spindle speed of 1200 r/min lor a Dry Run Operation
tool is always set to 80%, itshould be edited in the program
to 960 r/min, then used at 100%. The formula is quite sim- Dry run is a special kind of override. It is activated from

ple: x- the control panel by the Dry Run switch. only has a direct It

effect on the feedrate and allows much higher feedrate than


thatused for actual machining. In practice, it means the
Sn = Sp X p X 0.01
program can be executed much faster than using a feedrate
override at the maximum setting. No actual machining
csr where . .
takes place when the dry run switch is in effect.

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

and the dry run is used as well, it is very


the holding device Sequence Return
important to provide sufficient clearances. Usually, it
means moving Sequence Return is a function controlled by a switch or a
the tool away from the part. The program is
then executed ‘dry’, without actual cutting, without a cool- key on the control panel. Its purpose is to enable the CNC
operator to start a program from the middle of an inter-
Because of the heavy feedrates in the dry
ant, just in the air.
rupted program. Certain programmed functions are memo-
run, the part cannot he machined safely. During a dry run,
the program can be checked for all possible errors except rized (usually the last speed and feed), others have to be in-

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' '

>

group. These functions are:

Z Axis Neglect

Another very useful tool for testing unproven programs


Miscellaneous functions lock Locks M functions
on CNC machining centers (not lathes) is a toggle switch Spindle functions lock Locks S functions
located on the operation panel called the Z Axis Neglect or
ZAxis Tool functions lock
Ignore. As either name suggests, when this switch is
Locks T functions
activated, any motion programmed for the Z-axis will not
be performed. Why the Z axis? Since the X and Y axes are
As described later in this chapter, auxiliary functions
used to profile a shape of the part (the most common con-
touring operations), it would make no sense to temporarily
generally relate to the technological aspects of the CNC
programming. They control such machine functions as
cancel either one of these axes. By neglecting (disabling)
spindle rotation, spindle orientation, coolant selection, tool
the Z axis temporarily, the CNC operator can concentrate
changing, indexing table, pallets and many others. To a
on proving the accuracy of the part contour, without worry-
lesser degree, they also control some program functions,
ing about the depth. Needless to say, this method of pro-
such as compulsory or optional program stop, subprogram
gram testing must take place without a mounted part (and
flow, program closing and others.
normally without a coolant as well). Be careful here! It is
important to enable or disable the switch at the right time. When the auxiliary functions are locked, all machine re-
If the. 7. axis motion is disabled before the Cycle Start key is lated miscellaneous functions M, all spindle functions S
pressed, all following Z axis commands will be ignored. If and all tool functions T will be suspended. Some machine
the motion enabled or disabled during program process-
is tool manufacturers prefer the name M ST Lock rather than
ing, the position of the Z axis may be inaccurate. Auxiliary Functions Lock. The MST is an acronym of the
firstletters from the words Miscellaneous Spindle and
The Z axis neglect switch may be used in both the manual Tool referring to the program functions that will be locked.
,

and automatic modes of operation. Just make sure that the


motion along the Z axis is returned to the enabled mode, The applications of these locking functions arc limited to
once the program proving is completed. Some CNC ma- the job setup and program proving only and are not used for
chines require resetting of the Z axis position settings. production machining.

Manual Absolute Setting - Machine Lock


If this feature is installed on the control (some controls Machine Lock function is yet another control feature for
use it automatically), it enables the CNC operator to re- program proving. So far, we have looked at the Z axis Ne-
sume a program in the middle of processing. Manual abso- glect function and the locking of the auxiliary functions.
lute can save time, particularly when processing long Remember that the Z axis Neglect function will disable the
programs. Manual Absolute setting switch is not a typical motion of the Z axis only and the Auxiliary Functions Lock
option. To some extent, it is functionally related to the Se- (also known as the MST lock ) locks the miscellaneous
quence Return setting. Check
machine tool documenta-
the functions, the spindle functions and the tool functions. An-
tion before using either of these two features. other function, also available through the control panel, is
called the Machine Lock. When this function is enabled,
the motion of all axes is locked. It may seem strange to test
CONTROL SYSTEM
29

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.

Practical Applications SYSTEM OPTIONS


Many of the control features described in this chapter, are
used in conjunction with each other. A good example is
Optional features on a CNC system are like options on a
car. What is an option atone dealership, maybe a standard
Dry Run used conjunction with the Z axis Neglect or the
in
feature at another. Marketing strategies and corporate phi-
Auxiliary Functions Lock. By knowing what function are
losophies have a lot to do with this approach.
available, the CNC operator makes a choice to suit the
needs of the moment. There are many areas of equal impor- Here is a look at some control features that may or may
tance on which the CNC
operator has to concentrate when not be classified as optional on a particular system. But
setting up a new job or running a new program. Many fea- some important disclaimer first:
tures of the control unit are designed to make the operator’s
job easier. They allow concentration on one or two items at This handbook covers the subject matter relating
a time rather than the complexity of the whole program. to the majority of control features, regardless of whether they
These features have been covered in a reasonable detail, are sold as a standard or an optional feature of the system.
now is the time to look at some practical applications. It is up to the user to find out what exact options are installed
on a particular control system.
During the initialization of a new program run, a good
CNC operator will take certain precautions as a matter of Graphic Display
fact. For example, the first part of the job will most likely be

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

In-Process Gauging Machining Cycles

Both the milling and the turning controls offer a variety


During many unattended machining operations, such as
manufacturing, a periodic of machining cycles. Typical machining cycles for milling
in manufacturing cells or Agile
operations are called fixed cycles, also known as the canned
chocking and adjusting dimensional tolerances of the part
wears out. or perhaps be cycles. They simplify simple point-to-point machining op-
is imperative. As the cutting tool
dimensions may fall into the erations such as drilling, reaming, boring, backboring and
cause of other causes, the
‘out-of-tolerance’ zone. Using a probe device and a suitable tapping. Some CNC systems also offer cycles for face mill-

ing, pocket milling, hole patterns, etc.


program, the In-Process Gauging option offers quite a sat-

isfactory solution. The CNC part program for the


CNC lathes also have many machining cycles available
In-Process Gauging option will contain ^ome quite unique finish-
to remove material by automatic roughing, profile
format features - it will be written parametrically, and
will
ing, facing, taper culling, grooving and threading. Fanuc
Custom
be using another option of the control system
- the
controls call these cycles Multiple Repetitive Cycles.
Macros (sometimes called the User Macros), which offer
programming. All these cycles are designed for easier programming
and
the variable type
control
faster changes at the machine. They are built
in the
If a company or a CNC
machine shop is a user of the In-
and cannot be changed. Programmer supplies the cutting
other
Process Gauging option, there are good chances that values during the program preparation by using the
appro-
to the CNC
control options are also installed and available priate cycle call command. All the processing is done
auto-
programmer. Some the most typical options are probing
by the CNC system. Of course, there will always
ol
matically,
management, macros, etc. This technol-
software, tool life
be special programming projects that cannot use any cycles
ogy goes a too far beyond standard CNC program-
be programmed manually or with the use of an
little
and have to
ming* although closely related and frequently used.
it is
external computer.
Companies that already use the numerical control technol-
options to re-
ogy, will be well advised to look into these Cutting Tool Animation
main competitive in their field.

Many of the graphic tool path displays defined earlier, are


Stored Stroke Limits represented by simple linesand arcs. The current tool posi-
tion usually the location of the line or arc endpoint on the
Definition of an area on a CNC lathe or a cube on a CNC is

screen. Although this method of displaying the


motion of
machining center that is safe to work within, can be stored the cutting tool graphically is certainly useful, there are two
stored stroke limit.
as a control system parameter called disadvantages to it. The shape of the cutting tool and the
These stored stroke limits are designed to prevent a colli- material being removed cannot be seen on the screen and
a
sion between the cutting tool and a fixture, the
machine tool
tool path simulation may help a bit. Many
modern controls
or the part. The area (2D) or the cube (3D) can
be defined
incorporate a graphic feature called Cutting Tool Anima-
for the cut-
as either enabled for the cutter entry or disabled tion. If available on the control, it shows the
blank of the
ter entry. It can be set manually on the
machine or, if avail- As the pro-
part, the mounting device and the tool shape.
one
able, by a program input. Some controls allow only gram executed, the
is CNC
operator has a very accurate vis-
area or cube to be defined, others allow more. ual aid in program proving. Each graphic
element is identi-
fied by a different color, for even a better
appearance. The
When this option is ineffect and the CNC unit detects a
blank mounting device and the
size, the tool shape can be
motion in the program that takes place within the forbidden
preset for exact proportions and a variety of tool shapes can
zone, an error condition results and the
machining is inter-
be stored for repetitive use. This option is a good
example
rupted. A typical applications may include
zones occupied
control
a chuck, a rotary table, and even an of CAD/CAM-like features built into a stand-alone
by a tailstock, a fixture,
system.
unusually shaped part.

Connection to External Devices


Drawing Dimensions Input
pro- The CNC computer can be connected to an external de-
An option that seems somewhat neglected, is the
input of the dimensions from vice, usually another computer. Every CNC unit has one or
gramming method by using
known coordi- more connectors, specifically designed for interfacing to
an engineering drawing. The ability to input
given angles directly from the peripheral devices. The most common device is called
nates, radii, chamfers and
some- RS-232 (EIA standard), designed for communications be-
drawing makes it an attractive option. This ability is
program portability. Such an tween two computers. Setting up the connection with exter-
what overshadowed by poor CNC operator
the shop, in or- nal devices is a specialized application. The
option must be installed on all machines in
other set-
uses such a connection to transfer programs and
der to use the programmed features efficiently.
and
computers, usually for storage
tings between two
backup purposes.
6 PROGRAM PLANNING

The development of any CNC


program begins with a The initial part information is not limited to the drawing
very carefully planned process. Such a process starts with and the material data - it also includes conditions not cov-
the engineering drawing (technical print) of the required ered in the drawing, such as pre- and post- machining,
part released for production. Before the part is machined, grinding allowances, assembly features, requirements for
several steps have to be considered and carefully evaluated. hardening, next machine setup, and others. Collecting all
The more effort is put into the planning stage of the this information provides enough material to start planning
program, the better results may be expected at the end. the CNC program.

STEPS IN PROGRAM PLANNING MACHINE TOOLS FEATURES


The program planning are decided by
steps required in No amount of initial information is useful if the CNC
the nature of the work.There is no useful formula for all the machine is not suitable for the job. During program plan-
jobs, but some basic steps should be considered: ning, programmer concentrates on a particular machine

Initial information / Machine tools features


tool, using a particular CNC system. Each part has to be
setup in a fixture, the CNC machine has to be large enough
Part complexity to handle the sizeof the part, the part should not be heavier
Manual programming / Computerized programming
than the maximum
weight allowed. The control system
must be capable to provide the needed tool path, and so on.
Typical programming procedure
In most cases, the CNC equipment is already available in
Part drawing Engineering data
/
the shop. Very few companies go and buy a new CNC ma-
Methods sheet / Material specifications chine just to suit a particular job. Such cases are rather rare
and happen only if they make economic sense.
Machining sequence

Tooling selection Machine Type and Size


Part setup The most important considerations in program planning

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.

The keyword in the acronym CIM is - integration. It


means putting all the elements of manufacturing together
TYPICAL PROGRAMMING PROCEDU RE
and work with them as a single unit and more efficiently.
The main idea behind a successful integration is to avoid Planning of a CNC program is no different than any other
duplication. One of the most important rules of using a planning - at home, at work, or elsewhere -
it must be ap-

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

visions, special instructions, etc. Data in the title block sup-


PART DRAWING ply crucial information for CNC programming and can be
used for program documentation to make easier cross ref-
The part drawing is the single most important document erencing. Not all title block information is needed in pro-
used in CNC programming. It visually identifies the shape, gramming, but may be used for program documentation.
dimensions, tolerances, surface finish and many other re-
quirements for the completed item. Drawings of complex Revision dates in a drawing arc associated with the title
parts often cover many sheets, with different views, details block. They are important to the programmer, as they indi-

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,

velopment of a particular program. Unfortunately, many


drafting methods do not reflect the actual manufac- CNC Dimensioning
designer's thinking rather
turing process. They reflect the ,

drawing arc either in English or


drawings gen- Dimensions on the part
than the method of manufacturing. Such are
metric dimensions
units. Individual can be referenced from
erally correct in technical sense, but they are harder to study can be consecutive, measured
a certain datum point or they
by the programmer and may need to be interpreted’ to be dimension. Often, both types ol dimen-
from the previous
of any value in CNC programming. Typical examples
are
sions are mixed in the same drawing. When writing the
methods of applying dimensions, absence of a datum point
program, it may be more convenient to translate all con-
that can be used as a program reference point and
the view
secutive or incremental
- - dimensions into datum - or abso-
orientation in drawn. In the CAD/CAM
which the part is
lute dimensions.
- Most CNC programs benefit from draw-
environment, the traditional gap between the design, draft- dimensioning. Similarly,
ings using datum, or absolute
ing and CNC programming must be eliminated. Just as
it

when developing a subprogram for tool path translation, an


helps the programmer to understand designer’s intentions,
CNC incremental method of programming may be the right
it helps the designer to
understand the basics of pro-
choice - and the choice depends on the application. The
gramming. Both, the designer and the programmer have to for CNC machines
most common programming method
understand each other’s methods and find common ground method (Figure 6-2),
uses the absolute dimensioning
that makes the whole process of design and
manufacturing
mainly because of the editing ease within the CNC system.
coherent and efficient.

Title Block

The block - Figure 6-1 - is typical to all professional


title

drawings. Its purpose is to collect all the descriptive infor-


mation related to the particular drawing.

Figure 6-2

Program using ABSOLUTE dimensions


Only one change in the program is necessary

With the absolute system of dimensioning, many pro-


Figure 6-
gram changes can be done by a single modification. Incre-
mental method requires at least two modifications. The dif-
A title block example of an engineering drawing
ferences between the two dimensioning systems can be

The and contents of a title block vary between com-


size
compared in Figure 6-2, using the absolute dimensioning
panies, depending on the type of manufacturing and inter-
method, and in Figure 6-3, using the incremental dimen-
usually a rectangular box, positioned in sioning method. The word incremental is more common in
nal standards. It is

the corner of the drawing, divided into several small boxes.


CNC, in drafting the equivalent word would be relative.
The contents of the title block include such items as the part Both illustrations show the a) figure before revision, and
the b) figure after revision.
name and part number, drawing number, material data, re-
PROGRAM PLANNING
35

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?

a There are some choices. The dimension on the high side


may be programmed as X75.0 and X74.95 on the low side
70 — ^ of the range. A middle value of X74.975 is also a choice.
u
( 4Q a 1
t)U
Each selection is mathematically correct. A creative CNC
i 1 programmer looks not only for the mathematical points,
but for the technical points as well. The cutting edge of a
b tool wears out with more parts machined. That means the
machine operator has to fine-tune the machined size by us-
Figure 6-3
ing the tool wear offsets, available on most CNC systems.
Program using INCREMENTAL dimensions
Such a manual interference during machining process is
Two (or more) changes in the program are necessary
acceptable, but when done too often, it slows down the pro-
Fractions duction and adds to the overall costs.

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

For quality precision machining work, most part dimen-


sions have a specified range of acceptable deviation from
the nominal size, within its system of reference. For exam-

ple,an English tolerance of +.001/-.000 inches will be dif-


ferent from a metric tolerance of +0.1/-0.0 mm. Dimen-
sions of this type are usually critical dimensions and must
be maintained during CNC machining. It may be true that
the CNC operator is ultimately responsible for maintaining
the part sizes within the tolerances (providing the program
is correct) - but it is equally true, that the CNC programmer
can make the machine operatos’s task easier. Consider the
following example for a CNC lathe: Surface finish marks in a drawing:
English (top) and metric (bottom)
36 Chapter 6

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.

Many drawing instructions use a special pointer called a


leader. Usually it is a line, with an arrow on the end, point- Material Uniformity
ing towards the areq that it relates to. For example, a leader
may be pointing to a hole, with the caption: Another important consideration, often neglected by pro-
grammers and managers alike, is the uniformity of material

({>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

T01 = Spot Drill T02 = Drill T03 = Tap


Hole 1 Hole 4 Hole 1
For a metric calculation, the formula is similar:
Hole 2 Hole 3 Hole 2
. 1000 x m/min Hole 3 Hole 2 Hole 3
r/min =
71 X D Hole 4 Hole 1 Hole 4
Figure 6-5

US' where ...


Typical machining sequence
(spot drill, drill and tap shown as an example)
r/min = Revolutions per minute (spindle speeds)
12 = Converts feet to inches This machining sequence may have to be changed after
1000 = Converts meters to millimeters the final selection of tools and the setup method. The re-
ft/min = Peripheral speed in feet per minute verse sequence may not be practical in subprograms.
m/min = Peripheral speed in meters per minute
7t(pi) = Constant value of 3.141593... Program planning is not an independent execution of in-
D = Tool diameter (milling) or dividual steps - it is a very interdependent and very logi-
part diameter (turning) - in inches or mm cally coherent approach to achieve a certain goal.
38 Chapter 6

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 -

programmer should know well all general principles of cut-


ting tool applications. In many cases, a tooling representa- TECHNOLOGICAL DECISIONS
tive may provide additional valuable assistance.

The arrangement of tools in the order of usage is also a


The next stage of CNC program planning involves the se-
lection of spindle speeds, cutting feedrates, depth of cut,
subject of serious consideration in CNC program planning.
coolant application, etc. All of the already considered fac-
On CNC lathes, each cutting tool is assigned to a certain
tors will have their influence. For example, the available
turret station, making sure the distribution of tools is bal-
range of spindle speeds is fixed for any CNC machine, the
anced between short and long tools (such as short turning
size of the cutter and the type of material will influence
tools versus long boring tools). This is important for the
speeds and feeds, the power rating of the machine tool will
prevention of a possible interference during cutting or tool
help determine what amount of material can be removed
changing. Another concern should be the order in which
each cutting tool is called, particularly for machines that do
safely, etc. Other factors that influence the program design
include tool extensions, setup rigidity, cutting tool material
not have a bi-directional tool indexing. Most machining
and its Not to be overlooked is the proper selec-
condition.
centers use a random type tool selection, where the order of
tion of cutting fluids and lubricants - they, too, are impor-
tools is unimportant, only the diameter of the tool and its
tant for the part quality.
weight has to be considered.

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

Most contouring operations require more than just one


cutting motion, for example, roughing and finishing. Part
of the programming process is to isolate the area that needs
roughing. Can one cutting tool do both operations? Can all
tolerances be maintained? Is the tool wear a problem? Can
the surface finish be achieved? When programming non-
cutting rapid motions, take the same care as with cutting
motions. A particular focus should be to minimize rapid
tool motions and ensure safe clearances.

Machine Power Rating


Contouring tool path motion - as intended (lathe or mill) Machine tools are rated by their power. Heavy cuts re-
quiremore power than light cuts. A depth or width of a cut
that is too large can break the tool and stall the machine.
The tool path for all profiling tools has to take into con-
sideration the cutter radius, either by programming Such cases are unacceptable and must be prevented. The
the
equidistant path for the center of the radius or by using cut-
CNC machine specifications list the power rating of the
motor at the machine spindle. The rating is in kW (kilo-
ter radius offset. CNC machines for milling and turning are
watts) or HP (horsepower). Formulas are available for
provided with rapid motion, linear interpolation and circu-
power ratings, calculating metal removal rate, tool wear
lar interpolation, all as standard features. To generate more
complex paths, such as a helical milling motion, a special factors, etc. Useful is the comparison of k and HP (based
on HP = 550 foot-pounds per second):
1
option has to be available in the control unit. Two groups of
typical tool paths exist:
1 kW = 1.341 HP
Point-to-point also called Positioning
1 HP = 0.746 kW
Continuous also called Contouring

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.

Water soluble oil is the most common coolant. A prop-


erly mixed coolant dissipates heat from the cutting edge
and it also acts as a lubricant. The main purpose of lubrica-
tion is to reduce friction and make the metal removal easier.
The Hood of the coolant should aim at the tool cutting edge,
with a flexible pipe or through a coolant hole in the tool.

Never use plain water as a coolant -


Contouring tool path motion with identified contour change points it may severely damage the machine tool

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

from congested areas, such as deep holes and cavities.


A calculation sketch can be done directly in the drawing
or on paper. Every sketch is associated with mathematical
The benefits of cutting fluids far outweigh their incon- calculations. Using color coding or point numbering as
veniences. Cutting fluids are often messy, the cutting edge identification methods offers benefits and better organizat-

cannot be seen, operator may


wet and sometimes old
get ion. Rather than writing coordinates at each contour change

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.

WORK SKETCH AND CALCULATIONS


Manually prepared programs require some mathematical
program preparation intimidates
calculations. This part of
many programmers but is a necessary step. Many complex
contours will require more calculations, but not more com-
^——
Figure 6-8
plex calculations. Almost any math problem in CNC pro-
gramming can be solved by the use of arithmetic, algebra Coordinate sheet example - blank form (no data)
and trigonometry. Advanced fields of mathematics - ana-
lytic geometry, spherical trigonometry, calculus, surface
Such a sheet can be used for milling or turning, by filling

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.

programming system is necessary. even those that do not change. A com-


Fill-in all values,
pleted coordinate sheet is a better reference - Figure 6-9.
Those who can solve a can make cal-
right angle triangle
culations for almost any CNC
program. At the end of the Position X axis Y axis Z axis
handbook is an overview of some common math problems. START X4.275 Y3.22
When working with more difficult contours, it is often not PI X4.155 Y3.01
the solution itself that is difficult, it is the ability to arrive at P2 X4.7878 Y3.01
the solution. The programmer must have the ability to see P3 X5.1668 Y2.755
exactly what triangle has to be solved. It is not unusual to
P4 X5.1668 Y2.456
do several intermediate calculations before the required co-
P5 X5.44 Y2.1833
ordinate point can be established.
P6 X6.09 Y2.1833
Calculations of any type often benefit from a pictorial END X6.09 Y2.575
representation. Such calculations usually need a working
sketch.The sketch can be done by hand and should be done
Figure 6-9
inan approximate scale. Larger sketch scales are easier to
work with. Scaling the sketch has one great advantage - you Coordinate sheet example - filled form for milling tool path

can immediately see the relationships what dimensions -

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

A CNC program is composed of a series of sequential in- Digits


structions related to the machining of a part. Each instruc-
tion is specified in a format the CNC system can accept, in- There are ten digits, 0 to 9, available for use in a program
terpret and process. Each instruction must also conform to to create numbers. The digits are used in two modes - one
the machine tool specifications. This input method of a pro- for integer values (numbers without a decimal point), the

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

same control system. This is common, considering the spe-


The 26 letters of the English alphabet are all available for
cific demands individual machine builders place upon the
programming, at least in theory. Most control systems will
control manufacturer to accommodate many original and
accept only certain letters and reject others. For example, a
unique machine design features. Such variations are usu-
ally minor but still important for programming.
CNC lathe control will reject the letter Y, as the Y axis is

unique to milling operations (milling machines and ma-


chining centers). Capital letters are normal designation in
BASIC PROGRAMMING TERMS CNC programming, but some controls accept low case let-
ters with the same meaning as their upper case equivalent.
The field of CNC has its own terminology and special
terms and its jargon. It has own abbreviations and ex-
its If in doubt, use CAPITAL letters only!

pressions that only the people in the field understand. CNC


programming is only a small section of the computerized Symbols
machining and it has a number of its own expressions. The
Several symbols are used for programming, in addition to
majority of them relate to the structure of the program.
the digits and letters. The most common symbols are the
There are four basic terms used in CNC programming. decimal point, minus sign, percent sign, parenthesis and
They appear in professional articles, books, papers, lec- others, depending on the control options.
tures and so on. These words are the key to understanding
the general CNC terminology; Word
A program word a combination of alpha-numerical
Character ^ Word - Block -4 Program
is
characters, creating a single instruction to the control sys-
tem. Normally, each word begins with a capital letter that is
Each term is very common and important in CNC pro- followed by a number representing a program code or the
gramming and deserves its own detailed explanation. actual value. Typical words indicate the axes position, fee-
drate, speed, preparatory commands, miscellaneous func-
Character tions and many other definitions.

A character is the smallest unit of CNC program. It can Block


have one of threeTorms:
Just like the word
used as a single instruction to the
is
Digit CNC system, is used as a multiple instruction. A
the block

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

In the control system, each block must be separated from


Characters
all others. To separate blocks in the MDI (Manual Data In-
-
put) mode each block has to end with a spe-
at the control, 6 F .

cial End-Of-Block code (symbol). This code is marked as


EOB on the control panel. When preparing the program on Words
a computer, the Enter key on the keyboard will terminate
the block with the same result (similar to the old Carriage F275.0 G 0 1 N 5
Return on typewriters). When writing a program on paper
first, each program block should occupy only a single line Block
of sin-
on the paper. Each program block contains a
gle instructions that are executed together.
series
N5G01Y-6 48F275 . .

Program Figure 7-

Typical word address programming format


The program structure varies for different controls,
part
but the logical approach does not change from one control The address - the letter - in the block defines the meaning
to another. A CNC program usually begins with a program of the word and must always be written first. For example,
number or similar identification, followed by the blocks of X5.75 is correct, 5.75X is not. No spaces (space characters)
instructions in a logical order. The program ends with a are allowed within a word but they are only allowed before
stop code or a program termination symbol, such as the the word, meaning before the letter.
percent sign - %. Internal documentation and messages to
the operator may be placed in strategic places within the Data indicates the word numerical assignment. This
program. The programming format has evolved signifi- value varies greatly and depends on the preceding address.
cantly during the years and several formats have emerged. Itmay represent a sequence number N, a preparatory com-
mand G, a miscellaneous function M, an offset register
PROGRAMMING FORMATS number D or H, a coordinate word X, Y or Z, the feedrate
function F. the spindle function S, the tool function T, etc.

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

u Fixed Format NC only - no decimal point GO 1 Preparatory conunand

Word Address Format NC or CNC - decimal point M30 Miscellaneousfunction

D2 5 Offset number selection - mills


Only the very early control systems use the tab sequen-
X5 7 5. Coordinate word - jwsith’e value
tial them disappeared in the early
or fixed formats. Both of
1970’s and are now obsolete. They have been replaced by N1 0 5 Sequence number (bloc k number)

the much more convenient Word Address Format. HO 1 Tool length offset number

YO Coordinate word -zero value

WORD ADDRESS FORMAT S2500 Spindle speedfunction

Z-5.14 Coordinate word - negative value

The word address format is based on a combination of F12 0 . Feedratefunction


one letter and one or more digits - Figure 7-1. T0505 Toolfunction -lathes

In some applications, such a combination can be supple- TO 5 Toolfimetion - mills

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 . .

the notation means that the address value cannot be nega-


N25 Sequence or block number
tive a lack of sign means a positive value by implication.
-

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

The control any one block as a complete unit


will process F5 Five digits maximum, no decimal point or sign

- never partially. Most controls allow a random word order


F3.2 Five digits maximum, three digits maximum in front of
in a block, as long as the block number is specified first. the decimal point, two digits maximum behind the
decimal point, decimal point is allowed, no sign is used

FORMAT NOTATION Be careful when evaluating the shorthand notations from


a manual. There are no industry standards and not all con-
Each word can only be written in a specific way. The trol manufacturers use the same methods, so the meaning

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

notation and the third column is a description:


Short Forms

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)

Described address Arc center modifier for X axis


Shift amount in fixed cycles (X)
1
Figure 7-2 Corner vector selection for
Word address format notation X axis format in - metric mode shown X axis (old type of controls)

Arc center modifier for Y axis


The format description for each meaning would be
full
J+4.4 Shift amount in fixed cycles (Y)
unnecessarily too long. Consider the following complete J
(J+5.3) Corner vector selection for
and not abbreviated description of the address X - as a coor- Y axis (old type of controls)
dinate word that is used in the metric system:
Chapter 7

Address Notation Description Address Notation Description

K+4.4 D4 Number of divisions in G73


K Arc center modifier for Z axis
(K +- 5.3)
D Depth of cut in G71 and G72

L L4
Fixed cycle repetition count
Subprogram repetition count
E
EaE2.6
Relief amount in G74 and G75
Depth of first thread in G76

Precision feedrate for threading


Miscellaneous function

F F2.6 Feedrate function - may vary


Block number or sequence number
G G2 Preparatory commands
Program number (EIA)
0 04
or(:4 for ISO) Arc center modifier for X axis
Taper height in X for cycles
Subprogram number call 1+4.4
P4 1
X axis relief in G73
Custom macro number call (1+5.3)
Direction of chamfering

P P3 Work offset number - used with G10 Motion amount in X in G74


Arc center modifier for Z axis
P53 Dwell time in milliseconds
Taper height in Z for cycles
Block number in main program when K+4.4 Z axis relief in G73
P5 K
used with M99 (K+5.3) Direction of chamfering
Motion amount in Z in G75
Q4.4 Depth of peck in fixed cycles Thread depth in G76

m (Q5.3) G73 and G83


L 14 Subprogram repetition count
Q
amount in fixed cycle
Shift
G76 and G87 M2 Miscellaneous function

Retract point in fixed cycles N N5 Block number or sequence number


R Arc radius designation Program number (EIA)
0 04
or (:4 for ISO)
S S5 Spindle speed in r/min
Subprogram number call

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

S S5 Spindle speed in r/min or ft/min


Z+4.4 Z axis coordinate value

m
Z t—
(Z+5.3) designation T4 Tool function

Incremental value in X axis


Turning System Format U Stock allowance X axis
in

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

Absolute value in X axis


Address Notation Description X
X5.3 Dwell function with G04
Angle of thread for G76
A A3
Angle for direct drawing input
Z axis
C
IB Chamfer for direct drawing input z
ESI Absolute value in

Block number in a subprogram


P5
Startblock number in G71 and G72
PART PROGRAM STRUCTURE
45

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

Positive value or PROGRAM HEADER


+ Plus sign
addition sign in Fanuc macros

Negative value or Comments or messages may be placed in the program,


- Minus sign providing they are enclosed in parentheses. This kind of in
subtraction sign in Fanuc macros
ternaldocumentation is useful to both the programmer and
Multiplication Multiplication sign in
* operator. A series of comments at the program top is de-
sign Fanuc macros
fined as the program header where various program fea-
;

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:

El Parenthesis Program comments & messages (

(FILE NAME 01234. NC)


)

% 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

Non programmable End-Of-Block


(JOB NUMBER
(OPERATION DRILL-BORE-TAP)
4321)

Semicolon (STOCK MATERIAL . . . H.R.S. PLATE)


i
symbol (screen display only) (MATERIAL SIZE . . 8X6X2)
Variable definition or call in Fanuc
(PROGRAM ZERO XO - LEFT EDGE)
# Sharp sign
macros
( YO - BOTT EDGE)
( ZO - TOP FACE )
- Equal sign Equality in Fanuc macros (STATUS . . NOT VERIFIED)
( )
Chapter 7
46

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

00701 (ID MAX 15 CHARS) (PROGRAM NUMBER AND ID)


(SAMPLE PROGRAM STRUCTURE) (BRIEF PROGRAM DESCRIPTION)
(PETER SMID - 07 -DEC- 01) (PROGRAMMER AND DATE OF LAST REVISION)
(BLANK LINE)
N1 G20 (UNITS SETTING IN A SEPARATE BLOCK)
N2 G17 G40 G80 G49 (INITIAL SETTINGS AND CANCELLATIONS)
N3 T01 (TOOL T01 INTO WAITING POSITION)
N4 M0 6 (T01 INTO SPINDLE)
N5 G90 G54 GOO X.. Y. S. M03 T02. . (T01 RESTART BLOCK - T02 INTO WAITING POSITION)
N6 G43 Z2.0 H01 M08 (TOOL LG OFFSET - CLEAR ABOVE WORK - COOLANT ON)
(N7 G01 Z-. F. .).
(FEED TO Z DEPTH IF NOT A CYCLE)
( CUTTING MOTIONS WITH TOOL T01 )

N33 GOO G80 Z2 0 M09 .


(CLEAR ABOVE PART - COOLANT OFF)
N34 G28 Z2.0 M05 (HOME IN Z ONLY- SPINDLE OFF)
N35 M01 (OPTIONAL STOP)
( — BLANK LINE —
(TOOL T02 INTO WAITING POSITION - CHECK ONLY)
N36 T02
N37 MO (T02 INTO SPINDLE)
(T02 RESTART BLOCK - T03 INTO WAITING POSITION)
N38 G90 G54 GOO X.. Y. . S.. M03 T03
(TOOL LG OFFSET CLEAR ABOVE WORK - COOLANT ON)
-
N39 G43 Z2.0 H02 M08
(N40 G01 Z-. F. .) .
(FEED TO Z DEPTH IF NOT A CYCLE)
( CUTTING MOTIONS WITH TOOL TO 2 )

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 )

N86 GOO G80 Z2 0 M09 .


(CLEAR ABOVE PART - COOLANT OFF)
N87 G28 Z2.0 M05 (HOME IN Z ONLY - SPINDLE OFF)
N88 G28 X. Y. .
(HOME IN XY ONLY)
N89 M30 (END OF PROGRAM)
% (STOP CODE - END OF FILE TRANSFER)
8 PREPARATORY COMMANDS

The program address G identifies a preparatory com-


mand, often called the G code. This address has one and
O Example C :

only objective - that is to preset or to prepare the control N3 G90 GOO


system to a certain desired condition or to a certain mode ,
N4 ...
or a state of operation. For example, the address GOO pre- N5 ...
sets a rapid motion mode for the machine tool, the address N6 ...
G8I presets the drilling cycle, etc. The term preparatory N7 X13.0 Y10.0
command indicates its meaning - a G code will prepare the
control to accept the programming
the G code in a specific way.
instructions following
O Example D

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

not indicate whether the values are in the English or the


Modal and non-modal G-codes will be described shortly.
metric units. Neither indicates whether the motion to this
it
Each control system has its own list of available G codes.
specified target position is a rapid motion or a linear mo-
Many G codes are very common and can be found on virtu-
tion. If a look at the block cannot establish the meaning of ally all controls, others are unique to the particular control
the block contents, neither can the control system. The sup-
system, even the machine tool. Because of the nature of
plied information in such a block is incomplete therefore ,
machining applications, the list of typical G codes will be
unusable by itself. Some additional instructions for the
different for the milling systems and the turning systems.
block are required.
The same applies for other types of machines. Each group

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 !

block or within the block:

APPLICATIONS FOR MILLING


O Example A :

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

G code Description G code Description

GOO Rapid positioning G52 Local coordinate system setting

G01 Linear interpolation G53 Machine coordinate system

G02 Circular interpolation clockwise G54 Work coordinate offset 1

G03 Circular interpolation counterclockwise G55 Work coordinate offset 2

G04 Dwell (as a separate block) G56 Work coordinate offset 3

G09 Exact stop check - one block only G57 Work coordinate offset 4

GIO Programmable data input (Data Setting) G58 Work coordinate offset 5

G11 Data Setting mode cancel G59 Work coordinate offset 6

5 Polar Coordinate Command cancel G60 Single direction positioning

6 Polar Coordinate Command G61 Exact stop mode

G17 XY plane designation G62 Automatic corner override mode

G18 ZX plane designation G63 Tapping mode

G19 YZ plane designation G64 Cutting mode

G20 English units of input G65 Custom macro call

G21 Metric units of input G66 Custom macro modal call

G22 Stored stroke check ON G67 Custom macro modal call cancel

G23 Stored stroke check OFF G68 Coordinate system rotation

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

Return from machine zero G80 Fixed cycle cancel

G30 Machine zero return (reference point 2) G81 Drilling cycle

G31 Skip function G82 Spot-drilling 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

G43 Tool length compensation - positive G86 Boring cycle

Tool length compensation - negative G87 Back boring cycle

sai Position compensation* single increase G88 Boring cycle

G46 Position compensation - single decrease G89 Boring cycle

G47 Position compensation - double increase G90 Absolute dimensioning mode

G48 Position compensation - double decrease G91 Incremental dimensioning mode

G49 Tool length offset cancel G92 Tool position register

Scaling function cancel G98 Return to initial level in a fixed cycle

Scaling function G99 Return to R level in a fixed cycle


PREPARATORY COMMANDS
49

In any inconsistency between the listed codes in this


G code Description
handbook and the control system manual, the G codes
listed by the control manufacturer must be selected.
I G50

G52
Tool position register /

Local coordinate system setting


Maximum r/min preset

APPLICATIONS FOR TURNING


G53 Machine coordinate system setting

Fanuc lathe controls use three G code group types - A, B G54 Work coordinate offset 1

and C. The Type A is the most common; in this handbook,


G55 Work coordinate offset 2
all examples and explanations are Type A group, including

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

Rapid positioning G62 Automatic corner override mode


GOO

G01 Linear interpolation G64 Cutting mode

Circular interpolation clockwise G65 Custom macro call


G02

Circular interpolation counterclockwise G66 Custom macro modal call


G03

G04 Dwell (as a separate block)


G67 Custom macro modal call cancel

G68 Mirror image for double turrets


G09 Exact stop check - one block only
G69 Mirror image for double turrets cancel
G10 Programmable data input (Data Setting)

Data Setting mode cancel G70 Profile finishing cycle


G11

English units of input G71 Profile roughing cycle - Z axis direction

Metric units of input G72 Profile roughing cycle - X axis direction

G73 Pattern repetition cycle


Stored stroke check ON
G74 Drilling cycle
Stored stroke check OFF
G75 Grooving cycle
Spindle speed fluctuation detection ON
G76 Threading cycle
Spindle speed fluctuation detection OFF
Machine zero position check G90 Cutting cycle A ( Group type A

Machine zero return (reference point 1)


G90 Absolute command (Group type B)

Return from machine zero G91 Incremental command ( Group type B)

G92 Thread cutting cycle (Group type A)


Machine zero return (reference point 2)

G92 Tool position register (Group type B)


Skip function

Threading - constant lead G94 Cutting cycle B (Group type A)

Circular threading CW G94 Feedrate per minute (Group type B)

Circular threading CCW G95 Feedrate per revolution ( Group type B)


G36

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

Interpolation G02 and G03 under Circular Interpolation


, ,
In fact, so is the command for absolute mode, G90. The
etc. In this section, G codes are described in general, re- reason neither GOO nor G90 has been repeated is because
gardless of the type of machine or control unit. both commands remain active from the moment of their
first appearance in the program. The term modal is used to

G CODES IN A PROGRAM BLOCK describe this characteristic.

For a command to be modal, it means has to remain it

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 .

tation during program execution:

This method of program writing several blocks shorter


than the single block alternative:
is
O Example C - modified (as processed)

N3 G90 GOO X50.0 Y30.0


N25 G90 N4 G90 GOO XO
N26 GOO N5 G90 GOO Y200.0
N27 G54 N6 G90 GOO X150.0 Y220.0
N28 X6.75 Y10.5
N7 G90 GOO X130.0 Y100.0

Both methods appear identical during a continuing


will
The program does not have any practical application by
processing. However, the second example, when executed
moving from one location to another at a rapid rate, but it
in a single block mode, each block will require pressing the
demonstrates the modality of preparatory commands. The
Cycle Start key to activate the block. The shorter method is purpose of modal values is to avoid unnecessary duplica-
more practical, not only for its length, but for the logical tion of programming modes. G codes are used so often, that
connection between individual commands within the
writing them in the program can be tedious. Fortunately,
block.
the majority of G codes can be applied only one e, providing
they are modal. In the control system specifications, prepa-
Some and general considerations ap-
rules of application
ply to G
codes used with other data in a block. The most ratory commands are identified as modal and unmodal.
important of them is the subject of modality.
Conflicting Commands in a Block
Modality of G-commands The purpose of preparatory commands is from
to select

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

O Example C - original a cutting motion active at the


have GOO and G01
same
active simultaneously.
time, it is

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

N3 G90 GOO X5.0 Y3 .


This is the exact opposite of the previous example. Here,
N4 XO GOO
the is in the front, therefore the G01 will take prece-
N5 Y20.0
dence and the motion will take place as a cutting motion at
N6 X15.0 Y22.0
the specified feedrate of 20.0 in/min.
N7 X13.0 Y10.0
PREPARATORY COMMANDS 51

Word Order in a Block


GROUPING OF COMMANDS
G codes are normally programmed at the beginning of a
block, after the block number, before other significant data: The example of conflicting G codes in one block brings
one issue to the forefront. It makes sense, for example, that
N40 G91 G01 Z-0.625 F8.5 motion commands such as GOO, GO G02 and G03 cannot I
,

coexist in the same The distinction is not so clear for


block.
This is a traditional order, based on the idea that if the
other preparatory commands. For example, can the tool
purpose of the G codes is to prepare or preset the control
length offset command G43 be programmed in the same
system to a certain condition, the preparatory commands block as the cutter radius offset command G41 or G42?
should always be placed first. Supporting this argument is
The answer is yes, but let’s look at the reason why.
the- fact that only non-conflicting codes arc allowed in a
single block. Strictly speaking, there is nothing wrong with Fanuc control system recognizes preparatory commands
rearranging the order to: by separating them into arbitrary groups. Each group,
called the G code group, has a Fanuc assigned arbitrary
N40 G91 Z-0.625 F8 5 G01 .
two-digit number. The rule governing the coexistence of G
codes in one block is very simple. If two or more G codes
Perhaps unusual, but quite correct. That is not the case from the same group are in the same block, they are in con-
with the next method of positioning a G code in a block: flict with each other.

N40 Z-0.625 F8.5 G01 G91


Group Numbers
Watch for situations like this! What happens in this case is The G code groups are typically numbered from 00 to 25.
that the cutting motion G01, the feedrate F and the depth Z This range varies between different control models, de-
will be combined and executed using the current dimen- pending on the features. It can even be higher for the new-
sional mode. If the current mode is absolute, the Z axis mo- est controls or where more G codes are required. One of
tion will be executed as an absolute value, not an incremen- these groups - the most unique one and perhaps the most
tal value. The reason for this exception is that Fanuc allows important as well the Group
- is 00.
to mix dimensional values in the same block. That can be a
very useful feature, if used carefully. A typical correct ap- All preparatory commands in the 00 group are not modal,

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

milliseconds. needed only for the duration within the


It is

specified time, no longer. There is no logical need to pro-


Blocks N45 through N47 are all in the absolute mode.
gram dwell in two or more consecutive blocks. After all,
Before the block N48 is executed, the absolute position of
what is the benefit of the next three blocks?
the axes X and Y is 1 .0, 1 .0. From this starting position, the
target location is the absolute position of X2.5 combined
N56 G04 P2000
with the incremental motion of 1 .5 inches along the Y axis. N57 G04 P3000
The resulting absolute position will be X2.5Y2.5, making a N58 G04 P1000
45° motion. In this case, the G91 will remain in effect for

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 ...

G04 GO 9G10 M/T


Gil G27 G28 G29 M/T Any G code from a given group automatically
G30 G31 G37 M/T replaces another G code from the same group
G45 G4 6G47 G48 M/T
Unmodal
G52 G53 G65 M/T
G codes
G51 G60 G92 M G CODE TYPES
G50 T
G70 G71 G72 G73 T Fanuc control system offers a flexible selection of pre-
G74 G75 G76 T paratory commands. This fact distinguishes Fanuc from
many other controls. Considering the fact that Fanuc con-
GOO G01 G02 GO 3 M/T
Motion Commands, trols are used worldwide, it only makes sense to allow the
01 G32 G35 G36 T
Cutting Cycles standard control configuration to follow established style
G90 G92 G94 T
of each country. A typical example is the selection of di-
02 Plane Selection G17 G18 G19 M mensional units. In Europe, Japan and many other coun-
M tries, metric system is the standard. In North America, the
G90 G91
Dimensioning Mode common system of dimensioning still uses the English
03
(U and W for lathes) T
units. As both markets are substantial in the world trade, a
04 Stored Strokes G22 G23 M/T clever control manufacturer tries to reach them both. Al-
Feedrate G93 G94 G95 T most all control manufacturers offer a selection of the di-
05
mensional system. But Fanuc and similar controls also of-
06 Units Input G20 G21 M/T fer selection of programming codes that were in effect

Cutter Radius before Fanuc reached the worldwide market.


07 G40 G41 G42 M/T
Offset
The method Fanuc controls use is a simple method of pa-
Tool Length By selecting the specific system parameter,
rameter setting.
08 G43 G44 G49 M
Offset one of two or three G code types can be selected, the one
G73 G74 G76 G80 M that is typical for a particular geographical user. Although
G81 G82 G83 G84 M the majority of the G codes are the same for every type, the
09 Cycles
G85 G86 G87 G88 M most typical illustration are G codes used for English and
G89 M metric selection of units. Many earlier US controls used
G70 for English units and G71 for metric units. Fanuc sys-
10 Return Mode G98 G99 M tem has traditionally used G20 and G21 codes for English
Scaling Cancel, G50 M and metric input respectively.
11
Mirror Image G68 G69 T
Setting up a parameter, theG code type that is the most
Coordinate G54 G55 G56 G57 M/T practical can be selected. Such a practice, if done at all,
12
System G58 G59 M/T should be done only once and only when the control is in-

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
»

Spindle Speed the most common group.


24 G25 G26 M/T
Fluctuation
G Codes and Decimal Point
The group relationship makes a perfect sense in all cases. Many latest Fanuc controls include a G code with a deci-
One possible exception is Group 01 for Motion Commands mal point, for example, G72.1 (Rotation copy) or G72.2
and Group 09 for Cycles. The relationship between these preparatory commands
(Parallel copy). Several in this
two groups is this - if a G code from Group 01 is specified group are related to a particular machine tool or are not typ-
in any of the fixed cycle Group 09, the cycle is immediately
ical enough to be described in this handbook.
canceled, but the opposite is not true. In other words, an ac-
tive motion command is not canceled by a fixed cycle.
g MISCELLANEOUS FUNCTIONS

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

DESCRIPTION AND PURPOSE Spindle stop

In addition to these three possibilities, there is a function


Within the structure of a CNC program, programmers of-
called the spindle orientation, also a machine related func-
ten need some means of activating certain aspects of the
tion. Another example is a coolant. Coolant can only be
machine operation or controlling the program flow. With-
out the availability of such means, the program would be
controlled as being ON or being OFF.
incomplete and impossible to run. First, let’s look at the These operations are typical to most CNC machines. All
miscellaneous functions relating to the operation of the ma- are programmed with an M
function, followed by no more
chine - the true machine functions. than two digits, although some control models allow the
use of a three digit M
function, Fanuc 16/18, for example.
Machine Related Functions
Fanuc also uses the three digit M functions in several spe-
Various physical operations of the CNC machine must be cial applications, for example, for synchronization of two
controlled by the program, to ensure fully automated ma- independent turrets on a 4-axis lathe. All these and other
chining. These functions generally use the M
address and functions are related to the operation of the machine and
include the following operations: belong to the group collectively known as miscellaneous

Spindle rotation CW or CCW functions or simply as the Mfunctions or M codes.


a Gear range change Low /Medium /High Program Related Functions
Automatic tool change ATC In addition to the machine functions, some M
functions
Automatic pallet change APC are used to control the executionof a CNC program. An in-

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-

machine than a CNC machining center or a CNC lathe. A ular application:


numerically controlled EpM wire cutting machine will
Control of the machine functions
have many unique functions, typical to that kind of ma-
chining and those found on no other machine. Control of the program execution

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

TYPICAL APPLICATIONS M04 Spindle rotation reverse

M05 Spindle stop


Before learning the M functions, note the type of activity
these functions do, regardless of whether such activity re- M07 Coolant mist ON
lates to the machine or the program. Also note the abun-
M08 Coolant ON (coolant pump motor ON)
dance of two way toggle modes, such as ON and OFF, IN
and OUT, Forward and Backward, etc. Always check your M09 Coolant OFF (coolant pump motor OFF)
manual first - for the reasons of consistency, all func- M
tions in this handbook are based on the following table: M10 Chuck open

Mil Chuck close


Applications for Milling
M12 Tailstock quill IN

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)


M19 Spindle orientation (optional)

M03 Spindle rotation normal


M21 Tailstock forward

Spindle rotation reverse


M22 Tailstock backward

M05 Spindle stop


ON
M23 Thread gradual pull-out
M06 Automatic tool change (ATC)
M24 Thread gradual pull-out OFF
M07 Coolant mist ON
M30 Program end (always with reset and rewind)
M08 Coolant ON (coolant pump motor ON)
M41 Low gear selection
Coolant OFF (coolant pump motor OFF)
M42 Medium gear selection 1

M19 Spindle orientation


M43 Medium gear selection 2
M30 Program end (always with reset and rewind)
M44 High gear selection
M48 Feedrate override cancel OFF (deactivated)
M48 Feedrate override cancel OFF ( deactivated)
M49 Feedrate override cancel ON ( activated
M49 Feedrate override cancel ON (activated)
M60 Automatic pallet change (APC)
M98 Subprogram call
M78 B axis clamp (nonstandard)
M99 Subprogram end
M79 B axis unclamp (nonstandard)

M98 Subprogram call Special MDI Functions


Subprogram end
M99 Several M functions cannot be used in the CNC program
at all. This group is used in the Manual Data Input mode
Applications for Turning exclusively (MDI). An example of such a function is a step
by step tool change for machining centers, used for service
purposes only, never in the program. These functions are
M code Description outside of the scope of this handbook.

MOO Compulsory program stop


Application Groups
M01 Optional program stop
The two major categories, described earlier, can further

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

Group Typical M-functions


A practical method of programming certain miscellane-
ous functions is in a block that contains a tool motion. For
MOO M01 example, turning the coolant on and - at the same time -
Program
MO 2 M30 moving the cutting tool to a certain part location may be
required. As there is no conflict between the instructions,
MO 3 MO 4 MO
Spindle the block may look something like this:
Ml 9
Tool change MO 6 N56 GOO X12.9854 Y9.474 M08

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?

The miscellaneous functions listed in this chapter are


used throughout the book. Some of them appear more often One of the three options will happen - but which one?

than others, reflecting their general use in programming.


Even if a practical purpose of these examples may not be

The functions that do not correspond to a particular ma-


apparent at this stage, it is useful to know how the control

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)

M FUNCTIONS IN A BLOCK M function activates at the end of a block


(when the tool motion has been completed)

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)


M functions activated at the START OF A BLOCK
M60 Automatic pallet change (APC)
M03 Spindle rotation normal

M04 Spindle rotation reverse


M functions active UNTIL CANCELED or ALTERED
Automatic tool change (ATC)
1
M07 Coolant mist ON M04 Spindle rotation reverse

Coolant ON (coolant pump motor ON) M05 Spindle stop

M07 Coolant mist ON


M functions activated at the END OF A BLOCK M08 Coolant ON (coolant pump motor ON)
M09 Coolant OFF (coolant pump motor OFF)
Compulsory program stop

M01 Optional program stop


The classification is shows some com-
quite logical and
End of program (usually with reset, no rewind) mon sense. There is no need to remember individual M
M02
functions and their exact activities. The best place to find
M05 Spindle stop out for certain, study manuals supplied with the
is to CNC
machine and watch the program run right on the machine.
Coolant OFF (coolant pump motor OFF)

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

mands, however the word modal is not usually used with M


functions.As an example of a function duration, take mis- The control will not be reset when the MOO function is
processed. All significant program data currently active are
cellaneous functions MOO or M01 Either one will be active
.

retained (feedrate, coordinate setting, spindle speed, etc.).


for one block only. The coolant ON function M08,
will be

active until a canceling or an altering function is pro-


The program processing can only be resumed by activating
grammed. Remember, any one of the following functions the Cycle Start key. The MOO function cancels the spindle
rotation and the coolant function - they have to be repro-
will cancel the coolant ON mode - MOO, M01, M02, M09
and M30. Compare these two tables: grammed in subsequent blocks.
MISCELLANEOUS FUNCTIONS 57

The MOO programmed as an individual


function can be In the program itself, issue a comment section with the

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):

with a motion command, the motion will be completed


first, then the program stop will become effective:
[A] N39 MOO (REMOVE CHIPS)

O MOO programmed after a motion command [B] N39 X13.5682 MOO (REMOVE CHIPS)

N38 GOO X13.5682 [C] N38 X13.5682 MOO


N39 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).

mode of pro- The miscellaneous function M01 is an optional or a con-


There will be no practical difference in auto
cessing (Single Block switch set to OFF).
ditional program stop. It is similar to MOO function, with
one difference. Unlike the MOO function, when M01 func-
Practical Usage tion is encountered in the program, the program processing
will not stop, unless the operator interferes via the control
The program stop function used in a program makes the panel. The Optional Stop toggle switch or a button key lo-
CNC operator’s job much easier. It is useful for many jobs. cated on the panel can be set to either ON or OFF position.
One common is a part inspection on the machine, while
use When the M01 function in the program is processed, the
the part mounted. During the stop, the part dimen-
is still setting of the switch will determine whether the program
sions or the tool condition can be checked. Chips accumu- will temporarily stop or continues to be processed:
lated in a bored or drilled hole can be removed, for exam-
ple, before another machining operation can start, such as
Optional Stop switch setting Result of M01
blind hole tapping. The program stop function is also nec-
essary to change the current setup in the middle of a pro- ON Processing will stop
gram, for example, to reverse a part. A manual tool change
also requires the MOO function in the program. OFF Processing will not stop

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

usually justified under the circumstances, for example, to


BLOCK N39 REMOVE CHIPS
change the cutting insert or to inspect a dimension or the
surface finish of the part.
58 Chapter 9

Program End Percent Sign

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 . . .

N66 G91 G28 XO YO M30 (END OF PROGRAM) Chip removal


% a Lubrication
MISCELLANEOUS FUNCTIONS 59

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 :

machine may delay the start of the actual flooding.

N110 MO
Spindle Functions

O Example B - coolant is turned ON :


Chapter 12 - Spindle Control, details all aspects of con-
trolling themachine spindle in a CNC program. Miscella-
N340 MO neous functions that are available for the spindle control its
rotation and orientation.
O Example C - coolant is turned OFF :

Most spindles can rotate in both directions, clockwise


N500 MO (CW) and (CCW). The direction of rota-
counterclockwise
tion always relative to a standard point of view. The
is
O Example D - axis motion and coolant ON :
viewpoint is established from the spindle side as the direc-

N230 GOO X11.5 Y10.0 M08


tionalong the spindle center line towards its face. rota- CW
such a view is programmed as M03,
tion in direction CCW
as M04, assuming the spindle can be rotated either way.
O Example E - axis motion and coolant OFF :

The drilling and milling types of machines use this estab-


N400 GOO Z1.0 MO lished convention quite commonly. The same convention is
also applied to CNC lathes. On a CNC milling machine or a
The examples show the differences in the program pro- machining center, it is more practical to look towards the
cessing.The general rules of coolant programming are: part from the spindle side rather than from the table side.
On a lathe (slant bed horizontal type), the more practical
Coolant ON orOFF in a separate block becomes active in
view is from the tailstock towards the spindle because that ,
the block in which it is programmed (Examples A, B and C)
is the closest to how the CNC machine operator stands in

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

an oriented position. This function is used mostly during


M41 Low range
machine setup, seldom in the program. The spindle must be 3 available M42 Medium range
oriented in two main situations: M43 High range

Automatic tool change (ATC)


M41 Low range
Tool shift during a boring operation M42 Medium range 1
4 available
(G76 and G87 boring cycles only) M43 Medium range 2
M44 High range
When the Automatic Tool Change (ATC) function M06 is
used program, there is no need to program the spindle
in the

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.

The spindle orientation is necessary for certain boring Machine Accessories


operations on milling systems. To exit a bored hole with a
boring tool away from the finished cylindrical wall, the The majority of miscellaneous functions is used for some
spindle must be stopped first, the tool cutting bit must be physical operation of the machine tool accessories. From
oriented, aqd then the tool can be retracted from the hole. A this group, the more common applications have been al-

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

Gear Range Selection M06 Automatic tool change (ATC) M

Virtually programmable gear range selections apply to


all M60 Automatic pallet change (APC) M
a CNC On
machining centers, the spindle gear range
lathe.
is automatically changed. Most CNC lathes have two or M23 M24 Thread gradual pull-out ONI OFF T
more gear ranges available, some more powerful lathes are
equipped with up to four selections. The basic program- M98 M99 Subprogram call / Subprogram end M/T
ming rule is to select the gear range based on the machining
application.
10 SEQUENCE BLOCK

Each line of in a CNC program is called a block. In the Block number N


terminology established earlier, a block was defined as a
Preparatory commands G
single instruction processed by the CNC system.
Auxiliary functions M
A sequence block, a program block - or simply a block -
is normally one hand written line in the program copy, or a
Axis motion commands XYZABCUVW..
line typed in a text editor and terminated by the Enter key. Words related to axes 1 J K R Q...
This line can contain one or more program words - words
that result in the definition of a single instruction to the Speed, feed or tool function S F T
CNC machine. Such a program instruction may contain a The contents of the program block will vary between ma-
combination of preparatory commands, coordinate words,
chine tools of different kinds, but logically, the majority of
tool functions and commands, coolant function, speeds and
general rules will always be followed, regardless of the
feeds commands, position registration, offsets of different
CNC system or the machine tool.
kinds, etc. In plain English, the contents of one block will
be processed as a single unit before the control processes
Building the Block Structure
any following block. When the whole CNC program is pro-
cessed, the system will evaluate individual instructions Each block of a CNC program has to be built with the
(blocks) as one complete machine operation step. Each same thoughts and the same care as any other important
program consists of a series of blocks necessary to com- structure, for example a building, a car, or an aircraft. It
plete a certain machining process. The overall program starts with good planning. Decisions have to be made as to
length will always depend on the total number of blocks what will and what will not be part of the program block,
and their si/e. similar to a building, car, aircraft or other structure. Also,
decisions have to be made as to what order of commands -
BLOCK STRUCTURE instructions are going to be established within the block
and many other considerations.

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.

allowed. The order of individual words within a block fol-


lows a fairly free format - that means the required words O Milling block examples:

may be in any order, providing that the sequence block (the


Nil G43 Z2.0 S780 M03 HOI (EXAMPLE 1)
N address) is written as the first address. Although the or-
der of individual words in a block is allowed to be in any or-
N98 G01 X2.15 Y4.575 F13 . 0 (EXAMPLE 2)
der, it is a standard practice to place words in a logical or-
der within a block. It makes the CNC program easier to The first milling example in block N1 1, is an illustration
read and understand.
of a tool length offset block, applied together with the spin-
dle speed and the spindle rotation direction.
A typical program block structure is very dependent on
the control system and the type of the CNC machine. A The second example in block N98, shows a typical pro-
typical block may contain the following instructions, in the
gramming instruction for a simple linear cutting motion,
order suggested. Not all program data are necessary to be
using the linear interpolation method and a suitable cutting
specified every time, only when required.
feedrate.

61
62 Chapter 10

O Turning block examples: rectory more The program descrip-


descriptive and useful.
tion can be read on the display screen and provides an eas-
r
N67 GOO G42 X2 .5 Z0.1 T0202 M08 (EXAMPLE 1) ier identification of each program stored.

N23 G02 X7.5 Z-2.8 RO . 5 F0.012 (EXAMPLE 2) If the program name is longer than the sixteen characters

recommended, no error is generated, hut only the first six-


In the lathe examples, block N67 illustrates a rapid mo- teen characters will be displayed. Make sure to avoid pro-
tion to an XZ position, as well as a few other commands - gram names that can be ambiguous when displayed. Con-
the tool nose radius offset startup G42, activation of the tool sider these two program names, they appear to be good:
offset (T0202), and the coolant ON function M08. The ex-
ample in block N23 is a typical circular interpolation block 01005 (LOWER SUPPORT ARM - OP 1)
with a feedrate. 01006 (LOWER SUPPORT ARM - OP 2)

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

course, in a hard copy printout.


gram number zero (OO or 00000) is not allowed. Some
controls allow a 5-digit program number. Also not allowed
Keep program names short and descriptive - their pur-
the
are decimal point or a negative sign in the program number. pose is CNC operator in the search of programs
to assist the
Suppression of leading zeros is allowed - for example, 01 stored in the control memory. The suitable data to include
OOl, OOOI, alid OOOOl are all legitimate entries, in this in the program name are the drawing number or the part
case for a program number one. number, shortened part name, operation, etc. Data not suit-
able are the machine name, control model, programmer’s
Program Name name, date or time, company or customer’s name and simi-
lar descriptions.
On Fanuc control systems, the name of the pro-
the latest
gram can be included in addition to the program number, On many controls, when loading the program into the
not instead of the program number. The program name (or memory, the CNC operator must specify the program num-
a brief description of the program) can be up to sixteen ber on the control panel, regardless of the number in the
characters long (spaces and symbols are counted). The pro- CNC can be a number that just happens to be
program. It
gram name must be on the same line (in the same block) as available in the system, or it can be a number that has a
the program number: unique meaning, perhaps indicating a unique group (for ex-
ample, all programs that begin with the OlOxx belong to
01001 (DWG. A-124D IT. 2)
the group associated with a single customer). Subprograms
must always be stored under the number specified by the
This feature has the advantage that when the directory of
thememory is displayed on the screen, the name of the pro-
CNC programmer. Innovative use of program numbers
may also serve to keep track of programs developed for
gram appears next to the program number, making the di-
each machine or part.
SEQUENCE BLOCK
63

SEQUENCE NUMBERS Sequence Block Format

The program input format notation for a block number,


Individual sequence blocks in the CNC program can be using the address N, is N5 more advanced controls,
for the
referenced with a number for easier orientation within the and N4 or even N3 for older controls. Block number NO is
program. The program address for a block number is the not allowed, neither is a minus sign, a fractional number or
letter N, followed by up to five digits - from sequence to 1
a block number using a decimal point. Minimum block in-
sequence 9999 or 99999, depending on the control system. crement number must always be an integer - smallest inte-
The block number range will be N 1 to N9999 for the older ger allowed is one (N N2, N3, N4, N5, etc.). A larger in-
I ,

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

In the following table, the first column represents se-


Some programmers like to start with the default of the

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-

1 N1 pose of the program is the same - to allow for additional


blocks to be filled-in between the existing blocks, if such a
2 N2 need comes. The need may arise while proving or optimiz-
ing theprogram on the CNC machine, where an addition to
5 N5
the existingprogram will be required. Although the new
10 N10 blocks (the ones inserted) will not be in the order of an
equal increment, at least they will be numerically ascend-
50 N50 ing. For example, a face cut on a lathe with one cut (Exam-
100 N100 ple A) was modified by the machine operator for two cuts
(Example B):
99999 N99999
O Example A one face
- cut
Using sequence numbers (block numbers) in a CNC pro-
gram offer several advantages and at least one likely disad- N40 GOO G41 X3.5 Z0 T0303 M08
vantage. N50 G01 X-0.07 F0.01
N60 GOO W0.1 MO
On the positive side, the block numbers will make the N70 G40 X3.5
program search greatly simplified during editing or tool
repetition on the machine. They also make the program © Example B - two face cuts :

much easier to read on the CNC display screen during


processing or on the printed hard copy. That means both the
N40 GOO G41 X3.5 Z0.05 T0303 M08
N50 G01 X-0.07 F0.01
programmer and the operator benefit.
N60 GOO W0.1
On the negative side, block numbers will reduce the N61 X3.5
N62 Z0
availablecomputer memory of the CNC. That means a
N63 G01 X-0.07
fewer number of programs can be stored in the memory,
N64 GOO W0.1 MO
and long programs may not Fit in their entirety. N70 G40 X3.5
64 Chapter 10

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

ment of 5 or 10 is the most practical, since


it allows for in-

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.

Note that the program is a little smaller and the additional


Long Programs and Block Numbers
blocks are quite visual and noticeable when printed or
displayed on the screen. Long programs are always difficult to load into a CNC
memory with limited capacity. In such cases, the program
Leading zeros may (and should) be omitted in the block
length may be shortened by omitting the block numbers al-
number - for example, N00008 can be written as N8.
together or even better - by programming them only in the
-

Omitting the leading zeros will reduce the overall program


significant blocks. The significant blocks are those that
length. The trailing zeros must always be written, to distin-
have to be numbered for the purpose of program search, a
guish for such similarities as NOS and N80.
tool repetition, or other procedure that depends on program

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 -

some programming applications depend on the block num-


If all sequence block numbers have been omitted in the
bers, for example, lathe multiple repetitive cycles G70,
program, the search on the machine control will become
G7 1 , G72, G73, In this case, at least the significant blocks
rather difficult. The CNC operator will have no other op-
have tobe numbered (see Chapter 35).
tion but to search for the next occurrence of a particular ad-
dress within a block, such as X, Y, Z, etc., rather than a se-
Numbering Increment quence block number. This method of search may
unnecessarily prolong the search time.
Block numbers in a program can be in any physical order
- ascending, descending or mixed - they can also be dupli-
cated or missing altogether. Some programming practices END OF BLOCK CHARACTER
are established as preferable, because they are logical and
make sense. Having a mixed order of sequence numbers in
Because of the control system specifications, the individ-
the program serves no useful purpose and neither do dupli-
ualsequence blocks must be separated by a special charac-
cated sequence numbers. If the program contains duplicate
ter, known as the end-of-block character or by its abbrevia-
block numbers and a block number search is initiated at the
tion EOB or E-O-B. On most computer systems, the EOB
machine, the control system will only search for the first
character is generated by the Enter key on the keyboard.
occurrence of the particular block number, which may or
When the program is input to the control by MDI (Manual
may not be the block required. Any further search will have
Data Input), the EOB character key on the control panel
to be repeated from the string found last. The reason for the
terminates the block. The end-of-block symbol on Fanuc
generous latitude in the sequence block numbering is to of-
controls appears as a semicolon [ ].
fer flexibility to the CNC operator after the program has
;

been done and loaded into the control.


SEQUENCE BLOCK 65

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-

block processed during a repetition of a program


th e first
dius offset, G64 sets a continuous cutting mode, G80 can-

(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

those with limited experience. In all the applications listed,


G codes in separate blocks. Instead of

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

PROGRAM COMMENTS CONFLICTING WORDS IN A BLOCK

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

© Example A What the block contains is simply not logically possible.


It instructs the control to:
N330 MOO (REVERSE PART)
'Set the English system of dimensions, also set the metric

O Example B system of dimensions and set the XY plane’.

- 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):

listed in proper setup and tooling sheets, with all the


required details. N340 Z-0.75 Y11.56 F10.0 X6.845 G01
SEQUENCE BLOCK 67

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:

N340 G01 X6.845 Y11.56 Z-0.75 F10.0


MODAL PROGRAMMING VALUES
Two other possibilities exist that may require a special at- Many program words are modal. The word modal is
tention in programming approach. For example, how will based on the word 'mode' and means that the specific com-
the following block be interpreted? mand remains in this mode after it has been used in the pro-
gram once. It can only be canceled by another modal com-
N150 G01 G90 X5.5 G91 Y7.7 F12.0 mand of the same group. Without this feature, a program
using linear interpolation in absolute mode with a feedrate
There is an apparent conflict between the absolute and in- of 18.0 in/min, would contain the absolute command G90,
cremental modes. Most Fanuc controls will process this the linear motion command G01 and the feedrate FI 8.0 in
block exactly the way it is written. The X axis target posi- every block. With the modal values, the programming out-
tion will be reached in absolute values, but the Y axis will put is much shorter. Virtually all controls accept modal
be an incremental distance, measured from the current po- commands. The following two examples illustrate the dif-
sition of the cutter. It may not be a typical approach, but it ferences:
offers advantages in some cases. Remember - the sequence
block following the block NI50 will be in the incremental O Example A - without modal values :

mode, since G91 is specified after the G90 command!


N12 G90 G01 XI. 5 Y3.4 F18.0
The other programming application to watch for, is in a N13 G90 G01 X5.0 Y3.4 F18.0
block programmed in the circular interpolation mode. The N14 G90 G01 X5.0 Y6 5 F18 . .

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 :

following examples are correct, resulting in a 90° arc with a


N12 G90 G01 XI. 5 Y3.4 F18 .
1.5 inch radius:
N13 X5.0
N14 Y6.5
O With I and J arc modifiers :

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 :

of the Example B. Observe that the modal commands are


not necessary to be repeated in the CNC program. In fact,
N21 G01 X15.35 Y11.348
in everyday programming, many program commands used
N22 G02 X16.85 Y12.848 R1.5
are modal. The exceptions are those program instructions,
N23 G01 . .

whose functionality starts and ends in the same block (for


Now, consider how the control system will process the example dwell, machine zero return, certain machining in-

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:

or N83 G28 Z1.0 M09


N84 G28 X5.375 Y4.0 M05
N22 G02 X16.85 Y12.848 R1.5 11.5 JO
G28 cannot be removed from block N84, because the
G28 command is not modal and must be repeated.
68 Chapter 10

EXECUTION PRIORITY Functions that will be executed simultaneously with the


cutting tool motion:

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:

Here are two unrelated blocks used as examples:


MOO M01 MO 5 MO 9 M98

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.

Dimensional units ... English or Metric


That can be done either through the MDI mode, a program
block, or a system parameter. This applies even for situa-
Dimensional references . . . Absolute or Incremental tions when the power has been turned offand then on again

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:

Fractional values, for example 1/8, are not allowed in a


CNC program. In the metric format, millimeters and meters G20 Selects English units (inches and feet)
are used as units, in the English format it is inches and feet
that are used as units. Regardless of the format selected, the G21 Selects metric units (millimeters and meters)

number of decimal places can be controlled, the suppres-


sion of leading and trailing zeros can be set and the decimal
point can be programed or omitted, as applicable to a par- Without specifying the preparatory command in the pro-
ticular CNC system. gram, control system will default to the status of current pa-
rameter setting. Both preparatory command selections are
modal, which means the selected G code remains active
ENGLISH AND METRIC UNITS until the opposite G code is programmed - so the metric
system is active until the English system replaces it and
Drawing dimensions can be used in the program in either vice versa.
English or metric units. This handbook uses the combined
examples of both the English system, common in the USA, This reality may suggest a certain freedom of switching
between the two units anywhere in the program, almost at
to some extent in Canada and one or two other countries.
The metric system is common in Europe, Japan and the rest random and indiscriminately. This is not true. All controls,
including Fanuc, are based on the metric system, partially
of the world. With the economy reaching global markets, it
because of the Japanese influence, but mainly because the
is important to understand both systems. The use of metric
metric system is more accurate. Any ‘switching’ by the use
system is on the increase even in countries that still use the
of the G20 or G2 1 command does not necessarily produce
English units of measurement, mainly the United States.
any real conversion of one unit into the other, but merely
Machines that come equipped with Fanuc controls can be shifts the decimal point, not the actual digits. At best, only
programmed in either mode. The initial CNC system selec- some conversions take place, not all. For example, G20 or
tion (known as the default condition) is controlled by a pa- G21 selection will convert one measuring unit to another
rameter setting of the control system, but can be overridden on some - but not all - offset screens.
by a preparatory command written in the part program. The
default condition is usually set by the machine tool
The following two examples will illustrate the incorrect
result of changing G21 to G20 and G20 to G21 within the
manufacturers or distributors (sometimes even by the CNC
dealers) and is based on the engineering decisions of the same program. Read the comments for each block - you
manufacturer, as well as the demands of their customers. may find a few surprises:

69
70 Chapter 1

O Example 1 - from metric to English units :


Comparable Unit Values

There are many units available in both the metric and


G2 1 Initial unit selection (metric)
CNC programming, only a very small
English systems. In
GOO X60.0 X value is accepted as 60 nun portion of them is used. The metric units are based on a mil-
G2 0 Previous value will change into 6.0 inches limeter or a meter, depending on the application. The Eng-
lish units are based on inches and feet, again depending on
(reed translation is 60 nun = 2.3622047 inches)
the application. Common abbreviations for the different

O Example 2 - from English to metric units :


units are:

Millimeter mm
G2 0 Initial unit selection (English)

GOO X6 0 . X value is accepted as 6.0 inches


Meter m
G2 1 Previous value will change into 60 nun Inch in

( real translation is 6.0 inches = 152.4 nun)


Foot ft

Both examples illustrate the possible problem caused by


switching between the two dimensional units in the same Many programming terms use these abbreviations. The
program. For always use only one unit of
this reason, next table shows the comparable terms between the two di-

dimensioning in a part program. If the program calls a mensional systems (older terms are in parentheses):

subprogram, the rule extends to subprograms as well:


Metric English

Never mix metric and English units in the same program


m/min (also MPM) ft/min (also FPM or SFPM)

In fact, it is unwise to mix them, even if the results for the mm/min in/min (also IPM or ipm)

control system are predictable. The selection of the dimen-


mm/rev in/rev (also IPR or ipr)
sional system will make a great difference how some con-
trol functions will work. The following functions will be af- mm/tooth in/tooth (also IPT or ipt)
fected by the change from one system of units to the other:
kW HP
Dimensional words (X, Y, Z axes, I, J, K modifiers, etc.)

Constant Surface Speed (CSS - for CNC lathes)


ABSOLUTE AND INCREMENTAL MODES
Feedrate function (the F address)

Offset values (the FI and D offsets for milling A dimension in either input units must have a specified
and tool preset val