Anda di halaman 1dari 529

CNC

Programming
Handbook
Second Edition
CNC
Programming
Handbook
Second Edition
A Comprehensive Guide to Practical CNC Programming

Peter Smid

Industrial Press Inc.


989 Ave nue of the Americas. New York , NY 1001 8
http://w\Vw .i nduslrialpress.colll
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
I. Machine-tools--Numerical control--Programming --Handbooks, manuals,etc .. !'
Title.

TJ 1189 .S592 2000


62 1.9'023--dc21
00-023974

Second Edition

CNC Programming Handbook

Industrial Press Inc.


989 Avenue of the Americas. Ncw York. NY 100 18

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


All rights reserved.

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

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

5 6 7 8 9 10
Dedication
To my father Frantisek and my mother Ludmila,
who taught me never to give up.
Acknowledgments
In this second edition of the eNC Programming Handbook, I would like to express my
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 t hanks also go to Eugene
Chishow, for his always quick th inking and his ability to point out the elusive detail or two
that I might have missed otherwise. To Ed Janzen, I thank for the many suggestions he of-
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 w ill always be my very good friend.

Even after three years of improving the eNC Programming Handbook and developing the
enclosed compact disc, my wife Joan w ill 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-Fa nuc, Japan

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


Charlottesville, VA, USA

• MASTERCAM is the registered trademark of CNC Software In c.,


Tolland, CT, USA

• 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 reg istered 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 eNC and CAD/CAM applications on all levels. He
consults to manufacturing industry and educationa l in stit utions on practical use of Com-
pute rized Numerical Control technology, part programmi ng, CAD/CAM, advanced ma-
chining, tool ing, setup, and many other related fields. His comprehensive industrial back-
ground in eNC programming, machining and company oriented training has ass isted
several hundred companies to benefit from his wide -rang in g knowledge.
M r. 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 Co l-
lege industrial techno logy programs and machine shop skills train ing, have enabled him to
broaden his professional and consu lting skills in the areas of CNC and CAD/CAM training,
computer applications and needs ana lysis, software eva luation, system benchmarking,
programming, hardware se lection, software customization, and operations management.

Over the years, Mr. Sm id 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 we ll as to a large number of manufacturing
companies and private sector organ izations and individuals.

He has actively participated in many industrial trade shows, conf erences, workshops and
various seminars, including submission of papers, delivering presentations and a number
of speaking engagements to professional organizatio ns. He is also the author of articles
and many in-house publications on t he 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 CO.

You can also e-mail him from the CNC Programming Handbook page at www.industrialpress.com
TABLE OF CONTENTS
1 - NUMERICAL CONTROL 1 Axes and Planes 16
Point of Origin 16
DEFINIT ION OF NUMERICAL CONTROL
Quad rant s. 16
Right Hand Coordinate Syst em 17
NC and CNC Technology.
MACHINE GEOMETRY. 17
CO NVENTIONAL AND CNC MACHINING 2 Axis Orientation - Milling 17
NU MERICAL CONTROL ADVANTAGES 2 Axis Orientatio n - Turning . 18
Setup Time Reduction 3 Additional Axes. 18
lead Time Reduct ion 3
Accuracy and Repeatability 3
Contouring of Complex Shapes. 3 5 - CONTROL SYSTEM 19
Simplified Tooling and Work Holding. 3
Cutting Time and Productivity Increase. 4
GENERAL DESCRIPTION 20
TY PES OF CNC MACHINE TOOLS 4 Operation Panel 20
Mills and Machin ing Centers. 4 Screen Display and Keyboard 21
Lathes and Turning Centers 5 Handle 22
PE RSONNEL FOR CNC 5 SYSTEM FEATURES 22
CNC Programmer 5 Parameter Settings 22
CNC Machine Operator. 6 Syst em Defaults 23
SAFETY RELATED TO CNC WORK. 6 Memory Capacity 24
MANUAL PROGRAM INTERRU PTION. 25
Single Block Operation. 25
2 - CNC MILLING 7 Feedhold 25
Emergency Stop 25
CNC MACHINES - MILLING. 7 MAN UAL DATA INPUT - MOl 26
Types of Mill ing Machines. 7 PROGRAM DATA OVERRIDE 26
Machine Axes . 8
Ve rtical Machining Centers. B
Rap id Motion Override. 26
Spindle Speed Overri de 27
Horizontal Machining Centers 9
Feedrate Override. 27
Horizontal Boring Mi ll 10
Typical Specifications 10
Dry Run Operation 27
Z AXIS Neglect 28
Manual Absolu t e 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 Graph ic Display. 29
AXES DES IGNATION 11 In-Process Gaug ing 30
Two-axi s Lathe. 12 Sto red Stroke limit s. 30
Three-axis Lathe 12
Dra wing Dimensions Input 30
Four-axis Lathe. 13 Machining Cycles. 30
Six-axis lathe 13 Cutting Tool Arlimation . 30
Connection to External Devices 30
FEATURES AND SPECIFICATIONS 13
Typical Machine Specifications. 13
Control Features 14 6 - PROGRAM PLANNING 31

ST EPS IN PROGRAM PLANN ING 31


4 - COORDINATE GEOMETRY 15
INITIAL INFORMATION 31
REAL NUMBER SYSTEM 15 MACHINE TOO LS FEATURES. 31
RECTANGULAR COORDINATE SYSTEM. 15 Machine Type and Size. 31

ix
X Table of Contents

Control System . 31
PART COMPLEXITY 32 8 - PREPARATORY COMMANDS 47
MANUAL PROGRAMMING 32
DESCRIPTION AND PURPOSE. 47
Disadvantages 32
Advantages 32 APPLICATIONS FOR MILLING. 47
CAD/CAM AND CNC 32 APPLICATIONS FOR TURNING 49
Integration . 33 G CODES IN A PROG RAM BLOCK 50
Future of Manual Programming 33 Modality of G-commands. 50
TYPICAL PROGRAMMING PROCEDURE 33 Conflicting Commands In a Block 50
Word Order In a Block 51
PART DRAWING 34
GROUPING OF COMMANDS 51
Title Block . 34
DimensIoning 34 Group Numbers 51
Tolerances. 35 G CODE TYPES. 52
Surface Finish 35 G Codes and Decimal Point. 52
Drawing Revisions 36
Speclal lnsuuctions 36
METHODS SHEET . 36 9 - MISCELLANEOUS FUNCTIONS 53
MATERIAL SPECIFICATIONS 36
Matenal Un iformity 36 DESCRIPTION AND PURPOSE. 53
Machinability Rating . 37 Machine Related Functions . 53
MACHINING SEQUENCE 37 Prog ram Rela ted Functions 53
TOOLING SELECTION . 38 TYPICAL APPLICATIONS 54
PART SETUP 38 Appl ications for M illing. 54
Appl ications for Turning 54
Setup Sheet 38 Special M Ol Functions. 54
TECHNOLOGICAL DECISIONS 38 Appl ication Groups 54
Cutter Path 38 M FUNCTIONS IN A BLOCK 55
Machme Power Rat ing. 39 Startup of M Functions. 56
Coo lants and Lubricants 39 Duration of M Functions . 56
WORK SKETCH AN D CALCULATIONS 40 PROGRAM FUNCTIONS 56
Identification Methods . 40 Program Stop 56
QUALITY IN CNC PROGRAMMING 40 OptIOnal Program Stop. 57
Program End. 58
Su bprogram En d SR
7 . PART PROGRAM STRUCTURE 41 MACHINE FUNCTIONS 58
Coolant Functions 58
BASIC PROGRAMMING TERMS 41 Spmdle Functions. 59
Charac ter 41 Gear Range SelectIOn 60
Word 41 Machine Accessories 60
Bleck. 41
Program. 42
42
10 - SEQUENCE BLOCK 61
PROG RAMMING FORMATS
WORD ADDRESS FORMAT 42 BLOCK ST RUCTURE 61
FORMAT NOTATION 43 Building the Block Structure. 61
Short Forms 43 Block Structure for Milling 61
Milling System Format 43 PROGRAM IDENTIFICATION 62
Turnm g Sys tem Format·
44
Multi ple Word Addresses'
45 Program Number. 62
Program Name. 62
SYMBOLS IN PROGRAMMING 45
SEQUENCE NUMBER S 63
Plus and Minus Sign 45
Sequence Number Command. 63
PROG RAM HEADER 45 Sequence Block Format 63
TYPICAL PROGRAM STRUCTURE. 46 Numbenng 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
Automatic Corner Override 89
MODAL PROGRAMMING VALU ES 67 Tapping Mode 89
EXECUTION PRIORITY . 68 Cutting Mode 90
CONSTAN T FEEDRATE 90
Circular Motion Feedrates 90
11 - INPUT OF DIMENSIONS 69
MAXIMUM FEEDRATE. 91
Maximum Feedrate Considerations. 91
ENGLISH AND METRIC UNITS 69
Comparable Unit Values 70 FEEDHOLD AND OVERR IDE 91
Feedhold Switch 91
ABSOLUTE AND INCREMENTAL MODES 70 91
Feedrate Override Switch.
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
Comb inations in a Single Block 72
DIAMETER PROGRAMMING 73
14 - TOOL FUNCTION 93
MINIMUM MOTION INCREMENT. 73
FORMAT OF DIMENSIONAL INPUT 73 T FUNCTION FOR MACHINING CENTERS 93
Full Address Format . 74 Too l 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
CALCULATOR TYPE INPUT 76 Programming Format 95
Empty Too l or Dummy Tool 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 Syst em 96
Spindle Speed Input. 77 Maxi mum Tool Diameter 97
DIRECTION OF SPINDLE ROTATION 77 Maximum Tool length . 97
Maximum Tool Weight. 97
Direct ion for Mi lling . 78 ATC Cycle. 98
Direct ion for Turning. 78 MO l Operation 98
Direct ion Specification . 79
Spindle Startup 79 PROGRAMMING THE ATC. 98
SPINDLE STOP. 80 Sing le Tool Work 98
Programming Severa l Tools . 99
SPINDLE ORIENTATION 80 Keeping Track of Tools 99
SPINDLE SPEED· R/MIN 81 Any Too l in Spindle - Not the First. 99
First Tool In the Spindle 100
SPINDLE SPEED· SURFACE 81 No Tool in the Spindle. 101
Mat erial Machinability 81 First Tool in the Spindle with Manual Change 101
Spind le Speed - English Units 82 No Tool in the Spindle with Manua l Change 102
Spindle Speed - Metric Units 82 First Tool in the Spindle and an Oversize Tool 102
82 No Tool in the Spindle and an Oversize Tool 102
CONSTANT SURFACE SPEED.
Maximum Spindle Speed Setting. 84 T FUNCTION FOR LATHES 103
Part Diameter Ca lculat ion in CSS . 85 lathe Tool Station 103
Tool Indexing 103
TOOL OFFSET REGISTERS 104
13 - FEEDRATE CONTROL 87 Geometry Offset . 104
Wear Offset 105
FEEDRATE CONTROL 87 Wear Offset Adjustment. 106
FEEDRATE FUNCTION. 87 The Rand T Settings 106
Feedrate per Minute. 87
Feedrate per Revolution 88
15 - REFERENCE POINTS 107
FEEDRATE SELECTION 88
ACCELERATION AND DECELERATION 88 REFERENCE POINT GROUPS 107
x ii Table of Contents

,I::tefe-ence POint Groups Relationship. 108 TOOL SETUP 129


MACHINE REFE RENCE POINT 108 Center Line Tools 129
Turning Tools 130
=€:",-n to Machine Zero. 109 Boring Tools 130
PART REFER ENCE POINT 109 Command Point and Tool Wo rk Offset 130
::-::::grarl Zero Selection . 109
;::'ogram Zero · Machining Centers. 110
:lrogram Zero - Lathes 112 19 - 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 Defin itIOn 113 Distance-To-Go in Z Axis. 132
Programming Format . 113 TOOL LENGTH SETUP 133
Tool Posit ion Setting 114
On-Machine Tool Length Setting 133
MACHINING CENTERS APPLICATION 114 Off-Machine Tool Length Setting 134
Too l Set at Machine Zero 114 Tool Length Off set Value Reg ister. 134
Tool Set Away from Machine Zero. 114 Z AXIS RELATIONSHIPS. 134
Position Register in Z AXIs. 115
Prog rammmg Example 115 Preset Tool Length. 135
Tool Length by Touch Off 135
LATHE APPLICATION. 115 Using a Master Tool Length 136
Tool Setup 116 G43-G44 Difference 136
Th ree-Tool Setup Groups 116 PROGRAMMING FORMATS 137
Center Line Tools Setup. 116
External Tools Setup 117 Tool Length Off set not Available. 137
Internal Tool Setup . 117
Tool Length Off set and G92 138
Corner Tip Detail 117 Tool Length Offs et and G54-G59 139
Programming Examp le 117
Tool Length Off set and Multiple Tools 139
CHANGI NG TOOL LENGTH OFFSET. 140
HORIZONTAL MACHINE APPLICATION. 141
17 - POSITION COMPENSATION 119
TOOL LENGTH OFFSET CANCEL 141
DESCRIPTION . 119
Programming Commands 119 20 - RAPID POSITIONING 143
Programming Format. 119
Incremental Mode 120
Motion Length Calculation . 120 RAPID TRAVERSE MOTI ON 143
Position Compens ation Along the Z axis 122 GOO Command 143
Using G47 and G48. 122 RAPID MOTION TOOL PATH. 144
Face Milling. 122
Sin gle Axis Motion 144
Mu lt iaxis Mot ion. 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
Additiona l Work Offsets
WORK OFFSET DEFAULT AND STARTUP 124 RAPID MOTION FORMU LAS. 147
Work Offset Change 125 APPROACH TO THE PART 148
Z AXIS Application 126
HORIZONTAL MACHINE APPLICATION. 127
21 - MACHINE ZERO RETURN 149
EXTERNAL WORK OFFSETS . 128
LATHE APPLICATIONS 128 MACHINE REFERENCE POSITION 149
Types of Offsets. 128 Machming Centers. 149
Geometry Offset . 128 Lathes . 150
Wear Offset. 129 Setting the Machine Axes 150
Tool and Offset Numbers 129 Program Commands 151
Command Grou p 151
Table of Contents xiii
~- -

RETURN TO PRIMARY MACHINE ZERO. 151 LONG DWELL TIME 175


Intermediate Point 151 Machine Wa rm-Up . 175
Absolute and Incremental Mode 152 X Axis IS the Dwelling Axis. 176
Return from the Z Depth Position 153 Safety and Dwell. 176
Axes Return Requ ired for th e ATC 155
FIXED CYCLES AND DWELL. 176
Zero Return for CNC lathes 155
RETURN POSITION CHECK COMMAND. 156
RETURN FROM MACHINE ZERO POINT . 157 25 - FIXED CYCLES 177
RETU RN TO SECONDARY MACHINE ZERO. 158
POINT·TO·POINT MACHINING 177
Single Tool Motions vs . Fixed Cycles. 178
22 - LINEAR INTERPOLATION 159 FIXED CYCLE SELECTION 178
PROGRAMMING FORMAT 179
LI NEAR COMMAND 159
GENERAL RULES . 180
Sta rt and End of the l inear Motion 159
Smgle Axis Linear Interpolation. 159 ABSOLUTE AND INCREMENTAL VALUES lBO
Two Axes linear Interpolation 160 INITIAL LEVEL SELECTION 18 1
Three Axi s linear Interpolation 160
R LEVEL SELECTION. 18 1
PROGRAMMING FORMAT 160
Z DEPTH CALCULATIONS 182
LI NEAR FEEDRATE 161
DESCRIPTION OF FIXED CYCLES 183
Feedrate Range 161
Individual Axis Feed rate . 161 G8 l - Drilling Cycle. 183
G82 - Spot- Drilling Cycle. 183
PROGRAMMING EXAMPLE 162 G83 - Deep Hole Drilling Cycle - Standard. 184
G73 - Deep Hole Drilling Cycle - High Speed. 184
G84 - Ta ppin g Cycle - Standard 186
23 - BLOCK SKIP FUNCTION 163 G74 - Tappin g Cycle - Reverse 186
G85 - Boring Cycle. 187
163 G86 - Boring Cycle. 187
TYPICAL APPLICATIONS.
G87 - Backboring Cyc le 187
BLOCK SKIP SYMBOL 163 G8S - Boring Cycle. 188
CONTROL UNIT SETTING 163 G89 - Boring Cycle. 188
G76 - Precision Boring Cycle. 189
BLOCK SKIP AND MODAL CDMMANDS 164
FIXED CYCLE CANCELLATION 189
PROGRAMMING EXAMPLES . 165
FIXED CYCLE REPETITION 189
Variable Stock Remova l 165
Machining Pattern Change. 166 The L or K Add re ss . 190
Trial Cut for MeaSUring 168 LO or KO m a Cycle 190
Program Proving. 169
Barfeeder Application. 170
Numbered Block Skip. 170 26 - MACHI N ING HOLES 191

SINGLE HOLE EVALUATION . 191


24 - DWELL COMMAND 171 Tooling Selection and Applications 191
Program Data . 194
PROGRAMMING APPLICATIONS 171 DRILLING OPERATIONS 194
Applica tions for Cutllng . 171 Types of Drilling Operations 194
Appl ications for Accessories 171 Types of Dril ls. 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 Dril ling. 196
173 Through Hole Drilling 196
Time Settin g
Number of Revolut ions Setting 173 Blind Hole Drilling 197
Flat Bottom Drill ing. 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