100% (1) 100% found this document useful (1 vote) 4K views 702 pages CNC Programmer's Guide
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here .
Available Formats
Download as PDF or read online on Scribd
Go to previous items Go to next items
Save CNC Programmer's Guide For Later CNG Programmer's
Guide Rick CalverleyProgrammer's
Guide "iets
Lincoln Col alge of Technology
Grand Prairie, TensCopyright © 2024
by
‘The Goodheart-Willeox Company, Inc.
‘All rights reserved. No part of this work may be reproduced, stored, or transmitted in
any form or by any electronic or mechanical means, including information storage and
retrieval systems, without the prior written permission of
‘The Goodheart-Willcox Company, Inc.
Library of Congress Control Number: 2022942616
ISBN 97841-63776-702-3
123436789 -24-27 26 2524.23 22
“The GoodheastWilleox Company, Ine. Brand Disclaimer Brand names, company names and illustrations for products and services
a seed est are proved fer educational purposes any end do rot represent or imply endorsaent or recommendation by the author
‘or the publisher
“The Goodheart Wille Company, Inc, Safety Notice: The reader i expressly advised Wo carefully rea, understand, and apply 9 20
sess and warnings deseribed inthis book or that might lobe ndcatd in undertaking the activites ard eres Seco TEE
Faery ako personal injury injury tors Connon sense and good judgment shoul also be exercised and appli o hep avait
dae hrarte The reader should always eter te appropriate manufacturer’ technic information directions and rss
eee eee act with cre to follow spectc equipment operating instruction. The reader should understand these notens and cations
are ot exhaustive
‘The publisher makes no warranty or representation whatsoever ier exposed or imple scing but not mite 9 eguipmens Pra
Haaren ations dencribed oe refsred to herein ee quality, performance, merchantability, of fins fra particular parpore "M0
autiShsantdmesrno responsibil for any change, eros or omistonsin this book. The publisher pecially disclaims ay Nt Ae
aaa tinea direct niet ncientl consequential, special, or exemplary damages reutig, in whole or inpary fm he eaders
sa he nfrmalionnstrutions proces, warnings, cautions, appcasons or other mate contained in this book The
publisher assumes no responsibility forthe activities of the reader.
"The Goodheart-Willcox Company, Ine Internet Disclaimer: The Internet resources and listings inthis Godheart Wille Publishes prot
cases ta etey os «convenience (0 you These resources and stings were reviewed fete of publication fo rove 8
ae ia an appropriate information Coodhear+ Wilco Publisher has no control over the referenced websites and eto Ne dy tam
ae er cat is pot respon or liable for he content, products or performance of links to olher websites or resources, Gooden
re ahr males no representation either expressed or implied, regarding the content ofthese websites, ane such references do not
ee ep ucmtent ot recmmendation of the information of content presented tis your responsiblity to take al protective menses
to guard against inappropriate conten, viruses or other destructive elements.
mage Cres. Front cove: Pil B/Shuteratck com; Back cover: a /ShutestoksenPreface
Technology in the manufacturing industry is progressing at a pace that has not
been seen before. As the manufacturing industry grows and previous genera
tions of workers continue to retire, companies are experiencing difficulties filling
skilled positions. This is a great time to be entering the field of manufacturing!
In the past, manufacturing facilites were filled with manually operated
mills and lathes, a skilled machinist crafting parts at each machine, Today,
manufacturing facilities are filled with computer numerical control (CNC}
machines, and CNC programmers and operators use these machines to pro-
duce parts at a higher level of quality, a higher rate of production, and a higher
level of consistency than was attainable in the past.
CNC programmers are highly skilled professionals. They have a funda-
mental understanding of machine technology, machining operations, cutting
tools, and part workholding methods. Along with this knowledge, CNC pro-
grammers possess a detailed understanding of programming commands and
functions used to control the machine. CNC programmers ate also able to
work efficiently with machining personnel in today’s fast-paced production
environment.
Advancing technology in the manufacturing industry requires a new edu-
cational approach to prepare tomorrow's workforce, Students must be able to
develop the relevant skills needed for career success. CNC Programmer's Guide
has been designed to meet these needs. This text will help students prepare for
a career in the exciting field of CNC machining.
“The content of this text is organized in three sections. The first section,
CNC Mill Programming, covers the commands, functions, and programming
techniques used in CNC’ milling operations. The second section, CNC Lathe
Programming, covers the commands, functions, and programming techniques
used in CNC lathe operations. The third section, Subprogramming, Probe Pro-
gramming, and Macros, covers subprogramming applications, probe program-
ming, macro programming, and advanced topics. This content organization is
designed for different course structures and flexibility in training programs.
The three sections contain comprehensive coverage focused on specific machine
processes and programming applications.
CNC Programmer's Guide features an extensive number of programs
throughout the text to illustrate examples of how CNC operations are pro-
grammed. These are practical examples with detailed explanations to help
students understand how codes work and when they are used. Depending on
the CNC machine and controller type, programming commands and functions
‘can vary significantly. This text explains different programming formats where
appropriate, with an emphasis on Haas and Fanuc controllers.
CNC Programmer's Guide employs a building-block approach to present
fundamental concepts before progressing to more advanced topics. Program-
ming commands and formats are introduced before specific types of opera-
tions are covered. Coverage includes processes involved in program planning,
machine setup, and part verification.
The primary focus of CNC Programmer's Guide is CNC programming
techniques and practices. For more in-depth coverage of CNC manufactur-
ing, including CNC machining technology, machine types, tooling, and
advanced topics, refer to CNC Manufacturing Technology, also published by
Goodheart-Willcox.Eo eee ae
About the Author
Rick Calverley is the Director of Education at Lincoln College of Tech-
nology in Grand Prairie, Texas, where he designed and implemented Lin-
coln’s first program in CNC Machining and Manufacturing Technology.
As a third-generation machinist, trained mold makes, tool and die maker,
and CNC multiaxis programmer, Mr. Calverley has seen this industry go
through radical changes. He started his career in 1982, running manual
machinery in his father’s shop. During his 30+ years of making parts, he
has produced parts used to make turbochargers, transmissions, plastic
injection molds, aircraft parts, and even parts for the International Space
Station. Before joining Lincoln, Mr. Calverley worked as a CNC program-
mer for several manufacturing firms, including Solidiform, Inc., a defense
contractor in the aerospace industry.
Mr. Calverley is the author of CNC Manufacturing Technology. He
holds an AS degree in marine technology from the College of Oceaneer-
ing, and has completed additional college-level industry and academic pro-
grams. He holds all 12 NIMS Machining Level 1 certifications, as well as
three Mastercam Associate Level certifications.
Calverley has served on the national councils for the Fabricators
and Manufacturers Association, the Mastercam Educators Alliance, and
the Haas Technical Education Community. He also established the first
National Tooling and Machining Association student chapter.
Acknowledgments
The author and publisher wish to thank the following companies, organi-
zations, and individuals for their contribution of resource material, images,
or other support in the development of CNC Programmer's Guide.
‘The author and publisher extend special appreciation to Madalyn Belle
Photography for substantial contribution to the photography program.
CNC Software, Inc.
Haas Automation, Inc.
Iscar
Rick Calverley thanks his wife, Gina, and his five sons—Jacob, Zech,
Sam, Gabe, and Israel—for the support they provided throughout the pro-
cess of writing this textbook.Reviewers
‘The author and publisher wish to thank the following industry and teaching professionals for their valuable input
into the development of CNC Programmer's Guide.
Danny R. Adkins
Ivy Tech Community College
Evansville, IN
Brian Aiken
Pickens County Career and
Technology Center
Liberty, SC
Brendan Anderson
SUNY Alfred State College
Alfred, NY
David Black
‘Anderson W. Clark Magnet
High School
Glendale, CA
Daniel Colquitt
Baker College
Flint, MI
Ed Doherty
Suncoast Technical College
Sarasota, FL
Jeremy Dutton
Gateway Technical College
Kenosha, WI
Joel Eisele
‘Monroe Community College
Rochester, NY
William Gelches
Delaware County Community
College
Media, PA
Paul Gorsky
Lincoln Technical Institute
Mahwah, NJ
Douglas Green
Solano Community College
Fairfield, CA
Eugene L. Horst Jr.
SUNY Morrisville
Morrisville, NY
Michael E. Jones
York County Community
College
Wells, ME
Jack Krikorian
Technology and Manufacturing
Association
Schaumburg, IL
Angel Madiedo
Palm Beach State College
Lake Worth, FL
Carrie Marsico
Cuyahoga Community College
Cleveland, OH
Eric McKell
Brigham Young University
Provo, UT
Alister McLeod
Indiana State University
Terre Haute, IN
‘Terry Morse
Delta College
University Center, MI
Mathieu Ordiway-Thiem
Lockheed Martin High Speed
‘Wind Tunnel
Dallas, TX
Todd Sanders
Danville Community College
Danville, VA
Kevin Schmidt
‘Camden County College
Blackwood, NJ
Derek Seeke
Guilford Technical Community
College
Jamestown, NC
Rich Shouse
Gateway Technical College
Kenosha, WI
Vincent Stadler
Monroe Community College
Rochester, NY.
Jason Taylor
Shelton Seate Community
College
Tuscaloosa, AL
John Templeton
NTMA Training Centers of
Southern California
Santa Fe Springs, CA
Steve B. Tornero
Stark State College
North Canton, OH
Jacob Tucker
Pasadena City College
Pasadena, CA
Leonard Walsh
Goodwin University
East Hartford, CT
Chris Waterworth
Greater Lawrence Technical
School
Andover, MA
Brian Wickham
Hudson Valley Community
College
‘Troy, NYFeatures of the
Textbook
‘The instructional design of this textbook includes stu-
dent-focused learning tools to help you succeed. This
visual guide highlights these features.
Chapter Opening Materials
Each chapter begins with a chapter outline, a list of
learning objectives, and a list of key technical terms.
‘The Chapter Outline summarizes the topics that will be
covered in the chapter. The Learning Objectives clearly
identify the knowledge and skills to be gained when the
chapter is completed. The Key Terms list the key techni-
cal terms to be learned in the chapter. When key terms
are introduced, they are highlighted in bold italic type.
Additional Features
Additional features are used throughout the body of
‘each chapter to further learning and knowledge. Safety
Notes alert you to potentially dangerous practices and
conditions. From the Programmer features provide
practical advice and guidance that is especially appli-
cable on the job. Debugging the Code features explain
proper use of programming commands and help you
develop troubleshooting skills.
10
Hole Machining
OperationsChapter 28 Review
suman,
Illustrations
Illustrations have been designed to clearly and simply
communicate the specific topic. The text makes exten-
sive use of detailed illustrations and photographs to
support explanations of concepts.
Program Examples
Numerous Program Examples show students the pro-
grammed code corresponding to discussions in the
text. These examples are set off from the main text
with color highlighting. Explanations of specific codes
appear to the right of the lines in the program.
End-of-Chapter Content
End-of-chapter material provides an opportunity for
review and application of concepts. A concise Summary
provides an additional review tool and reinforces key
learning objectives. This helps you focus on important
concepts presented in the text. Know and Understand
questions enable you to demonstrate comprehension
of the chapter material. Apply and Analyze questions
extend learning and allow you to apply knowledge and
skills. Critical ‘Thinking questions help you develop
higher-order thinking and problem-solving skills,
viiOOLS FOR STUDENT AND INSTRUCTOR SUCCESS
Student Tools Instructor Tools
‘Student Text LMS Integration
CNC Programmer's Guide is a CNC Integrate Goodheart-Willcox content within your Learning
comprehensive text that focuses Management System for a seamless user experience for
on the techniques, processes, both you and your students, EduHub® LMS-ready content
and procedures used by CNC in Common Cartridge® format facilitates single sign-on
programmers. integration and gives you control of student enrollment and
data, With a Common Cartridge integration, you can access
Lab Workbook ‘the LMS features and tools you are accustomed to using and
+ Hands-on practice G-W course resources in one convenient location—your LMS.
includes review questions G-W Common Cartridge provides a complete learning
corresponding to each package for you and your students. The included digital
chapter in the textbook. resources help your students remain engaged and learn
+ Lab activities offer students opportunities to effectively:
reinforce knowledge and apply programming + Digital Textbook
skills, + Online Lab Workbook content
G-W Digital Companion + Drilland Practice vocabulary activities
For digital users,e-flash cards and vocabulary ‘When you incorporate G-W content into your courses via
exercises allow interaction with content to reinforce Common Cartridge, you have the flexibility to customize and
knowledge of key terms and topics. structure the content to meet the educational needs of your
students, You may also choose to add your own content to
the course
For instructors, the Common Cartridge includes the
Online instructor Resources. QTI° question banks are
available within the Online Instructor Resources for import
into your LMS. These prebuilt assessments help you measure
student knowledge and track results in your LMS gradebook.
Questions and tests can be customized to meet your
assessment needs
Online instructor Resources
+ The Instructor Resources provide instructors with time-
avin preparation took suchas answer keys editable
G WEd uHub fesson plans, and other teaching aids.
Instructor's Presentations for PowerPoint? are fully
customizable, richly illustrated slides that help you
teach and visully reinforce the Key concep om each
chapter
«Administer and manage asessments to meet your
classroom needs using Assessment Software with
Question Banks, which include hundreds of matching,
completion multiple choice, and short answer questions
to ates student knowledge ofthe content In each
chapter,
See www.c-w.com/cne-programmers-guide-2024 for a
pee Istoftlavalebleresoures
Professional Development
+ Expert content specialists
+ Research-based pedagogy and instructional practices
+ Options for virtual and in-person Professional
DevelopmentBrief Contents
Section 1—CNC Mill Programming
Machining Mathematics for Milling .
Cartesian Coordinate System and Machine Axes for Milling
Preparatory Commands: G-Codes.
Miscellaneous Functions: M-Code:
Address Codes for Mill Programming
Steps in Program Planning.......
Mill Program Format
Contouring. ....
Pockets and Slots.
10 Hole Machining Operations.
11 Facing and Island Machining.
12 Setup Sheets............,
13. Machine Setup
Oran nons
0
Section 2—CNC Lathe Programming
14 Machining Mathematics for Turning. 288
15 Cartesian Coordinate System and Machine Axes for Turning 2314
16 Preparatory Commands: Lathe G-Codes 334
- 350
. 3%
3%
- 430
452
480
- 502
526
17 Miscellaneous Functions and Address Codes for Lathe Programming,
18 Lathe Program Planning.
19 Lathe Contour Programming
20 Hole Machining on a Lathe
21 Programming Grooves and Parting Off Operations
22 Threading .
Live Tooling
Section 3—Subprogramming, Probe Programming, and Macros
25 Main Programs and Subprograms .
54d
562,
588
604
- 620
- 638
652
26 Subprogramming Techniques .
27 Probing for Work Offsets. .
28 Probing Inside of the Program .
29 On Machine Verification.
31 Additional Tips and Tricks.Contents
Section 1
CNC Mill Programming
Chapter 1
Machining Mathematics for Milling
1.1 Introduction .
1.2 Converting Fractions to Decimals -
1.3 Geometric Shapes . “
1.4Angles . .
1.5 Trigonometry.
1.6 Bolt Circles .
1.7 Milling Speeds and Feeds .
Chapter 2
Cartesian Coordinate System and Machine
Axes for Milling.
2.1 Introduction .
2.2 Number Lit
23 Two-Dimensional Coordinate System ..
2.4 Three-Dimensional Coordinate System ...
2.5 Absolute and Incremental Positioning.
2.6 Machine Home and Work Origi
2.7 Four-Axis Machines...
2.8 Five-Axis Machines
2.9 Polar Coordinates.
Chapter 3
Preparatory Comman
3.1 Introduction
3.2 Using G-Codes ina Program .
33 G-Code Commands
3.4SStartup Blocks ....
Chapter 4
Miscellaneous Functions: M-Codes .
4d Introduction ........ a
4.2Use of M-Codes . soa wees 2
4.3M-Codes as Program Functions «1... ..-. 64
4.4 M-Codes as Machine Functions ... 68
Chapter 5
Address Codes for Mill Programming
5.1 Introduction. ..
5.2 Address Codes
Codes
Chapter 6
Steps in Program Planning .
6.1 Introduction...
6.2 Print Review .....
6.3 Part Workholding.
6.4Tool Selection .
65 Order of Operations
Chapter 7
Mill Program Format
71 Introduction .
72 Opening Statement
73 Program Body.
7.4 Program Closing Statemer
Chapter 8
Contouring
8.1 Introduction ......
8.2 Point-to-Point Programming
8.3 Cutter Compensation.
8.4 Calculating Angular Moves .
85 Calculating Radial Moves.
86 Chamfering ....
Chapter 9
Pockets and Slots . . 152
91 Introduction ..... 154
9.2 Pocket Milling 156
9.3 Pocket Fi 166
9.4Slots ... 167
Chapter 10
Hole Machining Operations 182
10.1 Introduction ..........-. oo 184
10.2 Hole Shapes and Types oo 186
10.3 Machining Holes : = 190
10.4 Canned Cycles... 192
105 Hole Patterns. ... 203
106 Helical Milling ... 210
10.7 Thread Milling ... -210
Chapter 11
Facing and Island Machining
11,1 Introduction to Facing
11.2 Facing Tools.
11.3 Facing Program Strategy. .11.4 Creating the Facing Program 22226
115 Island Machining 2227
Chapter 12
Setup Sheets. . 238
12.1 Introduction . 240
12.2 Exchange of Information - 240
12.3 Setup Sheets... 24
12.4 Setup Sheet Formats 2263
125 Efficiency in Production ... 205
Chapter 13
Machine Setup 260
13.1 Introduction ........ +262
13.2 Setting the Workholding... 262
13.3 Establishing Work Coordinates ............264
13.4 Establishing Tool Length Offsets .. 268
135 Tool Diameter Offsets. .... . 27%
13.6 Running the First Piece 278
Section 2
CNC Lathe Programming
Chapter 14
Machining Mathematics for Turning .
14.1 Introduction . .
14.2 Converting Fractions to Decimals
288
- 290
14.3 Geometric Shapes .. 292
14.4 Angles 296
14.5 Trigonometry. 3 298
14.6 Tapers. . . 303
14.7 Thread Measurements... oe 306
14.8 Turning Speeds and Feeds .. . 308
Chapter 15
Cartesian Coordinate System and Machine
‘Aves for Turning ......... +. 34
15.1 Introduction 36
15.2 Number Line 316
15.3 Two-Axis Coordinate System . 2 317
15.4 Machine Home and Part Origin. 325
15.5 C Axis Coordinate Programming ............ 326
Chapter 16
Preparatory Commands: Lathe G-Codes . .. 334
16.1 Introduction 336
16.2 Using G-Codes in a Program 1336,
16.3 G-Code Commands 2338
16.4 Startup Blocks. ..... M6
Chapter 17
Miscellaneous Functions and Address Codes
for Lathe Programming. .
171 Introduction . .
350
352
17.2 Use of M-Codes 352
173 M-Codes as Program Functions... 354
1.4M-Codes as Machine Functions . 21359
175 Address Codes ...... » 367
Chapter 18
Lathe Program Planning..........
181 Introduction
18.2 Print Review .
18.3 Part Workholding .
18.4 Tool Selection
18.5 Order of Oper
Chapter 19
Lathe Contour Programming . ...
376
378
2379
381
385
389
396
19.1 Introduction . 398
1922 Point-to-Point Programming. 398
19.3 Tool Nose Radius Compensation 400
19.4 Programming Radial Moves .... 402
195 Programming Angular Moves. . 406
19.8 Turning Canned Cycles. - 408
Chapter 20
Hole Machining on a Lathe. . . + 430
20.1 Introduction
. 432
20.2 Hole Drilling Cycles
432
20.3 Machining Holes with Live Tooling. . 439
Chapter 21
Programming Grooves and Parting Off Operations . . . 452
21.1 Introduction . . . 454
21.2 Planning Grooving Programs .. = AG
21.3 Programming Straight Wall Grooves. 458
21.4 Programming Chamfers . 461
21.5 G75 Grooving Cycle. 463
21.6 Tapered Wall Grooves. 66
21.7 Full Radius Grooves 470
21.8 Parting Off. A
Chapter 22
Threading. . 480
221 Introduction... = 482
22.2 Thread Terminology... 482
223 Programming Treats. 484
22.4 Tapered Thread: 493
22.5 Multi-Start Threads . 49%
xiChapter 23
live Tooling ...........5 ~ 502
23.1 Introduction . - 506
23.2 Special Considerations with Live Tooling... 505
23.3 Radial Hole Machining Canned Oretes.
23.4 Slot Milling. .
235 CAM Software Programs
Chapter 24
Lathe Setup
24,1 Introduction...
24.2 Tool Installation
24.3 Tool Offsets .
26.4 Work Offsets...
245 Setup Sheets.
24.6 Setup Sheet Formats
24.7 Efficiency in Production.
Section 3
Subprogramming, Probe
Programming, and Macros
Chapter 25
Main Programs and Subprograms .
251 Introduction ......
524
537
25.3 Mill Subprogramming ..
25.4 Lathe Subprogramming
Chapter 26
Subprogramming Techniques.
26,1 Introduction
262 The Work Coordinate System ooo...
26.3 Using Work Offsets for Subprograms 566
26.4 Lathe Subprogramming ... 2 589
265 Using Subprograms for Multiple Parts an
Fixtures cece B72
26.4 Layering Subprograms . 576
267 Contouring Subprograms 578
268 Using Subprograms in Multiaxis Machining. 582
Chapter 27
Probing for Work Offsets.
21.) Introduction ...-...+
27.2 Bore Probing Cycle...
213 Boss Probing Cycle........
274 Rectangular Pocket Probing Cyc
275 Rectangular Block Probing Cycle.
xi
276 Pocket X Axis Probing Cycle ..
277 Pocket Y Axis Probing Cycle
278 Web X Axis Probing Cycle .
279 Web Axis Probing Cycle ....
2710 Outside Corner Probing Cycle
2711 Inside Corner Probing Cycle . .
2712 Single Surtace Probing Cycle ..
Chapter 28
Probing Inside of the Program
28.1 Introduction . .
28.2 Using the Probe as aTool ......- .
28.3 Starting Probe Position and Protected Moves
28.4 Single Surface Measurement. ...
28.5 Web/Pocket Measurement ......
28.6 Bore/Boss Measurement ..
Chapter 29
On Machine Verification .
291 Introduction :
292 Pros and Cons of On Machine Verification
29.3 Tool Offset Adjustment and Tolerance
Verification. 623
Chapter 30
Macros . 638
301 Introduction.
30.2 Using Variables in Macros.
30.3 Local Variables.
640
2 6b
6A
30.4 Global Variables . bal
30.5 System Variables nee hd
30.6 Macro Programming Example 648
Chapter 31
Additional Tips and Tricks. 652
31, Introduction .... : 654
31.2 Verifying the Program 654
31.3 Establishing Tool Offsets . = 654
31.4 Running the First Part 656
31.5 CAM Programming. . = 656
31.6 Lathe Taper ..
31.7 Secondl-to-Last Cut and Finish Pass .
31.8 Programming Feed Rates for Arcs
31.9 Subprogramming Applications.
31.10 Metric Programming. ...
3111 Scaling .. -
31.12 Mirror Imaging.
Reference Section ....
Glossary ..
IndexFeature Contents
From the Programmer
Trigonometric Calculations . poeee 2 13
‘Speeds and Feeds . W
Calculating Spindle Speeds.
Coordinate Entry Format
Positioning Mode . .
G-Code Entry Format :
Gél: Left-Hand Cutter Compensation.
‘Sequence of Commands
Notes in Programs.
Tool and Offset Numbers.
Print Specifications .
Machining Inside Corners .
Machining Slots.
Program Entry Format .
General Rules for Programming ...
- 102
2116
Startup Block seit tats
G53: Machine Coordinate System...............117
Program Building and Planning............... 121
Climb Milling. fiteiecee 128
D Offset Number... 132
Coordinate Calculations. 2 136
Climb Milling 156
Machining
CAM and High-Sps 2 165
Drill Point Calculation 185
Drilling Pilot Holes = 186
Using the 676 Canned Cycle. 197
674 and G84 Canned Cycles . 201
Canned Cycle Programming. = 203
Hole Programming =. 213
Efficiency in Machining ..
Teamwork in Machining.
Repeatable Workholding = 266
Trigonometric Calculations =: 299
Speeds and Feeds . 309
Calculating Spindle Speeds.
Coordinate Entry Format.
322
Part Orientation .. 325
Work Offsets...... 326
Multiaxis Turning . 328
G-Code Entry Format... 340
‘Sequence of Commands . ..
Notes in Programs. .
Automatic Chamfering Addresses.
Spindle Speed Commands .
Print Specifications
Roughing and Finishing Passes. .
Interpreting Dimensions ae
Identifying Workholding Requirements
Cutting Insert Data.......
Programming Efficiency
Walking the Path. ......
‘Arc Programming Methods.
Type | and Type 2 Cycles
Boring Bar Size........
Tapping on a Lal
Hole Machining...
Multiaxis Programming Formats...
Becoming a Great Programmer. .
Grooving Operations. ...
Efficiency in Machinin
Ball Screw Assembli
Tapered Thread Cutting
Thread Forms...
Hole Orientation .
Contour Programming.
Multiaxis Programming. .
Part Origin and Tool Setuj
‘Setup Sheets in Machining
Programming Modes.
Using Subprograms.
Programming Mode: o
Development of Work Offsets .
Developing Subprograms .
Subprogram Applications ...
Parameter Entry.
Probe Position.
Identifying Probing Cycles.
Benefits of Probing Systems. .
Initial Work Offset Setti
Macros and Variables .
Using Probing Cycles in ‘Subprograms .Single Surface Z Axis Measurement... 65
Advancing Probing Technology. 635
Using Global Variables. «6s
Reading Variables. 645
Applying Macros... 69
Tool Offset Adjustment 655
Debugging the Code
Coordinate Format........ . 2B
Canned Cycle Loop Count vv 205
Coordinate Format....... 321
Machine Alarms . 402
6% and G97 Commands . U3
Safe Movement. . ~ W62
Thread Chamfer Pullout ....
Interpreting Dimensions ..
Offset Measurement...
Work Offset Designation
Programming Modes..
Feed Rate. . .
Tool Offset Adjustment.
Tool Offset Settings.
xivSection 1
CNC Mill Programming
Machining Mathematics for Milling
Cartesian Coordinate System
and Machine Axes for Milling
Preparatory Commands: G-Codes
Miscellaneous Functions: M-Codes
Address Codes for Mill Programming
Steps in Program Planning
Mill Program Format
Contouring
Pockets and Slots
Hole Machining Operations
Facing and Istand Machining
Setup Sheets
Machine Setup|
Machining
1 Mathematics
for MillingChapter Outline
1.1 Introduction
1.2 Converting Fractions to
Decimals
1.2.1 Communicating Precision
1.3 Geometric Shapes
13.1. Circles
1.3.2. Polygons
1.33. Unes
1.4 Angles
1.4.1 Supplementary Angles
1.4.2 Complementary Angles
1.5. Trigonometry
1.6 Bolt Circles
1.7. Milling Speeds and Feeds
hus apenn ata ct Sun Naoelbutrtckcon
Learning Objectives
After completing this chapter, you will be able to:
‘= Convert fractions to decimals,
= Explain how required precision is communicated in machining,
= Identify two-dimensional and three-dimensional geometric shapes encountered
in machining.
= Name the parts of aright triangle,
‘= Use the Pythagorean theorem to solve for sides of triangles.
«= Differentiate between supplementary and complementary angles.
'= Use basic trigonometry to solve for sides and angles in a right triangle,
= Calculate speeds and feeds in milling.
Key Terms
acute angle geometric shape thombus
angle hypotenuse right angle
are isosceles triangle Tight triangle
bolt circle line scalene triangle
chip load line segment sine
circle numerator square
complementary angles obtuse angle straight angle
cosine parallelogram supplementary angles
curved line polygon tangent
denominator Pythagorean theorem tangent line
diameter quadrilateral triangle
equilateral triangle radius trigonometry
flute rectangle4 section 1
eee
Figure 1-1. A scientific calculator is @
useful tool for completing mathematical
calculations.
1.1 Introduction
Math is essential in the machining and manufacturing trades. Machinists
must have a good working knowledge of math and must be able to make
calculations for numerous tasks. This chapter explains the basic math prin-
ciples used in creating computer numerical control (CNC) milling pro-
grams. Math is used throughout production, from program planning and
machine setup to part inspection. As you will learn in this chapter, machin-
ists must be able to make calculations based on information provided on.
prints. Often, machinists use their knowledge of common geometric shapes
to determine unknown dimensions. This chapter explains how to calculate
linear distances and angles and how to determine locations of features.
This chapter also covers trigonometric functions and calculations for cut-
ting speeds and feeds.
"When reading prints, itis important to identify the system of measure-
ment used for dimensions. In the United States, most prints are dimen-
sioned in decimal inches or fractional inches. The inch is the basic unit of
linear measurement in the US Customary system. All measurements that
you will encounter in this text are based on this system. In most countries
outside the United States, prints are dimensioned using the International
System of Units (abbreviated SI), known as the metric system. Metric prints
used in the manufacturing industry are commonly dimensioned in millime-
ters. The system of measurement used on a print is normally indicated in
or near the title block. Most CNC machines can read programs prepared
in inches or millimeters. In Chapter 3, you will learn how to set the correct
mode for working units when writing a CNC program.
‘When making unit conversions and other machining calculations, a
calculator is often useful, This text assumes access to a simple scientific
calculator, such as the one shown in Figure 1-1. However, any calculator
with a fraction key and sine, cosine, and tangent functions is sufficient to
perform machining calculations. Consider the calculator as a tool, just like
a file or wrench, to support your work in the shop.
In this text, green buttons are used to display exactly which buttons on.
the calculator to press and in which order. The prompt will look like this:
1.2 Converting Fractions to Decimals
Most prints used in manufacturing today are dimensioned in decimal
inches. However, you will also encounter prints that use fractions to spec
ify dimensions. It is common to see fractional dimensions on older prints
and drawings of simple parts. The use of fractions normally signifies a
nonctitical measurement or a feature that is not designed to meet a high
degree of precision in manufacturing, See Figure 1-2.
Fractions cannot be used in CNC programs, however. Instead, they
must be converted to decimal values. Knowing how to convert fractions
is essential for machinists. Having this knowledge is also important when
making measurements because many measuring tools make readings in
decimal units.
Fractions have a numerator and a denominator. The munerator is the
number on top of the fraction and indicates the number of parts in the
fraction, The denominator is the aumber on the bottom of the fraction. It
Copyright Gocahsar-leox Co, neChapter 1 Machining Mathematics for Miling 5
1.000.
onerer.ax Patar
Figure 1-2. A basic part with dimensions in decimal inches and fractional inches.
indicates the whole number quantity into which the parts are divided, For
example, in the fraction 3/4, the numerator is 3 and the denominator is 4.
The process of converting fractions to decimals is a straightforward
division problem. To convert a fraction into a decimal, divide the denomi-
nator into the numerator. The result is a decimal.
Take a look at this sample problem:
geaorae4
3.
32.750
‘The process is even easier using a calculator. Use the following sequence:
BABE
1.2.1 Communicating Precision
The answer to the problem in the previous example is .750. Mathemati-
cally, it would also be correct to express the answer as .75, or even .7500.
The trailing zero after the decimal point does not hold any value. Similarly,
any leading zero on the leftmost side of the decimal point does not hold
any value,
00.75 = 0.75 =..780 = 0.750000 = 0000.7500000
All of these numbers are equal. However, machinists have a specific
way of communicating, To prevent confusion, machinists talk or work to
three places or four places to the right of the decimal point, depending on
Copyrighe Gooden Wilox Op, ine.ill Programm
the required precision. The third place to the right of the decimal point, for
example, is the thousandths place:
—— Decimal point
As an example of how machinists communicate, a print dimension
of .750 is read out as seven hundred fifty thousandths (,750). If you were
measuring a drill bit that was .5 in diameter, you would say five hundred
thousandths (.500). This system provides an efficient and effective method
of communication.
‘A similar method is used when the required precision is in ten thou-
sandths of an inch, As shown previously, the fourth place to the right of
the decimal point is the ten thousandths place. This place is referred to by
machinists using the abbreviation tenths. For example, a print dimension
of 0005 is read out as five tenths. In actual measurement, the referenced
dimension is five ten-thousandths of an inch.
1.3 Geometric Shapes
Geometric shapes include two-dimensional objects, such as circles, arcs,
triangles, and polygons; and three-dimensional objects, such as spheres,
pyramids, cubes, and polyhedrons. See Figure 1-3. Two-dimensional geo
metric shapes are flat. Imagine drawing a shape on a piece of paper. You
can draw left and right or up and down, but only in two dimensions.
A three-dimensional shape has depth. Consider the difference between a
circle and a sphere. A circle is two-dimensional, and spheres are three-
dimensional. You should know how to recognize basic geometric shapes
and how the geometry of a part can be evaluated to determine dimensional
information.
13.1 Circles
Circles are two-dimensional objects often encountered in machining, such
as when drilling holes or cutting round shafts. A circle is defined as a closed
plane curve that is an equal distance at all points from its center point. A
circle can be thought of as a closed loop with a center point. If the dis-
tance from that center point to every point on the outside is the same, the
closed loop is a circle, Figure 1-4. An arc is a portion of a circle. An arc has
a start point, end point, center point, and defined direction (clockwise or
Copyright Govshean Wileox Co, neSphere
Pyramia
Torus
Rectangle ‘Teangle Chole
Figure 1-3, Assorted three-dimensional and two-dimensional geometric shapes.
counterclockwise). Many shapes encountered in machining are formed by
arcs. For example, a 90° round corner blend represents one-quarter of a
circle,
The distance from the center point to the edge of a circle or ate is
defined as the radius. The radius is frequently used in creating CNC pro-
grams and calculating locations. The distance across a circle through the
center point is the diameter. The radius of a circle is one-half the diameter.
See Figure 1-5. Hole sizes are often defined on a print in terms of diameter,
‘whereas corner blends and other partial circles are defined by radius. When
you encounter a circular feature on a print, pay close attention to specifica-
tions and verify whether the dimension defines a radius or a diameter,
‘Copyright Gooaheart. Witcox Ca, Ie.
Chapter 1 Machining Mathematics for Ming 7
cane Wor Pane
ST8 Section 1 CNC Mi Programming
1.780 1780 \ / \ /
sommes \
} ( Lf t— saa ——|
yee) \S
Figute 1-6, A circle isa closed plane ‘Figure 1-8, The radius ofa circle Is the distance from the center point tothe edge of
curve defined by a center point that isthe circle. The diameter isthe dstance from edge ta exge through the centerpoint.
‘equicistant from all points on the curve. The radius is one-half the diameter.
13.2 Polygons
A polygon is a two-dimensional shape with straight sides. Examples of
polygons include triangles, rectangles, pentagons, and hexagons, Figure 1-6.
‘A regular polygon is made up of equal-length sides with equal interior and
exterior angles. Many of the machining projects in later chapters make
use of polygons. Often, machining involves cutting rectangular blocks or
multi-sided objects. The prefix poly means many.
Triangles
“Triangles are particularly important polygons in machining applications. A
triangle is made up of three sides that form three angles. There are several
types of triangles that you will commonly encounter in machining work.
‘The following types are defined by the relationship between the sides and
angles.
© A scalene triangle, Figure 1-7, has no equal sides or equal angles.
‘square
Trangle
osha loo Fustaar
Figure 1-6, Examples of polygonal geometric shapes. As seen here, polygons cen have
an unlimited number of sides,
‘Copyright Goodheart-Wilox Co, IncChapter 1. Machining Mathematics for Miling 9
Scalene Triangle
Sno sides the
same length
Gonchesnnoe ane
Figure 1-7. A scalene triangle has no equal sides or angles.
© An isosceles triangle, Figure 1-
angles.
«An equilateral triangle, Figure 1-9, has all equal sides and all equal
angles.
= A right triangle, Figure 1-10, has one 90° angle. A 90° angle is
defined as two lines that are exactly perpendicular to each other. On
a print, a right triangle is designated by a square symbol in the 90°
corner of the triangle. The longest side in a right triangle, called the
hypotenuse, is always across from the 90° angle. The right triangle
has special mathematical properties that make it advantageous for
use in machining,
s has two equal sides and two equal
All triangles share the same mathematical property: the sum of all
three angles must equal 180°.
180
Angle 1 + Angle 2+ Angle 3
The ability to calculate angles without all of the angles defined is often
necessary in print reading. Using the previous formula, you can calculate
any angle of a triangular shape if you know the other two angles. If you
Isosceles Triangle
Equilateral Triangle
Equal SEE
angles
a \A
{Al sides the Samo length,
‘allanglas the same size
‘Geoshow vices Ptehr once eos abn
Figure 1-8, An isosceles triangle has two Figure 1-9. An equilateral triangle has al
equal sides anc two equal angles. ‘equal sides and all equal angles.
Copyrignt Gooden Witeox Co, ne.
Sn)
Right Triangle
/
|
|
Covcheroc Rate
Figure 1-10. A right triangle, denoted by
a right angle symbol10 Section 1 CNC Mill Programming
wibtact
Hypotenuse
>
anteater Paar
Figure 1-11, The sides ofa right triangle
ccan be calculated using the Pythagorean
theorem.
mann
ashes er Paar
Figure 1-12. Squares and rhombuses
hhave four equal sides. A square has four
right angles, while a rhombus has no
right angles. Because all four sides of
the square are equal, the presence of
‘one right angle, indicated by the rignt
angle symbol, implies that all four angles
measure 90°.
Rhombus
Rectangle
7
b d
‘ovate es Faber
Figure 1-13. A rectangle has four right
angles and two sets of equal sides.
have a triangle where you know one angle is 45° and another angle is 55°,
calculate the third angle as follows:
180° — Angle 1 Angle 2 = Angle 3
180° - 45° - 65° = Angle 3
0° = Angle 3
Right triangles have a unique characteristic defined by the Pythago-
rean theorem. The Pythagorean theorem states that, in a right triangle, the
square of one side pius the square of the second side is equal to the square
of the hypotenuse, Figure 1-11:
a tbiect
Consider the following example. In the triangle shown in Figure 1-11,
side a measures 2” and side b measures 1.5”. What is the length of side c?
ate beaet
2.8% 0°
442.28" 202
c=v6
225"
To solve this problem on your calculator, press the following keyst
2AaSeAe
‘The last input key takes the square root. This last step changes c? to the
desired solution, ¢ or 2.5”.
{As shown in these examples, using standard algebra, you can calculate
any side of a right triangle if you know the other two sides. Additional
mathematical methods for working with right triangles and finding all of
their sides and angles are covered later in this chapter.
Quadrilaterals
A quadrilateral is a four-sided, two-dimensional polygon. Note that the
prefix quad means four and indicates the number of sides. Quadrilater-
als are among the most commonly machined shapes and include squares,
rectangles, and rhombuses. Mathematically, or geometrically, these three
different quadrilaterals all have specific properties.
+ A square is a quadrilateral with four equal sides and four right (90°)
angles.
* A rhombus has four equal sides but no right angles. Compare a
‘square with a shombus, Figure 1-12. Notice the right angle symbol
in the square.
+ A rectangle is also a four-sided object with four right angles,
Figure 1-13. However, rectangles do not have four equal sides.
Instead, they have two pairs of equal sides.
Notice that each of these shapes has parallel sides and that the oppo-
site sides are equal in length. Squares, rhombuses, and rectangles are all
parallelograms. A parallelogram is a quadrilateral in which the opposite
sides are both parallel and equal.
‘Copyright Goodhear-Wilox Co, neChapter 2
1.3.3 Lines
Lines are important geometric features in machining. With the exception
of commands for machining circular features, most CNC machining com-
mands are along a line. A line is a continuous, straight, one-dimensional
geometric element with no end. This means a line is infinite. It is impossible
to machine an infinitely long part. When the term line is used in machining,
ic actually refers to a line segment. A line segment is a line with a defini-
tive beginning and end, Line segments, like lines, do not curve or waver. A
curved line is an arc, partial circle, or spline.
Aline that touches an arc or circle at exactly one point is referred to as,
a tangent line. Ifa line crosses or touches an arc at more than one point, it
is not tangent, but intersecting, Figure 1-14.
1.4 Angles
Most machining requires a good working knowledge of angles. An angle
measures the rotational distance between two intersecting lines or line seg-
ments from their point of intersection (or vertex). Angles are usually given
in degrees, Figure 1-15.
There are 360° in a circle (one degree is 1/360 of a circle). A straight
line passing through the center point of a circle divides the circle in half
and forms two semicircles, each representing 180°. See Figure 1-16,
There are four common types of angles:
© A right angle measures exactly 90° between two intersecting lines.
When two lines intersect and form a right angle, Figure 1-17, all
other angles of intersection are also 90°. Notice that the sum of the
angles is 360°.
= An acute angle measures less than 90°, Anything less than a right
angle is an acute angle, Figure 1-18,
= An obtuse angle measures more than 90°, Figure 1-19, Notice that
the second leg of the angle intersects the first at an angle greater
than a right angle,
Line 2
a
Figure 1-16. A circle contains 360°. A
line passing through the center point of
the circle civides the circle in half and
estan er Atear
forms two semicircles. Each semicircle is
2 180° are.
(Copyigt Goodneart Wilax Co, Ie
Figure 1-17, Two lines intersecting at 90°
angles.
Machining Mathematics for Ming 11
ape,
ne \
\ no
h tangent
/
I
ota eshte
Figure 1-14. A circle displaying a tangent
and nontangent (intersecting) line.
‘or vortox
Figure 1-15. Two lines intersecting at
known angles,
$
ovate ier iter
Figure 1-18. An acute angle is one that is
less than 90°,12 Section 1 CNC Mil Programming
Gexchaut coe as
Figure 1-19. An obtuse angle 's one that
is more than 90°
80°
Cat aR
re 1-20. When one supplementary
angle is known, the other supplementary
‘angle can be caleulated by subtracting
the known angle from 180°.
‘Cehaa es P
Figure 1-21. An unknown angle can
be calculated by subtracting its known
complementary angle from 90°
© A straight angle measures exactly 180°, A straight line represents a
straight angle. Refer to the horizontal line shown in Figure 1-16.
1.4.1 Supplementary Angles
Supplementary angles are two angles that add up to 180°, Recall that
a straight angle is 180°, When one straight line intersects another at an
angle, the angles on the opposite sides of the vertex are supplementary.
If one angle is known, the other can be calculated. For example, if one
line intersects another at 50°, calculate the second angle as follows. See
Figure 1-20.
80" + x= 180"
x= 180° - 50°
x= 130°
‘The prints used in a normal machining environment do not define
every feature. In fact, it is incorrect to overdimension an object on a print.
Often, one angle is defined, and you must calculate the second or supple-
mentary angle.
1.4.2 Complementary Angles
Complementary angles are two angles that add up to 90°, Problems involy-
ing complementary angles normally start with a 90° angle that has been
intersected by a line. You can find the missing angle that completes the 90°
angle ifthe other angle is known, Figure 1-21.
In this example, the given angle is 25°. What is the complemen-
tary angle?
In Figure 1-22, the right angle symbol in the lower-left corner indicates
2 90° angle. Ifthe known angle is 34°, what is the complementary angle?
90° = 34° +x
90° 34° =x
56°
As you move forward with print reading, you will see prints that have
right angles or right triangles, Often, the print may define only one angle.
You can calculate unknown angles using the principles previously
cussed as well as basic trigonometry.
1.5 Trigonometry
‘Trigonometry is a branch of mathematics that deals with the relationships
between the sides and angles of triangles and with functions of angles.
Essentially, trigonometry is the mathematics of triangles and angles. This
text focuses on right triangles.
Copyright Goodhoset Witox Co, ine.The three fundamental principles for working with right triangles are:
* Right triangles always have one angle of 90°.
= The sum of all three angles in a triangle is 180°,
The Pythagorean theorem states that a? + b?
Stare by reviewing the parts of right triangles, Figure 1-23. Immedi-
ately, you should identify each triangle as a right triangle because it has the
right angle symbol. The hypotenuse, or longest side, is directly actoss from
the right angle and is designated by the letter H.
The other two sides are named based on their relation to a given angle
or for the angle for which you are trying to solve. They are called the oppo-
site side and adjacent side, indicated by the letters O and A, respectively,
Figure 1-24.
‘The mathematical relationships between sides and angles are given by
three trigonometric function:
= The sine of a given angle is the ratio of the opposite side to the
hypotenuse.
= The cosine of a given angle is the ratio of the adjacent side to the
hypotenuse.
= The tangent of a given angle is the ratio of the opposite side to the
adjacent side,
“SOHCAHTOA® is a helpful mnemonic for remembering the defini-
tions of sine, cosine, and tangent and the mathematical calculations to
solve for right triangle sides and angles.
djacent
H = hypotenuse
tangent
posite
A= adjacent
Opposite (0)
Hypotenuse (H)
Adjacent (A)
Fypotenuse (H)
Opposite (0)
Adjacent (A)
Trigonomerric functions can be used to determine all of the sides and
angles of a right triangle. Sine, cosine, and tangent calculations can be
made using reference tables or a scientific calculator. Although reference
tables are helpful tools, the probability of error increases with manual cal-
culations. The quickest and most accurate calculations are made with a
calculator. First, identify what sides and angles you know and what you
are trying to find. Then, choose the appropriate formula and use the cor-
rect calculator inputs.
The following is an example of finding the length of a side in a right
triangle when one angle and one side are known. The first step is to iden-
tify the sides. The side opposite the right angle is always the hypotenuse.
Sine (sin) =
Cosine (cos) =
Tangent (tan
‘Copyright Goodhearttilox Coie
Chapter 1
Machining Mathematics for Miling 13
Se
Va
Figure 1-22. A complementary angle
is easily calculated when @ right angle
iS elven (a5 shown by the right angie
symbol) and one of the complementary
angles is known,
Plight
angle
Hypotenuse, H
Figure 1-23. The right angle symbol
denotes a right angle. The side directly
‘across from the 90° angle in aright
triangle is the hypotenuse.
ane
Programmer
Trigonometric Calculations
Ona scientific calculator, the
sine of a given angle is cal-
‘ulated by entering the angle
and then pressing the SIN key.
The COS and TAN keys are
used in the same manner to
calculate cosine and tangent.14° Section 1 CNC Mil Programming
s
i H
é
38°
fe N
‘Adjacent (A)
A
Pa
z=
j #
‘Opposite (0)
8 cca cox Pbiser
Figure 1-24, The opposite and adjacent
sides of aright triangle are determined
relative to the known angle, A—This right
triangle has one angle defined as 38°
‘The side directly opgosite that angle is
known as the opposite side. The side of
the triangle that is next to or touching the
38° angle is called the adjacent side. B—
This is the same triangle, but the known
‘angle is now 52° and the opposite and
‘acjacent sides change positions.
2.78
Ca,
H
nae
Figure 1-25, A right triangle with one
known side and one known angle.
The side opposite the known angle is the opposite side. The side touch-
ing the known angle is the adjacent side. In Figure 1-25, the length of the
hypotenuse and one angle are known. To calculate the opposite side, use
the sine funetion. The known angle (5°) is represented as ain the formula:
Opposite (0)
SI @= Fypoienuse AT
1.788" =0
To solve this problem using a calculator, press the following keys:
55 SIN Xm =
‘The adjacent side in Figure 1-25 can be calculated using the cosine
function. The known angle (55°) is represented as ain the formula:
- _Adacent
605 2= Hypotenuse TAT
0s 55 x Hypotenuse (H) = Adjacent (A)
5736 x 2.179 =A
1.250" =A
To solve this problem using a calculator, press the following keys:
The following summarizes the calculator inputs used for sine, cosine,
and tangent formulas when solving for one side of a right triangle. These
formulas are used when one angle and one side are known. The first two
formulas were used in the previous examples. Use the appropriate input
based on the side and angle you know.
L.Hyp [2 Ang! SIN 2) Copp)
2. Hyp x Angi COS = (Adi)
3.Ag} Ang! TAN |=) (Opp)
4.0pp + Ang! SIN = (Hyp)
5. Adj. Ang! 668 |= Hyp)
6.0pp |) Ang! TAN |= (Adj)
Other trigonometric functions are used when you know two sides of
a right triangle and need to find an angle. The inverse sine, cosine, and
tangent functions are used to find an unknown angle relative to two
known sides. On a typical calculator, the inverse trigonometric functions
are labeled SIN“, COS*, and TAN". These are typically second functions
located on or above the SIN, COS, and TAN keys. Second functions on a
calculator are accessed by pressing the second function key before pressing
Copyrigt Goodhear-itcox Co, nethe appropriate key. The second function key may be color coded and is.
typically labeled 2nd or Shift.
The inverse trigonometric functions are also known as arcsine, arc-
cosine, and arctangent. In the following formulas, ~1 denotes an inverse
function. The angle to be calculated is represented as a.
fogle2= sin: (22201)
Ascent (A)
Ale a= oss! (Hemet)
Angle a= tan: (See
The first step in solving for an unknown angle in a right triangle is to
identify the two known sides. In Figure 1-26, there are two known sides.
Since the known sides are the opposite and adjacent sides, the inverse tan=
gent function is used to solve for the unknown angle:
1 { Onpasite (0)
Angle a= ton (Se)
10)
2500
Angle @='an* (0.7)
Angle a= 34,992"
Angle a= tan?
‘To solve this problem using a calculator, press the following keys:
17s + 28 = (24 Tan
‘The following summarizes the calculator inputs used for inverse sine,
cosine, and tangent formulas when solving for an unknown angle, These
formulas are used when two sides are known. Use the appropriate input
based on the sides you know.
1.0pp 1) Hyp |=) 2 SiN
2.ad) Gl oo ES
3.0pp + Adj = 2% TAN
As previously discussed in this chapter, the Pythagorean theorem can
be used to calculate a side of a right triangle when you know two sides.
First, identify the sides you know. Then, select one of the following formu-
Jas and calculate the unknown side. Use the appropriate calculator inputs
based on the given information for the triangle.
LAdj 38 + Opp x = VE (Hyp)
2.Hyp = Opp = A (Ad)
3. Hyp [be (EY adi Ik |S) Copm
Copyright Goocheart. Wilcox Co, ne:
Chapter
Machining Mathematics
Ming 15)
—
aa
LL ave
. |
/ alacant (A) f
| 2500
Figure 1-26. right tr
angle with two
known sides and an unknown angle to
solve
Saion 1 CNC Mil Programming
3.200
Figure 1.27. A right triangle with two
known sides and one unknown side
to solve, The unknown side is the
hypotenuse.
In Figure 1-27, two sides are known and the hypotenuse must be calcu-
lated. When considering how to label the two known sides, it is irrelevant
which side is defined as opposite or adjacent. To understand why, look at
the Pythagorean theorem equation:
aan
Side c is always the longest side, or the hypotenuse. The hypotenuse
must always be identified in this manner. In comparison, sides a and can
have an interchangeable order in the equation. Just as 6 + 3=9 and 3+
9, the designation of opposite and adjacent will not affect the final answer
Since the unknown side in this example is the hypotenuse, use the follow-
ing calculator formula and key entry.
Calculator formula:
Ad
+ Opp x = VK (Hyp)
Key entry:
S220 Ee
Solution:
1,2502 + 3.2002 = 3.435
1.6 Bolt Circles
A common feature found on a machining print is the bolt circle. A bole
circle is a theoretical circle on which the center points of holes lie in a
circular pattern of holes. The holes in the pattern are equally spaced, with
equal angles between holes. Common examples are the bolt circle for the
lugs on a car’s wheel and the holes on a bolted joint between pipe flanges.
Figure 1-28 illustrates a circular pattern of six holes on an 8” diameter bolt
circle, Notice that each hole is positioned at che same distance from the
theoretical arc center and each hole is 60° apart. A set of six holes equally
spaced in a 360° circular pattern creates 60° spacing.
‘To create a CNC program, you will need to calculate each hole position
from the center of the theoretical arc. In the example shown in Figure 1-28,
the theoretical arc is defined by an 8” diameter bolt circle. Each hole posi-
tion can be determined by making right triangle calculations. First, identify
the right triangles that can be created for use in calculations. Figure 1-29
shows the triangle for one of the hole positions.
I is mathematically possible to calculate the position, or two unknown
sides, for each triangle using the trigonometry formulas. However, there is
an easier way to make the calculations using a calculator. As you will learn
in Chapter 2, the calculations can be used to plot X and Y coordinates
for the hole locations. Chapter 2 explains how to use coordinates in the
Cartesian coordinate system. For now, making calculations is sufficient.
Figure 1-29 shows the X and Y coordinate distances corresponding to the
sides of the right triangle.
‘Copyright Goodheart Wilox Co, InChapter 1 Machining Mathematics for iting 17
Sy)
Goosnesn oa Peer
Figure 1-28, An 8” diameter bolt circle locating six holes in a 360° citcular pattern,
‘The holes are the same distance from the theoretical arc center and equally spaced
This creates 60° separation between holes.
‘Agjacent side
‘Ccoordinate
measurement)
osha eo Fuser
Figure 1-29. A right triangle used to celculate the position of a hole in @ circular hole
pattern,
‘There are two numbers that must be known before you start your calcula-
tions. The first number is the radius of the theoretical arc the holes are centered
on. In this example, the radius is 4”, or half the diameter of the 8” bolt circle.
‘The second number is the angular position of each hole that is being calculated.
‘Copyright Goodheart Wilox Co, Iegramming
180° o
Figure 1-30. Angle positions on a circle
with 0° oriented at 3 o'clock,
There is a standard in CNC programming that also applies for these
calculations. As previously discussed, there are 360° in a circle. Figure 1-30
shows the 0°, 90%, 180°, and 270° angle positions on a circle in a default
orientation. The zero angle position (0°) is oriented at 3 o'clock. The angle
position rotates counterclockwise, with 12 o'clock representing 90°, 9
o'clock representing 180°, and 6 o'clock representing 270°. With this ori-
entation, the following bolt circle formulas can be utilized.
Angle 008 |x Radius |=) (coordinate)
Angle SIN |x) Rocus |) (Y coordinate)
With this information, you can now calculate the X and ¥ coordinate
positions of the holes. See Figure 1-31. The following calculations are for
the holes identified as Hole #1 and Hole #2. These coordinate calculations
are based on measuring from the center of the bolt circle. The radius is 4”.
The angular position of Hole #1 is 0° and the angular position of Hole
#2 is 60°.
Hole #1 X coordinate:
Angle GOS x Radius |= (X coordinate)
ocosx4=4
Hole #1 Y coordinate:
‘Angle SIN |x Radius = (Y coordinate)
OSINx4=0
Hole #1 is located at x4, YO.
coahau oo Fubar
Figure 1-31. Bolt citle formulas can be used to calculate coordinates for the hole:
centers, The coordinate position of Hole #1 is located at O° and Hole #2 is located at 60°
copyright GoodeatWilox Co, Ine.Hole #2 X coordinate:
Angle O08 |x| Redius | 0 coordinate)
4600S x4=2
Hole #2 Y coordinate:
Angle SIN |¥ Recius (=) (Y coordinated
60 SIN x4 = 3.464
Hole #2 is located at X2, ¥3.464,
1.7 Milling Speeds and Feeds
‘When cutting material on a CNCmilling machine, the relationship between
how fast the spindle turns and how fast the cutting tool moves across the
material is vitally important. Machine shops try to get parts cut as quickly
as possible. In addition, tooling reacts differently at different speeds and
feeds. For example, if you turn an end mill very slowly and feed it into
the material rapidly, the tool may suffer a catastrophic failure and shatter.
Conversely, if you run an end mill at a high speed but feed it slowly, it takes
excessive time to cut the material and can dull the cutting edges of the tool.
Calculating speeds and feeds in the modern machining environment is
one of the most overlooked and miscalculated aspects of machining. For-
tunately, there is a relationship between the material, the cutting tool, and
the machine that can be easily calculated. Every CNC programmer should
be able to accurately calculate a tool's proper speed and feed.
‘The first factor in calculating speeds and feeds is the cutting tool. The
machining industry today primarily uses tools made from solid carbide, 80
this is the material assumed in this text. When working with other cutter
materials, consult manufacturer specifications. Milling calculations also
depend on the diameter of the cutter and how many cutting edges it has.
‘The next important factor is the type of material being cut. Stainless
steels do not cut as easily as aluminum, for example, Different materials
have different rates of material removal and require careful consideration
of cutting speeds. Cutting speed is a measure of the tool’s movement in
feet per minute, It is expressed in surface feet per minute (sim) and is com-
monly referred to as surface footage. In simple terms, surface footage refers
to the number of linear feet a point on a rotating tool travels in one minute.
Tooling manufacturers provide charts with recommended cutting speeds
for common materials. On a chart, recommended speeds are expressed
in ranges of values, These values are obtained through empirical testing,
Cutting speeds can vary based on the tooling manufacturer, so it is best to
get the range of recommended values directly from the manufacturer. See
the Reference Section in this text for information on recommended cutting
speeds for common materials.
Surface footage is used in calculating the spindle speed. The rotating
speed of the spindle is measured in revolutions per minute (rpm).
Copyright Gooshear Wilox Co, Ine
Chapter 1 Machining Mathematics for Ming
From the
Programmer
Speeds and Feeds
Calculating the correct spindle
speeds and cutting feeds is the
best way to make your tools last
as long as possible. Too slow of
feed means the tool is cutting
for longer amounts of time to
do the same amount of work.
‘Too fast of feed means the tool
does not have enough time to
cut, and can fail on the cutting
edge, Often the best resource
for speed and feed settings can
be the tool distributor or a tool-
ing engineer. Always calculate
speeds and feeds to remain as
efficient as possible,
19{ONG Mil Programming
emt
Perea)
Calculating Spindle Speeds
The mathematical constant
3,82 is used in the calculation
for spindle speed. This value
is the result of dividing the
‘number of inches per foot by
pi: 12/3.14 = 3.82.
‘The following examples are used to calculate the speed of two different
end mills with two different types of materials. Consider a 1/2” end mill
cutting aluminum at 700 sfm and a 3/8” end mill cutting 304 stainless steel
at 450 sim, The formula for calculating spindle speed, measuted in rpm, is
given below:
"om = jr EY
Calculate the speed for the 1/2” (.500") end mill for cutting aluminum.
3:82 5700 = 5348 rpm
The speed for this operation is 5348 rpm. Remember this number for
use in calculating the feed.
Now, calculate the speed for the 3/8” end mill for cutting stainless steel.
382% 450. — 4584 1pm
Now that you know the speed, you can calculate feed rate. The for-
mula for feed rate, measured in inches per minute (ipm), is given below:
Feed Rate (ipm) = rpm x Chip Load x Number of Cutting Edges (Flutes)
Feed rate depends on chip load and the number of cutting edges as well
as spindle speed. Chip load refers to the actual thickness of the chip being
cut o: the depth of each cutting edge as it passes through the material. Chip
load is measured in inches per tooth and varies with each cutter, but will
generally range from .005” to .010”. Any end mill, whether solid carbide or
inserted, will have multiple cutting edges, or flutes. A flute is the recessed
‘groove along a cutting edge allowing for chip removal. Tools with more
flues can feed faster, but have less clearance space for chip removal and a
smaller internal web, making them weaker in heavy cuts.
Return to the previous example and calculate the feed rate for each
cutter, The 1/2” end mill used for cutting aluminum has a speed of 5348.
pm and three flutes. Calculate the feed rate as follows:
5348 rpm x .007 x3 =
2.3 ipm
Now calculate the feed rate for the 3/8" end mill used for cutting stain
less steel. This cutter has two flutes.
‘4584 rpm x .007 x 2 = 64.2 pm
“The feed rate for this operation is 64.2 ipm at a speed of 4584 rpm.
Copyright Goedhear-Witeox Co, IneChapter 1 Review
Summary
= A good working knowledge of math principles is
needed to create CNC milling programs.
= A scientific calculator is a useful tool for making
machining calculations,
= To convert a fraction to decimal format, divide the
denominator into the numerator.
= To ensure a proper level of accuracy and ease
of language, machinists express decimals in the
thousandths and ten thousandths place.
= When evaluating a print, machinists identify basic
geometric shapes and evaluate part geometry to
determine dimensional information.
‘= Four common types of triangles encountered in
machining work are scalene, isosceles, equilateral,
and right triangles.
= The Pythagorean theorem states that, for a right
triangle, the square of one side plus the square
of the second side is equal to the square of the
hypotenuse.
Right triangles can be solved for all sides and all
angles using standard formulas.
‘= Supplementary angles are two angles that add up
to 180°. Complementary angles are two angles
that add up t0 90°.
= The hypotenuse is the longest side of a right
triangle and is always across from the 90° angle.
= Basic trigonometry is used to solve for sides and
angles in a right triangle.
© Cutting speed is a measure of a tool's movement
in feet per minute and is expressed in surface
feet per minute (sfm), Surface footage is used in
calculating the spindle speed, which is measured in
revolations per minute (rpm).
= Feed rate is calculated based on the spindle speed,
the chip load, and the number of cutting edges on
the tool.
Copyright Go
reartnieox Co, Ine
Review Questions
Answer the following questions using the information
provided in this chapter.
Know and Understand
1. Most prints used in manufacturing today are
dimensioned in
A. fractional inches
B, decimal inches
. millimeters
D. centimeters
The position three places to the right of the
decimal point is called the place.
A, hundredths
B. tenths
ten thousandths
D. thousandths
3. Trwe or False? A circle is a closed plane curve that is
an equal distance from its center point to all points.
4, The distance across a circle through the center
point is the __,
“A. length
B. width
C. diameter
D, radius
5. Examples of ___ include triangles, rectangles,
pentagons, and hexagons.
A. pyramids
B. polygons
C. thombuses
D. trapezoids
6. The ___ triangle has no equal sides or equal
angles,
A, isosceles
B. equilateral
C, obtuse
D. scalene
7. A right triangle must contain one
A. 30°
B. 45°
Cc. 60°
D. 90°
angle.
218. Trwe or False? The sum of all angles in any
triangle is 90°.
9. The Pythagorean theorem is written as_
10. An acute angle is defined as _.
A. greater than 180°
B. equal to 90°
. greater than 0°
D, less than 90°
11, True or False? Two angles are complementary if
they add up to 180°,
12. _is defined as a branch of mathematics that
deals with the relationships between the sides and
angles of triangles and with functions of angles.
A. Solid modeling
B, Plane geometry
C. Pythagorean theory
D, Trigonometry
413. The longest side in a right triangle, or the side
directly across from the right angle, is called the
A. apex
B, adjacent side
hypotenuse
D. opposite side
14. True or False? Besides the hypotenuse, the other
two sides in a right triangle are called the opposite
and the adjacent.
15. __is a measure of a too!’s movement in feet per
minute and is expressed in surface feet per minute
(sf).
A. Chip load
B, Feed rate
C. Spindle speed
D, Surface footage
Apply and Analyze
1, Convert 3/32 to its decimal equivalent. Round to
the nearest thousandth.
2. Convert 1 3/16 to its decimal equivalent. Round
to the nearest thousandths.
22
3. Identify the following geometric shape. Assume all
sides are equal.
4, Identify the following geometric shape. Assume all
sides are equal.
—
5. List and briefly describe the four types of triangles
discussed in this chapter.
6. Use the Pythagorean theorem to solve for the
unknown side of this right triangle.
11500
1
1250
7. Use the Pythagorean theorem to solve for the
unknown side of this right triangle.
2.92,
[1675 —>
Copyright Goochear-Wilcox Co, ne8, Identify the unnamed side of this right triangle.
PSX
‘Adjacent
9, Label all of the sides of this right triangle.
52°
L.
10, Use a calculator to solve for the missing angle of
this right triangle.
oN
11, Use a calculator to solve for the missing side of
this right triangle. Give answer to the nearest
thousandths.
LZ,
(eyright Goochoart-Wileox Co, In.
12. Use a calculator to solve for the two missing
angles of this right triangle, Round answers to the
nearest whole angle,
A
4250
é JI
fe-1780-+1
13. Using a 5/8" diameter end mill, what is the correct
speed, in rpm, for cutting aluminum at 750 surface
feet per minute (sfm)?
14, When cutting mild steel in a milling machine with
a calculated speed of 3726 rpm, what is the feed
rate in inches per minute (ipm)? Assume .005”
chip load with a 3-flute end mill.
Critical Thinking
1, Take a look around your home, school, or
workplace and identify various geometric shapes.
Can you measure and calculate any irregularities
in these shapes? How do these irregularities affect
the construction of these shapes?
Consider how right triangles are used in everyday
life. Consider the construction of your home, the
school building, or other built structures, such as
a storage shed. Determine the approximate angle
ofa roof or calculate the length of a diagonal
between two walls that meet at 90°,
3. Depending on metal composition and cutting tools
used, recommended cutting speeds can vary. How
does this impact your machining time? Why does
this make it so important to analyze materials and
cutting tools?
23Cartesian
2 Coordinate System
'and Machine Axes
for Milling
|Chapter Outline
2.1. Introduction
2.2 Number Line
2.3. Two-Dimensional Coordinate
System
2.4. Three-Dimensional
Coordinate System
2.5 Absolute and Incremental
Positioning
2.6 Machine Home and Work
Origin
2.7 FourAxis Machines
2.8 Five-Axis Machines
2.9 Polar Coordinates
‘Opie aening pooch z1b/Suttsckcom
Learning Objectives
After completing this chapter, you willbe able to:
* Describe how the Cartesian coordinate system is applied in CNC milling
Identity the four quadrants in a two-dimensional coordinate system.
* Plot X and ¥ coordinate positions in a two-dimensional coordinate system.
* Plot coordinates in three-dimensional space using the X,Y, and Z axes.
‘= Explain the relationship between machine home and the work origin.
® Describe the machining capabilities and configurations of fouraxis milling
machines.
® Descrite the machining capabilities and configurations of fve-axis miling
machines,
* Identify the axes defining rotational movement on four-axis and five-axis
milling machines.
* Use polar coordinates to plot points defining angular relationships between
features.
Key Terms
341 miling Incremental postioning rotary
absolute positioning machine hore trunnion
Cartesian corcnate ain work ens
stem
polar coordinates work origin
full fouraxis milling26 Section 1 CNC Mil Programming
Figure 2-1, The organization of rows
and columns in a vending machine is.
2 common example of the Cartesian
coordinate system,
2.1 Introduction
‘The basic principle of creating any CNC program is positioning a tool at
a known location and moving that tool to a series of defined locations.
The system used to plot and calculate machine positions and movement
is known as the Cartesian coordinate system. The Cartesian coordinate
system specifies each point uniquely in a plane with a pair of alphanu-
meric coordinates. This system is named for its developer, French scientist
and mathematician René Descartes. An influential philosopher, Descartes
is considered the father of analytic geometry. His developments led to the
coordinate plotting system that is widely used today.
‘An example of the Cartesian coordinate system in use is a vending
machine. See Figure 2-1. When you purchase a snack or beverage from a
vending machine, you select the row of the item you want and then the
‘umber in that row. Specifying two points of intersection tells the machine
where to locate your item.
2.2 Number Line
To understand how points are located in the Cartesian coordinate system,
look at the simple number line shown in Figure 2-2. A number line is a
straight line with numbered divisions spaced equally along the line. The
zero mark in the middle of the line establishes the starting point and is
known as the origin. The numbered divisions along the line are located
in relationship to the origin. The numbers can have any defined value and
unit format. For example, each number can represent one inch, one foot,
‘or one mile. In this example, the numbers represent whole number inches.
The numbers to the right of the origin are positive numbers. The num-
bers to the left of the origin are negative numbers. Movement in the right
direction is positive and movement in the left direction is negative. The
numbers define the amount of linear movement in a given direction, For
‘example, moving five units to the right of the origin represents a movement
of 5” in the positive direction. Moving three units to the left of the origin
represents a movement of 3” in the negative direction. These distances are
represented by Point 1 and Point 2 in Figure 2-2. Specifying distances in
relation to a known origin is a basic way to describe tool movement.
‘The horizontal number line shown in Figure 2-2 establishes a single
axis of movement. In CNC programming, additional axes are used to
define the direction of the cutting tool.
“a a
woe 7554924012048 67890
Se a
orga
= Negative direction Posttve direction
Figure 2:2. A number line measures distance and direction. Point 1 represents
‘2 movernent of 5" from the origin in the positive direction. Point 2 represents a
movement of 3” from the origin in the negative direction.
Copyright Goccnear-Wieox Co, IeChapter 2. Cartesian Coordinate System and Machine Axes for Miling 27
2.3 Two-Dimensional Coordinate System
A number line represents a single axis of travel. However, all CNC
machines have at least two axes of travel. Adding a second number line
establishes the second coordinate axis in the Cartesian coordinate system.
See Figure 2-3. In this system, the horizontal axis is designated as the X
axis and the vertical axis is designated as the Y axis. The X and Y axes
intersect at the origin and are perpendicular to each other (oriented at
90°), Points representing distances from the origin are specified with X and
Y coordinates. The coordinate system origin is designated as XO, YO and
can be located anywhere in space. This system allows the programmer to
define the location of the workpiece and the direction of tool movement.
‘As shown in Figure 2-3, the coordinate system is divided into four
quadrants. Coordinates are specified as positive or negative based on their
location from the origin. A coordinate to the right of the origin has a posi-
tive X value and a coordinate to the left of the origin has a negative X
value. In Figure 2-3, notice that each quadrant has positive or negative
X and Y values based on its location in relation to the origin. The quad-
rants are numbered 1-4 in a counterclockwise direction. Coordinates in
the upper-right quadrant have a positive X value and positive Y value.
Y axis
40
Quadrant 2 (02) 8 Quadrant 1 (21)
KY aK
8
7
6
Quadrant 3 (03) e ‘Quadrant 4 (24)
SY 9 KY
10
Figure 2-3. A two-dimensional coordinate system has two axes designated as the X axis
‘and Y axis. The axes intersect at the origin and divide the system into four quadrants,
Points ae located in relation to the ovigin and have positive or negative values besed
‘on their location from the origin.
‘copyright Goodheur Wieox Co, Ine28
81. ONG Mil Programming
uu
Berita
Coordinate Entry Format
The X axis coordinate value
does not need to be first in
the program, but the X and
Y movernent to each position
must be on the same line to
create a direct move to the
next position when movernent
is along both axes. Specify-
ing the X value first, followed
by the ¥ value, is common
practice in programming.
This is the format used in this,
textbook
Coordinates in the upper-left quadrant have a negative X value and posi-
tive Y value.
The X and Y axes establish a theoretical flat plane known as the XY
plane, On a milling machine, if the XY plane is considered to be parallel
to the machine table, the X axis represents the horizontal movement of the
machine table from side to side, The Y axis represents the movement of
the table from front to back. As discussed in the next section, a third axis,
the Z axis, represents the movement of the spindle. The Z axis is used in a
three-dimensional coor
To define movement in a CNC machine, a series of coordinate points
is communicated to the machine through a program. The points are used
by the machine to travel in a straight line from point to point. Figure 2-4
shows a series of points specifying the exact path of travel. Each point has
an X,Y coordinate measuring its distance from the origin. Point 1 is 6”
from the origin in the positive X axis direction and 3” from the origin in
‘ion. This coordinate is expressed as X6, Y3. Point
is 7” from the origin in the negative X direction and 6” from the origin in
the positive Y direction. This coordinate is expressed as X-7, Y6.To create
movement from Point 1 to Point 2, then to Point 3, and then to Point 4, the
CNC program is written as follows:
X6. ¥3. (Point 1)
X-7. ¥6. (Point 2)
X-4. ¥-3. (Point 3)
XB. Y-7. (Point 4)
(Peer nucke
Coordinate Format
‘As shown in Figure 2-4, Cartesian coordinates are commonly written in
the format X,Y, However, in CNC programming, this format is not used.
Entries for XYZ coordinates are expressed as decimals. For example,
in the CNC program, the coordinate entry X6. Y3. represents Point 1
in Figure 2-4, Notice that this format does nat require a trailing zero
in the decimal. For example, the coordinate X6.0 is shortened to X6.
Similarly, a leading zero is not required for decimal values below zero.
For example, the coordinate Z-.5 does not requite a leading zero. Older
controllers did not accept the decimal point programming format and
entries were read in ten thousandths of an inch, For exemple, the entry
X6 represented ,0006" and the entry X60000 represented 6”. Machines
today use decimal point programming. This is the format used through-
‘out this textbook.
2.4 Three-Dimensional Coordinate System
‘The Cartesian coordinate system is not limited to two-dimensional space.
A third axis can be designated to show height or depth in three-dimen-
sional space. The third axis is designated as the Z axis. Figure 2-5 shows
a three-dimensional coordinate system. In this system, there are three axes
of positional movement and a third coordinate is specified for the position
along the Z axis. Points representing distances from the origin are specified
CCopyight Goosheart.cox Co, neChapter 2 Cartesian Coordinate System and Machine Axes for Miling 29
axe
°
3
7
pai ¢
xm vie $
\ 3 ers
\ 2 38.13
409376
Karis
Origin (X0, YO)
Points
X46, Y3
“SePoint ¢
x6, Y-7
‘ooshea sr Pon
Figure 2-4, Plotted coordinates representing the oath of travel in @ CNC program.
sto
ecateen er Ptenar
Figure 2-5. A third axis, designated as the Z axis, is used in the three-cimensional
coordinate system.The importance of defining
the correct coordinates can-
nnot be expressed enough. A
missed minus sign or decimal
point can cause a catastrophic
machine failure or part dam-
age. Be careful plotting the
points and entering them into
the CNC program.
with X, ¥, and Z coordinates. On a milling machine, the Z. axis represents
the movement of the spindle toward or away from the workpiece.
To put this additional axis in perspective, consider that the Z origin,
‘or zero location, is at a top comer of the part to be machined. Anything
below this position is in the negative Z direction, and anything above this
position is in the positive Z direction. The Z axis allows for coordinate
positioning of different heights of material in three-dimensional space.
Figure 2-6 shows a block of material that is 4” wide, 2” long, and 1” in
height. Based on the position of the block in relation to the origin, coordi-
nates for the three points on the block are plotted as follows:
Point 1 =X-4. YO. 20.
Point 2
If the block is repositioned in the coordinate system, the X, Y, and Z
positions change. In Figure 2-7, the size of the block is the same as in the
previous example, bur the relationship to the origin has changed. The same
three points on the block are plotted as follows:
Point 1 =X-2. ¥2. 21
Point 2 = X-2. YO. 20.
Figure 2-6. Inthe three-dimensional coordinate system, point locations are specified
with X, ¥, and Z coordinates in relation to the origin,
Copyright Goosear-ileoe Co, neFigure 2-7. The block of material has different X, ¥, and Z coordinates after moving it
toa new position,
2.5 Absolute and Incremental Positioning
‘The coordinates specified for point locations in the previous examples are
based on absolute coordinate entry. Absolute coordinates are measured in
relation to the origin (XO, YO, ZO). In a CNC program, moves specified
with absolute coordinates are referred to as absolute positioning moves,
‘meaning that they represent absolute measurements in reference to the
origin. Absolute positioning is the appropriate method of movement for
‘most purposes. A second way to specify movement is to use incremental
positioning, Incremental positioning refers to measuring from the current
location to a second location, Incremental coordinates represent a relative
measurement from the current position of the tool, not from the origin,
Incremental coordinates are also called relative coordinates because they
are located relative to the previous coordinate. See Figure 2-8. The exam-
ple shows the same path of travel defined in Figure 2-4, but with coordi-
nates specified using incremental positioning. Compare the two location
methods. Referring to the incremental coordinate for Point 1, the previous
location is considered to be the origin. Note the positive and negative val-
uues corresponding to the entries for Points 2, 3, and 4, Point 2 is 13” from
Point 1 in the negative X direction and 3” from Point 1 in the positive
Y direction. Coordinates must be entered carefully in the program when
using incremental positioning because if an incorrect position is specified,
each successive move will be incorrect,
(Copyright Goochear-Wieox Co, ne.
an Coordinate System and Machine Axes for Miting 31
San32. Section 1 CNC Mill Programming
Positioning Mode
Although itis possible, and
sometimes preferred, to pro-
gram in inctemental moves,
‘most CNC programs are writ
ten using absolute positioning.
‘An origin, or zero point, is
established, and all machine
‘or tool movements are made
relative to that zero point.
Making sure you know where
‘the machine is located and
where it is headed is critical in
CNC programming.
ais
10 Incremental Coordinates
° Move to Point 1X8. ¥3
ds Move to Point2.X-13. ¥8
Move to Points X3.¥-9,
Move to Point 4 X®. Y-4
Figure 2-8. Coordinates defining a path of travel using incremental positioning.
Incremental coordinates are measured relative to the previous coordinate location.
Incremental positioning is sometimes used when a print uses a chain of
dimensions to define linear distances between features. In addition, incre-
mental positioning can be used with special programming methods to cre-
ate arcs. Chapter 3 covers the programming commands used to establish
absolute and incremental movement.
2.6 Machine Home and Work Origin
Ina CNC milling operation, the machine controller must know where the
‘material, or part, is located. This is achieved by measuring the distance
from the machine's home position to the part origin location. Every mill-
ing machine has a fixed location called machine home. This position varies
based on the machine type and manufacturer and can be anywhere within
the work envelope of the machine. On a three-axis milling machine, this
position is most often located at the limit of the positive X axis travel, the
positive Y axis travel, and the positive Z axis travel. This would position
the machine table to the far left and completely forward with the spindle
at its highest position. A typical three-axis milling machine home position
is shown in Figure 2-9.
Ina part setup, the part material is secured, and the distance from
machine home to the work origin is then measured. The work origin repre-
sents the X0. Y0. location on the part and is positioned at a suitable point
based on the part geometry and dimensions. The distance from machine
Copyright Goosheart- cox Co, neChapter 2 Cartesian Coordinate System and Machine Aes for Miling 33
Machine home
Figure 2-9, Machine home isa fixed position usually located atthe limits of machine
travel along the positive X axis, sitive ¥ axis, and positive Z axis.
home to the work origin is entered into the controller as the work coor-
te system origin. The CNC program is written using this same origin
position. Figure 2-10 shows a typical machine setup with a vise used to
hold a piece of material to be machined.
2.7 Four-Axis Machines
‘A three-axis milling machine has three axes of movement designated as the
X, Y,and Z axes. A four-axis milling machine adds another axis for use in
CNC milling. A rotary is a rotating unit that establishes a fourth axis and
Work origin,
Vise &
Machine home.
‘osha ee Pte
Figure 2-10. A workpiece secured to a milling table using avise. The work origin defines
‘the X0, YO location on the part and is located in relation to the machine home position
Conyright oodheent Wilsx 0, in.34
Section 1 CNC Mill Programming
allows for rotation of the workpiece. In a program, the amount of rota-
tional movement is expressed in degrees.
There are a number of types of rotary devices in the manufacturing
industry. A rotary can be integrated directly into the CNC mil, or it can be
a stand-alone unit that can be removed from the machine. A rorary table
is shown in Figure 2-11. This unit can stand up vertically or be mounted
horizontally on the milling table. The Tslots on the circumference of the
table are used for mounting work.
Another common type of rotary is a collet indexes, Figure 2-12. The
collet allows direct holding of round stock on the outside of the mate-
rial. An indexer can be mounted horizontally or vertically in most cases,
depending on the machining required.
Figure 2-11, A platter-syle rotary table provides @ fourth axis for machining,
Gonthoe er Pe?
Figure 2-12. collet indexer mounted on a milling machine.
Copyright Goodnean-Witcox Co, IeChapter 2 Cartesian Cootcnate System and Machine Axes for Ming
On a milling machine, an axis of rotation parallel to the X axis is com-
monly designated as the A axis. Rotation about the A axis is in a positive
oor negative direction. The point of rotation is through the center point of
the spindle on the rotary device. The positive or negative rotational direc-
tion is based on the mounting orientation of the device. When looking
along the positive X axis, positive rotation is clockwise. Figure 2-13 shows
a platter-style rotary table and its direction of rotation.
‘The process of positioning a rotary axis at a fixed angular position and
completing three-axis milling operations is known as 3 + 1 milling. In a
typical 3 + 1 milling operation, the rotary device is programmed to rotate
the part to a fixed position. Then, the cutting tool is engaged to machine
the part. Additional sides of the part can be machined in the same man-
ner by rotating the work to different positions. In this type of machining,
the axis of rotation is fixed while movement of the cutting tool occurs
along the X, Y, and Z axes. In full four-axis milling, the rotary axis is in
motion at the same time tool movement occurs along the X, Y, and Z axes.
Continuous linear and rotational movement allows for machining more
complex parts in a single setup.
Figure 2-14 shows a cylindrical part held in place by a collet rotary
device and the rotational direction around the A axis. This part has a slot
machined on the outer surface. Simultaneous linear and rotary motion is used
in machining the slot because it is rotated 10° from the center axis of the part.
This work setup is an example of full four-axis milling. The setup permits
synchronous rotation of the part and linear movement of the cutting tool.
When programming a rotary movement, an address code is used to
specify the machine axis. Rotation about the A axis is defined with the A
letter code. The rotational movement can be specified individually or in
combination with other axis movements. For example:
» A90, Rotates the A axis in a positive 90° rotation.
= A-60. Rotates the A axis in a negative 60° rotation,
= A40. Y1. X2. Rotates the A axis in a positive 40° rotation while
simultaneously moving in the X and Y axis directions.
‘axis otation
Figure 2-13. A rotary table mounted to a milling table permits rotation of the
workpiece. The axis of rotation is designated as the A axis,
(Copyright Goodheart
35
SECTION 11_ GNC Mil Program:
‘Axis rotation
Figure 2-14, A part requiring rotational slot machining.
2.8 Five-Axis Machines
AA five-axis milling machine has five axes of movement. Multiaxis machines
can have different configurations, but five-axis milling usually refers to
‘machines with three axes of linear movement and two axes of rotary move-
ment. The five-axis milling machine is rapidly becoming the most utilized
tool in the modern machine shop. It provides versatility and speed and has
the ability to machine complex parts with fewer operations, thus reducing
costs, It also adds complexity to programming and setup.
There are a number of ways a five-axis machine can be configured.
“The rotary axes can be fully integrated into the machine, or they can be
part of an add-on device that is removed when not in use. Figure 2-15
shows a small add-on unit that saves space and can be easily removed
when not needed. This is a side-mounted, two-axis rotary unit with a tilt-
ing rotary table.
Other machines can be factory built with multiaxis capability. A five-
axis CNC milling machine is shown in Figure 2-16.
In five-axis milling, the two axes defining rotational movement are
typically designated as the A axis and B axis. However, whether an axis is
Baxi rotation.
‘A xis rotation
Figure 2-15, An adé-on rotery unit maunted to a milling machine. The unit provides
‘hwo rotary axes for five-axis milling.
copyright Goodhssrt Wilcx Co Ie.Chapter 2 Cartesian Coordinate System and Machine Axes for Ming
Flgure 2-16, A five-axis machining center.
designated as A or B may depend on the setup or factory controller con-
figuration. For specific details on the machine configuration, refer to the
operator's manual.
Figure 2-17 shows an add-on unit used in a five-axis milling configu-
ration. This unit is a side-mounted rotary with a tilting rotary table. This
configuration allows the workpiece to be rotated to different positions
along two axes and seduces the amount of setups required.
Figure 2-18 shows another add-on rotary unit called a trunnion. A
trunnion is a rotary table that allows for rotation in one or two axis direc-
tions. The trunnion in Figure 2-18 allows for rotation around the A axis
and B axis. This unit contains a platter for mounting work. The saddle
Baxi rotation ‘axis rotation
Genco eon Paioar
Figure 2-17, A compact rotary unit mounted on a milling machine for five-axis
‘machining. The unit is light and easy to install and remove as required
con
37
SO3B. Section 1 CNC Mill Programming
Figure 2-18, A trunnion table with two rotary axes mounted to a conventional
machining table.
rotates from a horizontal to a vertical position around the A axis and the
platter rotates independently around the B axis.
In a program, address codes are used to specify motion for each
machine axis. Each of the five axes can be programmed for individual
movement or combined movement with other axes. Rotational movement
is expressed in degrees. For exampl
«= A90. B45. Rotates the A axis and B axis simultaneously.
= B45.X.5. Rotates the B axis 45° while moving .5” in the X axis direction.
# A10, B-20. X.2 Y-.$ Z-.25. Moves all axes synchronously.
2.9 Polar Coordinates
Some prints may specify part dimensions based on angular relationships
between features. For example, the center points of holes in a bolt circle are
defined by a radius and an angie. Coordinate locations for hole centers inci
cular patterns are commonly defined with polar coordinates. Polar coordinates
are coordinates that reference a linear distance and an angle. Polar coordinates
are specified in relation to a known point, such as the center point of a circle
Figure 2-19 shows an example of polar coordinate dimensioning used
to locate a hole. A linear dimension specifies the distance from the first
hole to the second hole and an angular dimension specifies the polar angle
from the zero angle position. As discussed in Chapter 1, the zero angle
position is oriented at the 3 o’clock position. Angles are measured in a
counterclockwise direction from this position.
Figure 2-20 shows an example of a print where a 1” diameter bolt circle
is defined for four holes in a circular pattern. In a program, polar coordi-
nates are used to specify the hole locations for drilling. The center point of
the pattern is used as the origin for coordinates. The holes are located by
specifying a radius value and an angular position relative to the center of the
pattern. The use of polar coordinates eliminates the need to mathematically
calculate each hole position, thus simplifying the programming process and
alleviating the possibility of calculation errors. Using Cartesian coordinates
‘would require manual calculations to be made with trigonometric functions
‘copyright Goodneart tox Co, te‘oodtaae vee Putaer
Figure 2-19. Polar coordinates define the location of a feature by specifying a linear
distance and angular direction.
In this example, the work coordinate system origin is located at the
top-left corner of the workpiece. But the center of the bolt circle is located
at X2, Y-2.5, By programming that position and using specialized codes
for polar coordinate programming, the four holes in the pattern can be
drilled by giving the radius and angular position.
Different types of controllers use different codes for polar coordinate
progtamming. Although bolt circles are 2 common use for polar coor-
dinate positioning, there are other instances where this technique could
prove useful. Polar coordinate programming and other methods used for
machining holes in milling operations are covered in Chapter 10.
|, |
oles
eh
oO
ein |
/
Lgoues:
EQUALLY SPACED
91 BOLT CIRCLE
‘Geoahaa osPubtene
Figure 2-20. A part with a circular pattern of holes located on 2 1” diameter bolt
circle. Polar coordinates are used in programming to machine the holes.
copyright GoodhearWiox Co,Chapter 2 Review
Summary
= The Cartesian coordinate system is used to locate
points representing X and Y values relative to the
origin,
= A two-dimensional coordinate system is made
up of X and Y axes and is divided into four
quadrants.
= A three-dimensional coordinate system has a third
axis designated as the Z axis.
+ Absolute positioning refers to specifying moves
with absolute coordinates measured in relation to
the origin,
+ Incremental positioning refers to specifying moves,
with coordinates measured in relation to the
current position.
‘= Machine home is a fixed location on a milling
machine that usually represents the limit of the
positive X axis travel, the positive Y axis travel,
and the positive Z axis travel.
+ The work origin represents the XO. YO. location
on the part and is measured relative to the
machine home position.
+ A rotary is a unit that establishes a fourth axis on
a milling machine and allows for rotation of the
workpiece.
* Ona milling machine, an axis of rotation parallel
to the X axis is commonly designated as the A
axis.
* In full four-axis milling, the rotary axis is in
motion at the same time tool movement occurs
along the X, Y, and Z axes.
In five-axis milling, the two rotary axes are in
motion while tool movement along the X, Y, and
Z axes occurs simultaneously
* Polar coordinates are commonly used to define
coordinate locations for hole centers in circular
patterns,
Review Questions
Answer the following questions using the information
provided in this chapter.
Know and Understand
1, The Cartesian coordinate system was develuped
by
A. Ray Cartesian
B, Carte Desysteme
C. René Descartes
D. Remy Descarme
2. On a number line, the starting point is known as
A. the origin
B, point zero
C. coordinate home
D, machine home
3. True or False? The most common method used
to program a CNC machine is incremental
positioning.
4, A two-dimensional coordinate system is made up
of the axes,
A,X and Z
B. AandZ
Cc. AandB
D. X and Y
‘Copyight Goodhean-Witeox Co, Ie5. In the figure below, in which quadrant is the solid
box located?
ts
2
sos-o7e-549241% 2945678910
—PPe
A. Quadrant 1
B, Quadrant 2
C. Quadrant 3
D. Quadrant 4
(Copyright Goodheart Wilox Co, Ine
6. In the figure below, what is the coordinate for the
center point of the solid circle?
10-9-8.7-6-5-492-4 1 2945678910
eA X axle
ALXS.Y-S.
B. X-5, Y-S.
C.XS.YS.
D.X-5.Y5.
7. On a milling machine, which axis represents the
movement of the spindle in relationship to the
workpiece?
A. Aaxis
B. Baxis
C.Y axis
D.Zaxis
48. In the figure below, what is the coordinate of Point
10.
1 on the block of mate
A. XO. Y2.Z1.
B. X-2, YO. Z1.
C, X2. ¥2. Z0.
D. X-2. YO. Z0.
. True or False? A rotary unit on a four-axis milling
machine establishes an axis of rotation.
On a milling machine, the axis that establishes
rotation about the X axis is commonly designated
asthe __axis,
A. Baxis
B. Z axis
C. Aaxis
D, X axis
11. True or False? The rotary axes on a five-axis
milling machine can be fully integrated into the
machine, or they can be part of an add-on device.
12. True or False? A five-axis milling machine is
normally designated with X, Y, Z, B, and C axes.
13. Using polar coordinates, what is the angle and
distance from the center of the bolt circle to
Point 1?
Point 1
Lano.es
EQUALLY SPACED
| 1 BOLT CIRCLE
. 30° and 0”
30° and .5”
30° and 1”
. 60° and 1”
voPrPE
‘Copyright Gooden. Wieox CineApply and Analyze
1, What is the purpose of using the Cartesian
coordinate system in CNC programming?
2. What are the three designated axes of movement
on a three-axis milling machine?
3, Explain the additional benefit provided by a four-
axis milling machine in comparison to a three-axis
milling machine.
4. Why are five-axis milling machines becoming
more widely used, and what benefit do they
provide to a machine shop?
5. What is the benefit of using polar coordinates in a
program to specify locations of holes in a circular
pattern defined by a bolt circle?
Critical Thinking
1. The Cartesian coordinate system has important
uses in the machining industry and other
industries, including mechanical design and
engineering. What are some examples in everyday
life where coordinate systems are used to designate
distance and direction?
(copyright Soodheart Wilcox Co, nc.
2, Sketch a map of your home. Designate one
direction as the X axis direction and designate
a second direction at 90° to establish the Y axis
direction. Start from an origin position, such
asa point near the front door, and map out the
distance and direction to different rooms, such
as the kitchen and dining room. Select one of the
rooms and plot coordinates to locate items such as
furniture and appliances. What is the most logical
location for the origin of coordinates based on the
layout of the room?
3, Describe the benefits of four- and five-axis
machining. Why is the ability to rotate work a
benefit? What are some examples of common
parts that might benefit from four- or five-axis
machining?| Preparatory
Commands:
G-CodesChapter Outline
3.1. Introduction
3.2. Using G-Codes in a Program
3.3. G-Code Commands
3.3.1 GOO: Rapid Positioning
3.3.2. GOI: Linear Interpolation
3.3.3 G02 and G03: Circular
Interpolation
3.3.4. G20 and G21)
Measurement Modes
3.3.5 G90 and G91: Absolute
and Incremental
Positioning
3.3.6 G40, G41, and G42
Cutter Compensation
3.3.7 G54: Work Offset
3.4 Startup Blocks
Chap ocanin pat ea SseanShoesck.con
Learning Objectives
After completing this chapter, you willbe able to:
= Explain the purpose of preparatory commands.
Identify the most common G-code commands for milling operations.
= Identify G-code groups and their purpose.
= Understand the difference between modal and nonmodal commands.
‘= Describe the purpose of the GOO and GO1 movement commands.
‘= Identify coordinates specitied in absolute positioning and incremental
positioning mode.
= Explain the use of cutter compensation commands.
Key Terms
absolute positioning Incremental positioning preparatory command
address linear interpolation startup block
block modal commend word
G-code onmodal command work offset
4546 Section 1 CNC Mil Programming
3.1 Introduction
‘A CNC program is a series of letters and numbers that, when combined,
create action from the milling machine. A letter and number grouping, used
to execute a command in a program is called a word. The letter preceding
the number in a word is called an address. An address is a single-letter
character that defines what a machine should do with the numerical data
that follows. Addresses are used in programs to designate commands and
‘machine functions. The most commonly used program address is the letter
G, or G-code. A G-code identifies a preparatory command. The purpose
of the preparatory command is to prepare the machine controller, or preset
the machine, into a specific state of operation. This chapter covers the most
commonly used preparatory commands in CNC mill programming.
A G-code positioning command by itself will not create any motion or
‘movement, but it places the machine in the operational mode for the pro-
gram entries that follow. Conversely, the machine will not operate without
the operational mode being set. For example, the line of machine code
below, by itself, will not create any movement from the machine.
x8. ¥3.
Although there is a designated set of coordinates to a target position, the
controller has not been put into an operational mode. Is this a rapid move or
a move at a feed rate? Are these coordinates in inches or in metric units? Are
the coordinates specified in absolute or incremental positioning mode? These
questions cannot be answered without an accompanying G-code address.
3.2 Using G-Codes in a Program
Once the machine is preset into a specific operating mode with the appropriate
G-code command, a motion or movement can occu. For example, the GO
command creates straight-line movement. The programming example shown
in Figure 3-1 moves the machine from its current location, the origin, to the
XS. Y3. position. The GO1 code commands a linear move in a straight line,
The single line of code shown in Figure 3-1 is called a block. A block
isa single word or a series of words forming a complete line of CNC code.
Notice that F20. appears at the end of the block as the last word. The
address code F designates the feed rate. The programmed feed rate is used
by the G01 command and must be specified. The feed rate is the rate at
which the cutting tool moves into the material in inches per minute (ipm)..
This is discussed in more detail in Chapter 5.
Most G-code commands are modal commands, meaning once they are
turned on, the machine stays in that condition until the mode is canceled or
until a subsequent command changes the machine’s condition, Figure 3-2 shows
series of straight-line movements programmed with the G01 command. All of
the movements are ina linear direction and occur in succession because the GOL
command is modal and presets the mode of operation to straight-line movement,
3.3 G-Code Commands
‘The table in Figure 3-3 lists the most commonly used G-code commands.
It is not a complete list, and some codes are specific to certain controller
Copyright Gooanea
sileox Co, oe| Chapter Preparatory Commands: G-Coues 47
98785492 $345678 910
Geosrean ier Pte
Figure 3-1. The GOL command initiates straight-line movement. Its used in the fine
of code shown to move the machine from its current location to the XB. Y3. location,
Y exis
0987455
‘cornea os Pte
Figure 3-2. Using the GO1 command te carry out a series of straight-ine movements.
‘The GO1 command is @ modal command and remains in effect until canceled.
Copyright Goocheart. Wilcox Co, Ine11 1 ONG Mil Programming
Commonly Used G-Codes
GOO Rapid positioning Modal
G02 Linear interpolation in feed mode Medal
G02 Circular interpolation clockwise (CW) Modal
G03 Circular interpolation countercloclwse (CCW) Modal
G04 Dwell in mitiseconds Nonmodal
G09 Exact stop check Nonmodal
G10 Programmable offset setting mode Nonmodal
G11 Cancels G10—Programmable offset setting mode cancel Nonmodal
G15 Polar coordinate command cancel (Fanuc) » Modal
G16 Polar coordinate command (Fanuc) Modal
G17 XY plane designation Modal
G18 XZppane designation Modal
G19_YZ plane designation Modal
620 US Customary units of input Modal
G21 Metric units f input Modal
628 Machine zero return Nonmodal
629—_—Retura from machine zero Nonmodal
630 Machine zero return Nonmedal
G31 Skip function Nonmodal
G40 Cutter compensation cancel Modal
G41 Cutter compensation lft Modal
G42 Cutter compensation right Modal
G43 Tool length offset—pesitve Modal
G44 Tool length offset—negatve Modal
G49__Tool length offset cancel Modal
50 Scaling function cance! Modal
GBI Scaling function Modal
652 Local coordinate system setting Nonmodal
G53 Machine coordinate system Nonmodat
G54 Work coordinate offset 1 Modal
G55 Work coordinate offset 2 Modal
G55 Work coocdinate offset 3 Modal
G57 Werk coordinate offset 4 Modal
658 Work coordinate offset 5 Model
59 Work coordinate offset 6 Modal
G60 Unidirectional positoni Nonmodal
G61 Exact stop made Modal
G62_—_Automatie corner override mode (Fanuc) Modal
G63” Tapping mode (Fanuc) Modal
G64 Cutting mode (Fanuc); cancels G61 (Hees)
665 Custom macro cal
G66 Custom macro medal call (Fanuc)
G67 Custom macro modal call cance! (Fanuc)
Figure 3-3, G-code commangs used in programming, Some machine-specific codes are not listed.
(Copyright Goodheant Wilcox Co In.Chapter 3 Preparatory Commands: G-Codes 49
G68
G69
G70
G71
72
G73
G74
76
G80
csi
a2
83
cas
as
a6
a7
cas
cao
G90
oot
92
698
99
110-6129
Coordinate system rotation
Coordinate system rotation cancel
Bolt hole circle (Haas)
Bolt hole are (Haas)
Balt holes along an angle (Hees)
High speed peck ailing cycle
Left hand threading cycle
Fine boring cycle
Canned cycle cancel
Drilling cycle
Spot drilling cycle
Full retract peck dling cycle
Right hand thread drilling cycle
Boring cycie—bore in, bore out
Boring cycle—bore in rapi¢ out
Back boring cycle (Fanuc)
Boring cycle—bore in, dwell, rapid out (Fanuc)
Boring cycle—bore in, dwell, bore out (Fanuc)
Absolute positioning mode
Incremental positioning mode
Set work coordinate shift amount
Return to initial level in canned cycle
Return to R level in canned cycie
‘Additional work coordinate system locations
Figure 3-3, (Continued)
Moda
Modal
Nonmodal
Nonmodal
Nonmodal
Modal
Modal
Modal
Modal
Modal
Modal
Modal
Modal
Modal
Modal
Modal
Modal
Modal
Modal
Modal
Nonmodal
Modal
Modal
Modal
types. Consult your machine manufacturer's technical manual or website
for exact G-codes that are available. Many of these codes will be discussed
in greater detail in subsequent chapters.
In a CNC program, multiple G-code commands can be used in the
same block of code, as long as they do not have conflicting functions. For
example, a block written as G90 G54 GOO X12. Y-6. is a valid line of
code. Referring to the G-code commands in Figure 3-3, this line is easily
deciphered:
= G90, Establishes absolute positioning mode.
* G54, Designates work coordinate offset 1 as the work coordinate
system.
* G00, Places the machine in rapid positioning mode.
‘This line will instruct the machine to move to the absolute coordinate
position X12. Y-6. in the G54 work coordinate offset in full rapid mode.
‘The G-code commands in this block define the positioning mode for how
coordinates are located, establish the work offset, and define the mode of
movement for the cutting tool. The functions of these commands do not
conflict with each other.
In CNC programming, G-codes are organized into specific groups by
function. The group designation identifies modal G-code commands that
‘Copyright Goodheart Wieox Ca, neMm. 1 CNC Mit Progaming
Tum
Petites
G-Code Entry Format
(On many machines, G-code
commands beginning with a
zero in the digit portion can be
shortened to a single digit fol-
lowing the letter G. For exam-
pile, GOO can be shortened to
G0 and GOI can be shortened
to G1. This altemate format
‘may not be recognized on
older machines.
cannot be in effect at the same time. Multiple G-codes from different groups
‘can be placed on the same block of code, but no two G-codes from the
same group can be specified on the same block. G-codes belonging to the
same group are associated with the same function. For example, a block that,
states G01 G40 G41 D1 X-1 is invalid. The G40 and G41 commands are
both related to the same function: cutter compensation. Cutter compensa-
tion commands are used to compensate for the too! diameter by offsetting
the tool to the left or right of the programmed cutting path. The G40 and
G41 commands have conflicting functions. The G40 command cancels cu
ter compensation and G41 initiates cutter compensation left. If conflicting
G-codes are used on a single block of code, the machine’s alarm will activate,
G-code groups are listed in the table in Figure 3-4. Not all of the
groups are listed, as some pertain only to lathe operations. The number of
groups and the group numbers vary by controller type. Generally, G-code
groups are numbered from Group 00 to Group 25. Group 00 consists of
nonmodal commands. A nonmodal command is only active in the block
in which it appears and terminates as soon as the function is complete. All
other G-code commands are modal and remain in effect until they are can-
celed, or a new G-code command places the machine in a different mode
of operation.
3.3.1 G00: Rapid Positioning
‘The G00 (or GO) command is only used when the tool is not engaged into
the part. This command will move the machine in full rapid movements.
This command is commonly used when going to the home position or
G-Code Groups
Motion commands G00, G01, G02, G03
Dimensioning mode G90, G91
Cutter radius offset G40, G41, G42
Canned cycles G73, G74, G76, GBO, G81, G82, G83, G84,
G85, G86, G87, 688, G89
Scaling cancel G50
Cutting modes G61, G62, G63, G64
Coordinate rotation G68, G69
Figure 3-4,G-code groups.
‘Copyright Goose Wileox Co, Ie.Chapter 3_Prepartory Commands: G-todes 51
G00 x6.
Figure 3.5, The GOO command sets the machine to rapid movement, Shown is @
programmes rapid move tothe X6. postion
coming away from the home position. Figure 3-5 shows a rapid move to
the X6. position.
Caution should be used when programming movement along multiple
axes simultaneously. When a machine is moving in full rapid mode, a block Safety Note
of code with both X and Y coordinates may not necessarily move on a
straight line to that position, depending on the machine. Older machines When using the GOO com-
may move at the same rate along each axis to the nearest position first. See aNd, be cautious of any.
Figure 3-6. possible collisions with this
‘movement. GOO is a modal
‘command, so all movements.
3.3.2 G01: Linear Interpolation following it will be in full rapid
The G01 (or G1) command is used when entering a piece of material while 942 untl itis canceled.
cutting, and when exiting a cut. This command creates linear movement
from the current position toa specified position. Linear interpolation refers
to determining a straight-line distance by calculating intermediate points
between a start point and end point. The G01 command is followed by a
°
(G00 x12. 6,
Figure 3-6, Depending on the machine, raaid movement programmed along two axes
with the GOO command may not occur along a straight ine, Shown is a programmed
move to X12. Y6. Notice that the mavement of the machine was to the closest axis
position first.
‘Copyright Godheart:Wilox Co, nection 1 CNC M
Programming
feed rate command (F command) to designate the rate at which the cutting,
tool moves into the material in inches per minute (ipm). See Figure 3~
When more than one axis of movement is programmed on a single
block of code, the G01 command will make a direct linear move to the
specified coordinates, The example in Figure 3-8 shows a move to X12. Y6.
3.3.3 G02 and G03: Circular interpolation
‘The G02 (G2) and GO3 (G3) commands produce radial or circular tool
movement at a specified feed rate, The GO2 command produces a clock-
wise rotation, and the G03 command produces a counterclockwise rota-
tion. See Figure 3-9.
‘When programming a G02 or G03 command, it is common to use
4 G01 command first to position the tool at the start point of the radius
or arc, then use the G02 or G03 command to complete the arc. The ares
generated can be partial arcs or full circles, depending on the code. Since
these are modal commands, the GO1 command will need to follow the
G02 or G03 command to return the machine condition to linear interpola-
tion mode. Programming methods using the G02 and G03 commands are
explained later in this text.
3.3.4 G20 and G21: Measurement Modes
The G20 and G21 commands set the type of working units used by the
machine. CNC machines can read programs in US Customary units or
metric units. In the US Customary system, also known as the English (or
Imperial) system, the basic unit of linear measurement is the inch. Most
prints for manufacturing in the United States are dimensioned in decimal
inches. On metric prints, dimensions are commonly specified in millime-
ters, Itcan be beneficial to program in one unit format over another. For
‘example, ifthe print is dimensioned in metric units, itis logical to write the
CNC code in the same units.
‘The G20 command sets the machine to use US Customary units. The
G21 command sets the machine to use metric units, Using the G21 com-
mand means that the lines of code and specified offsets will be based on
G01 x-6.F50.
wate eon Pblaar
Figure 3-7. The GO1 command creates linear movement. Shown is a programmed
move to the X-6. position. A feed rate command (F command) follows the GO1
command and specifies the rate at which the cutting tool moves into the material
‘Copyight Goodhesr- Wilcox Co, IeChapter 3. Preparatory Commands: G-Coces
ub
Got X12.¥6. F89,
‘ia
Figure 3-8 The GO1 command creates straight-line movement to the specified
So
. j cr
f
Gos
CCounterclockwise arc Clockwise are
tT
Figure 3-9, The G02 and GO3 commands produce motion in a circular path. The
G02 command generates a clockwise rotation, and the GO3 command generates
counterclockwise rotation,
metric units. Always make sure to specify the correct code for the unit
format. On some machines, the G20 and G21 commands check that the
machine control has been set to the correct mode for the program and will
produce an alarm if the units are not set correctly.
3.3.5 G90 and G91: Absolute and
Incremental Positioning
There are two basic ways to define coordinates for locating machine posi-
tions and movement. The G90 and G91 commands set the positioning
mode used to locate coordinates. The G90 command sets the current posi-
tioning mode to absolute positioning, In this mode, coordinate values are
measured from the coordinate system origin (XO. Y0.). The origin rep-
resents a fixed point from which coordinates are located. This method
Copy Goodhean- Wilcox Co, ine
Cea
Be aware that if tool off-
sets are specified while the
machine is in inch mode and
then the program uses a G21
‘command, the offsets will
not automatically convert.
For example, the machine
will read a 15” offset as a 15,
mm offset. This is potentially
dangerous and can result in a
machine crash. Always specify
the appropriate unit format
for machining and do not use
more than one unit format in a
Program.54
locates absolute coordinates and is the appropriate positioning method for
most purposes.
The G91 command sets the current positioning mode to incremental
positioning. In chis mode, coordinate values are measured from the current
point to the next point. Incremental coordinates represent a relative mea-
surement from the current position of the tool, not from the coordinate
system origin. Incremental coordinates are also called relative coordinates
because they are located relative to the previous coordinat
Figure 3-10 shows coordinates located with each positioning method.
The coordinates are represented as Point 1 and Point 2. Each point rep-
resents a possible destination position for the cutting tool. The tool start,
position is the coordinate X7. YS.
A block of code written as G90 G01 X-6. Y-5. F50, will take the tool
to Point 1. The G90 command specifies absolute positioning and locates
the coordinate in relation to the coordinate system origin. Point 1 is the
absolute coordinate X-6. Y-S.
A block of code written as G91 G01 X-6, Y-5. F50. will take the
tool to Point 2. The G91 command specifies incremental positioning. The
same X-6. Y-S. coordinate is used, but the coordinate is an incremental
ra
+19
+8
+8
tr
+6 Too! stat postion
4s
46
13
+2
40997854924 2045678900
aoe ee
Goorin system org
Xaxls
at Point 2
Point ¢ 6
Figure 3-10. The G90 and G91 commands provide two different ways to locate
coordinates for tool moves. The G90 command activates absolute positioning mode
‘and moves the tool from its current position (the start postion) to an absolute position
‘measured from the origin. The coordinate entry X-6. Y-5. moves the tool to Point 1.
The G91 command activates incremental positioning made and moves the tool from its
current position an incremental amount in the specified axis direction. The coordinate
entry X-6. Y-8. lacates the toal at Point 2. This changes the cutter path and results in
a different finish location for the move,
Copyright Goodhear cox Co, necoordinate located in relation to the current position of the tool. The cur-
rent position is the tool start location, not the origin. This locates Point 2
six units in the negative X axis direction and five units in the negative Y axis,
direction from the X7. Y5. tool start location. Notice that using the G91
command results in an entirely different cutter path and finish location.
‘Moves defined with absolute positioning are used for most program-
ming applications. Incremental positioning moves must be programmed
carefully because if an incorrect coordinate position is specified, all sub-
sequent moves will be incorrect. Incremental moves are used when it is
appropriate to specify coordinates relative to the current position. A prac-
tical use for incremental positioning in a program is drilling a pattern of
holes aligned along a straight path, as explained in Chapter 10,
3.3.6 G40, G41, and G42: Cutter Compensation
The G41 and G42 commands are used to offset the tool to the left or right
of the programmed cutting path, When programming coordinate positions
in a CNC program, the centerline of the spindle is being moved to those
points. The machine does not consider the diameter of the cutting tool
being used. To offset the center of the tool and allow the tool edge to fol-
low the correct path, the G41 or G42 command is used. Each command
uses the stored radius offset setting for the cutting tool. The G41 command
activates left-hand cutter compensation and the G42 command activates
right-hand cutter compensation. If the tool is cutting on the left-hand side
of the material, the G41 command is used. The G42 command will offset
the tool to the right-hand side of the part or piece of material. The offset
direction of the tool is determined by viewing the tool from behind as it
moves in the cutting direction. See Figure 3-11.
The G41 and G42. commands are modal commands and will continue
to offset the tool for any additional moves until canceled. The G40 com-
mand cancels the G41 or G42. command,
Additional explanations and examples of the G41 and G42 commands
and other G-code commands executed for specific programs are provided
later in this text,
,
LL =
——~pirection of cutor Direation of cuter —
G41 command G42. command
Cutter compensation left Cutter compensation right
costes ea Aer
Figure 3-11. The G41 command offsets the too! to the left of the programmed cutting
path. The G42 command offsets the tool to the right of the programmed cutting path.
“The offset direction corresponds to the side of the part machined when viewing the
tool from behind in the direction of the cutting path.
(Copyright Goodneart Wax Co, Ie.
ae
Perel
G41: Left-Hand Cutter
Compensation
In most contour milling
operations, the cutting tool is
positioned to cut material on
the left side of the part. Most
milling programs created for
these operations use the G41
command to establish left-
hand cutter compensation.
ShyMil Programming
3.3.7 G54: Work Offset
AAs previously discussed, the work coordinate system (WCS) defines the
X0. YO. origin location of the part. In CNC programming, the work coor-
dinate system can be defined as a work offset. A work offset is a coor
dinate setting that establishes the location of the work origin relative to
the machine home position. Coordinates for a work offset are entered by
the operator into the machine during setup. The appropriate work offset
command is used in the program to designate the work coordinate sys-
tem. For example, the G54 command is used to activate work coordinate
offset 1 as the work coordinate system. This command is commonly used
when machining a single part. On most machines, itis possible to set a
number of work offsets referenced to specific programming commands.
The GSS, G56, G57, G58, and G59 commands are additional work offset
commands used for this purpose. Multiple work offsets are defined when
several parts are to be machined in one program. During setup, each work-
piece is secured and work offsets are defined to establish a different work
origin for each part.
3.4 Startup Blocks
Most CNC programmers will begin new programs with a startup block.
This block, also referred to as a default block or safety block, cancels any
machine conditions left from the previous program or establishes a new
starting condition for the current program. Canceling modes that may have
been previously active prevents errors and helps ensure the machine will
start and operate safely. A startup block usually contains the appropriate
commands to set the unit format and positioning mode. While this practice
can vary from programmer to programmer, a typical startup block could
be written as G90 G80 G17 G40 G20. The commands are read as follows:
= G90, Establishes absolute positioning mode
= G80, Cancels a previously active canned cycle.
* G17. Designates the XY plane for machining,
* G40. Cancels cutter compensation.
= G20, Places the machine in inch mode.
Copyright Goosnear- Wilcox Co, Ic