5 Generating loops Introduction to looping

Slides:



Advertisements
Similar presentations
CANNED CYCLES AND SUBROUTINES
Advertisements

Circular interpolation
Relates to machining and turning centers. Commonly taught in basic CNC courses: Techniques with sequence numbers 3N words are sequence numbers 3Not needed.
3300M CNC Control Lines and Arcs. Lines and arcs can be access in two ways. 1. Using hot keys. 2.Using soft keys Press 1 Rapid 2 Line 3 Arc Accesses Rapid.
CNC Programming “Milling”
MILLING.
Know the Code… Students will participate in an activity that will help them understand CNC programming and how machines read programmed information.
CMPS 1371 Introduction to Computing for Engineers
Industrial Engineering Department King Saud University
2.5D machining Contents. Geometry model import Import of a *.3dm model. The model is a collection of closed plane contours. View of contours in the viewport.
Programming Epson Robots – Part 2 ME 4135 – Fall 2012 Dr. R. Lindeke.
Drill cycle 1. Position the X and Y to the proper coordinates with a rapid traverse move G00, 2. Position the Z axis to a clearance plane, 3. Feed the.
Parametric Programming For CNC Machining Centers and Turning Centers Copyright 1999 Demo Only!! * Most items restricted * Poor sound quality (minimizes.
H4CL-M M-codes and G-Codes
Repetition Statements Repeating an Action A specified number of times While a Condition is True Until a Condition is True.
Chapter 2 - Algorithms and Design
CPS120: Introduction to Computer Science Decision Making in Programs.
Motion Manipulation Words G32 – Thread cutting G15 & G16 – Polar coordinates G50 & G51 – Scaling G50.1 & G51.1 – Mirror image G60 – Single direction positioning.
2 Variable Techniques Understanding variables Variables in custom macro B Presentation links page for lesson two Arguments Local variables Common variables.
1 Chapter 2 - Algorithms and Design print Statement input Statement and Variables Assignment Statement if Statement Flowcharts Flow of Control Looping.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
1 Introduction General information Comparison to subprogramming … to computer programming … to canned cycles Application categories Limitations Computer.
CS 121 – Quiz Feb 17 th. Question 2 We want to count how many days there were such that the temperature is at least degrees lower than the.
Introduction To CNC-Programming
Milling Circles and Arcs and Milling with Canned Cycles 04/23/08.
Loops Tonga Institute of Higher Education. Introduction Programs need to be able to execute tasks repeatedly. Use loops to repeat actions  For Loop 
Relates only to machining centers & turning centers with live tooling.
4 th Production & 2 nd Mechatronics. Ch4… Repetitive machining sequences Standard fixed cycles Non-Standard fixed cycles Cycles devised by part programming.
CNC Letters NOTE: The following will be a listing and description of Computer Numerical Control (CNC) Codes and Letter designations. We will try to stick.
The Little man computer
Fundamentals of PL/SQL part 2 (Basics)
Chapter 6: Loops.
Relates mostly to machining centers
Loops BIS1523 – Lecture 10.
Special motion types Special interpolation types Helical motion
Some Additional G code Features
Relates to machining and turning centers
CS1371 Introduction to Computing for Engineers
Karel J Robot Chapter 6.
CS 115 Lecture 8 Structured Programming; for loops
12 Examination 1. Which of the below commands can be used to make decision in program based on a condition? a. If…else b. Set c. Switch d. Assignment e. Wait.
G-Code Primer Quick review G0 X__ Z__ rapid traverse
Part Programming Turning Applications.
Relates to machining and turning centers
JavaScript: Control Statements.
Counted Loops.
Chapter 13 Control Structures
THE UNIT CIRCLE.
Using Surfcam to Produce a Numeric Control (NC) Program
Chapter 13 Control Structures
ЧПУ Delta Electronics G-коды. Примеры
Java Programming Loops
Inductive Reasoning Inductive Reasoning: is the process of forming a conjecture based on a set of observations One of the most important things in mathematics…one.
Structured Programming Taken from notes by Dr. Neil Moore
THE UNIT CIRCLE.
THE UNIT CIRCLE.
Three Special Structures – Case, Do While, and Do Until
G-Code Primer - Review Quick review G00 X__ Z__ rapid traverse
Algorithm and Ambiguity
Introduction to Repetition Structures
Welcome Mill Lesson 15 – Part-3
2.1 Inductive Reasoning Inductive Reasoning: is the process of forming a conjecture based on a set of observations One of the most important things in.
CAM与自动编程 封志明
Java Programming Loops
THE UNIT CIRCLE.
Based on slides created by Bjarne Stroustrup & Tony Gaddis
CAM与自动编程 封志明
Miniature Train.
G-Code Primer - Review Quick review G00 X__ Z__ rapid traverse
Presentation transcript:

5 Generating loops Introduction to looping Presentation links page for lesson five 5 Generating loops Introduction to looping Comparison to sub-programming A loop that counts to ten Steps to looping How many executions are required? What changes each time through? Peck drilling example application

We can compare looping to subprogramming Looping Defined Looping is the act of causing the control to execute a series of commands a specified number of times Definition: We can compare looping to subprogramming

Comparison To Subprogramming As you know, subprograms can be repeated Repeat subprogram 5 times M98 P1000 L5 But nothing can change from one execution to the next

Comparison To Subprogramming Anything can change each time through a loop! Angular hole position changes Bolt hole circle

Comparison To Subprogramming Anything can change each time through a loop! Angular hole position changes Bolt hole circle

Comparison To Subprogramming Anything can change each time through a loop! Angular hole position changes Bolt hole circle

Comparison To Subprogramming Anything can change each time through a loop! Angular hole position changes Bolt hole circle

Comparison To Subprogramming Anything can change each time through a loop! Angular hole position changes Bolt hole circle

Comparison To Subprogramming Anything can change each time through a loop! Angular hole position changes Bolt hole circle

Comparison To Subprogramming Anything can change each time through a loop! Angular hole position changes Bolt hole circle

Comparison To Subprogramming Anything can change each time through a loop! Angular hole position changes Bolt hole circle

Multiple pass grooving Comparison To Subprogramming Multiple pass grooving Z position Z position changes

Multiple pass grooving Comparison To Subprogramming Multiple pass grooving Z position changes

Multiple pass grooving Comparison To Subprogramming Multiple pass grooving Z position changes

Multiple pass grooving Comparison To Subprogramming Multiple pass grooving Z position Z position changes

Multiple pass grooving Comparison To Subprogramming Multiple pass grooving Z position changes

Multiple pass grooving Comparison To Subprogramming Multiple pass grooving Z position changes

Multiple pass grooving Comparison To Subprogramming Multiple pass grooving Z position Z position changes

Multiple pass grooving Comparison To Subprogramming Multiple pass grooving Z position changes

Multiple pass grooving Comparison To Subprogramming Multiple pass grooving Z position changes

Comparison To Subprogramming Peck drilling Z positions change

Comparison To Subprogramming Peck drilling Z positions change

Comparison To Subprogramming Peck drilling Z positions change

Comparison To Subprogramming Peck drilling Z positions change

Comparison To Subprogramming Peck drilling Z positions change

Comparison To Subprogramming Peck drilling Z positions change

Comparison To Subprogramming Peck drilling Z positions change

Comparison To Subprogramming Peck drilling Z positions change

Comparison To Subprogramming Peck drilling Z positions change

Comparison To Subprogramming Peck drilling Z positions change

Comparison To Subprogramming Peck drilling Z positions change

Comparison To Subprogramming Peck drilling Z position changes

A Loop That Counts To Ten O2000 (Custom macro B) #101 = 1 N1 IF[#101GT10] GOTO 99 (Calculate if necessary) (Motions for this execution) #101 = #101+1 GOTO 1 N99 M99

A Loop That Counts To Ten Program number O2000 (Custom macro B) #101 = 1 N1 IF[#101GT10] GOTO 99 (Calculate if necessary) (Motions for this execution) #101 = #101+1 GOTO 1 N99 M99

A Loop That Counts To Ten Initialize counter O2000 (Custom macro B) #101 = 1 N1 IF[#101GT10] GOTO 99 (Calculate if necessary) (Motions for this execution) #101 = #101+1 GOTO 1 N99 M99

A Loop That Counts To Ten Test if finished with loop O2000 (Custom macro B) #101 = 1 N1 IF[#101GT10] GOTO 99 (Calculate if necessary) (Motions for this execution) #101 = #101+1 GOTO 1 N99 M99 Now false

A Loop That Counts To Ten Calculations would go here O2000 (Custom macro B) #101 = 1 N1 IF[#101GT10] GOTO 99 (Calculate if necessary) (Motions for this execution) #101 = #101+1 GOTO 1 N99 M99

A Loop That Counts To Ten Motions would go here O2000 (Custom macro B) #101 = 1 N1 IF[#101GT10] GOTO 99 (Calculate if necessary) (Motions for this execution) #101 = #101+1 GOTO 1 N99 M99

A Loop That Counts To Ten Step the counter by one (now 2) O2000 (Custom macro B) #101 = 1 N1 IF[#101GT10] GOTO 99 (Calculate if necessary) (Motions for this execution) #101 = #101+1 GOTO 1 N99 M99

A Loop That Counts To Ten Go back to the test O2000 (Custom macro B) #101 = 1 N1 IF[#101GT10] GOTO 99 (Calculate if necessary) (Motions for this execution) #101 = #101+1 GOTO 1 N99 M99

A Loop That Counts To Ten Test if finished O2000 (Custom macro B) #101 = 1 N1 IF[#101GT10] GOTO 99 (Calculate if necessary) (Motions for this execution) #101 = #101+1 GOTO 1 N99 M99 Still false

A Loop That Counts To Ten Calculations would go here O2000 (Custom macro B) #101 = 1 N1 IF[#101GT10] GOTO 99 (Calculate if necessary) (Motions for this execution) #101 = #101+1 GOTO 1 N99 M99

A Loop That Counts To Ten Motions would go here O2000 (Custom macro B) #101 = 1 N1 IF[#101GT10] GOTO 99 (Calculate if necessary) (Motions for this execution) #101 = #101+1 GOTO 1 N99 M99

A Loop That Counts To Ten Step counter by one (now 3) O2000 (Custom macro B) #101 = 1 N1 IF[#101GT10] GOTO 99 (Calculate if necessary) (Motions for this execution) #101 = #101+1 GOTO 1 N99 M99

A Loop That Counts To Ten Go back to test O2000 (Custom macro B) #101 = 1 N1 IF[#101GT10] GOTO 99 (Calculate if necessary) (Motions for this execution) #101 = #101+1 GOTO 1 N99 M99

After ten executions, this will be true! A Loop That Counts To Ten Counter will eventually be 11 O2000 (Custom macro B) #101 = 1 N1 IF[#101GT10] GOTO 99 (Calculate if necessary) (Motions for this execution) #101 = #101+1 GOTO 1 N99 M99 After ten executions, this will be true!

A Loop That Counts To Ten GOTO sends control to end of loop O2000 (Custom macro B) #101 = 1 N1 IF[#101GT10] GOTO 99 (Calculate if necessary) (Motions for this execution) #101 = #101+1 GOTO 1 N99 M99

Steps To Looping Warning! 1) Initialize Counter Number of executions Initialize counter, number of executions, and anything that changes each time through the loop Warning! 1) Initialize Counter Number of executions Anything that changes Change-by amounts Constant variable values Constant position values Always determine the number of executions up-front – You’ll often be tempted to test against axis position to see if your finished

Steps To Looping 1) Initialize 2) Test to see if finished Counter Test if counter is greater than number of executions 1) Initialize Counter Number of executions Anything that changes Change-by amounts Constant variable values Constant position values 2) Test to see if finished If counter is greater-than executions

Steps To Looping 3) Make calculations 4) Perform the loop’s intention Not all loops require this step Make the control do one execution of the loop 3) Make calculations for this loop execution if necessary 4) Perform the loop’s intention Machine workpiece workpiece drill one hole make one milling pass make one peck Make positioning movement Test an offset

Steps To Looping 5) Step anything that changes 6) Go back to the test What changes each time through the loop? The test will eventually be true 5) Step anything that changes Counter Anything else that changes 6) Go back to the test GOTO statement label before test

Two Times Loops Are Required Most common 1) When the number of executions changes 2) When redundant commands can be reduced

How Many Executions? 8 holes You must determine how many times the loop is executed Sometimes it’s easy: Bolt circle 8 holes

The number of holes is the number of executions How Many Executions? You must determine how many times the loop is executed Sometimes it’s easy: 16 holes The number of holes is the number of executions

Divide hole depth by peck depth to determine number of executions How Many Executions? Sometimes it’s harder: Hole depth: 3.0 Peck depth: 1.0 Divide hole depth by peck depth to determine number of executions # of passes = Hole depth Peck depth 3.0 1.0 3 pecks

How Many Executions? Hole depth: 3.125 Peck depth: 1.0 4 pecks? Sometimes it’s harder: But wait… Hole depth: 3.125 Peck depth: 1.0 The hole depth is not evenly divisible by the peck depth! But remember, you must determine the number of executions up front! 3.125 1.0 4 pecks?

We’ve recalculated the peck depth to generate an even number of pecks! How Many Executions? Sometimes it’s harder: Hole depth: 3.125 Peck depth: 1.0 We’ve recalculated the peck depth to generate an even number of pecks! # of pecks = ROUND[HD/PD] 3.125 1.0 Peck depth = HD / # of pecks 3 Pecks 1.0416 per peck

The passes must overlap! How Many Executions? Sometimes it’s much harder: Minimum overlap Passes = FUP[GW / [TW-.02]] 0.125 The passes must overlap! 2 passes? 0.25

How Many Executions? 3 passes Passes = FUP[GW / [TW-.02]] 0.125 0.25 Sometimes it’s much harder: Passes = FUP[GW / [TW-.02]] 0.125 3 passes 0.25

How Many Executions? Regardless of how difficult it seems… Always determine the number of passes “up-front”!

The XY position changes each time through the loop What Changes Each Time? 3. 1. 45 8 holes The XY position changes each time through the loop

What Changes Each Time? X Y

What Changes Each Time? X Y

What Changes Each Time? X Y

What Changes Each Time? X Y

What Changes Each Time? X Y

What Changes Each Time? X Y

What Changes Each Time? X Y

What Changes Each Time? But wait, what is the XY position determined by? The hole’s angular position! X Y

What Changes Each Time? cos[ang] * radius sin[ang]* radius

What Changes Each Time? Current angle: 45 degrees

What Changes Each Time? Current angle: 90 degrees

What Changes Each Time? Current angle: 135 degrees

What Changes Each Time? Current angle: 180 degrees

What Changes Each Time? Current angle: 225 degrees

What Changes Each Time? Current angle: 270 degrees

What Changes Each Time? Current angle: 315 degrees

What Changes Each Time? Current angle: 360 degrees

What is the incremental angular distance between the holes? What Changes Each Time? What is the incremental angular distance between the holes? Distance between = 360 / number of holes

What Changes Each Time? Arguments: Hole depth: 3.125 Peck depth: 1.0 As initialized: Number of passes: 3 Peck depth: 1.0416 -3.125 Changing variables: Current appr.: 0.1 Current depth: -1.0416 Change: -1.0416

What Changes Each Time? Arguments: Hole depth: 3.125 Peck depth: 1.0 2nd peck: As initialized: Number of passes: 3 Peck depth: 1.0416 -3.125 Changing variables: Current appr.: -0.9416 Current depth: -2.0832 Change: -1.0416

What Changes Each Time? Arguments: Hole depth: 3.125 Peck depth: 1.0 3rd peck: As initialized: Number of passes: 3 Peck depth: 1.0416 -3.125 Changing variables: Current appr.: -1.9832 Current depth: -3.1248 Change: -1.0416

What Changes Each Time? Z position GW: 0.25 TW: 0.125 3 passes Current Z pos: -1.0 (0.0625) Move over amount: [.25 - .125] / [3-1]

What Changes Each Time? Z position GW: 0.25 2nd pass TW: 0.125 3 passes Current Z pos: -.9375 (0.0625) Move over amount: [.25 - .125] / [3-1]

You must determine what changes each time through the loop! GW: 0.25 TW: 0.125 3rd pass Z position 3 passes Current Z pos: -.875 You must determine what changes each time through the loop! (0.0625) Move over amount: [.25 - .125] / [3-1]

There may be other values needed within the loop Any Other Initialized Values? All changing values must be initialized (set to a starting value) at the beginning of the loop Changing values must be stepped (by the step amount) at the end of the loop There may be other values needed within the loop

Any Other Initialized Values? Bolt hole pattern: Rapid plane Hole bottom position These values are not being stepped. But they are initialized to save calculations each time through the loop. Peck drilling: Initial approach position Grooving: X axis approach Groove bottom position

Prior Positioning Movement? Many loop applications require a prior positioning movement before the loop Bolt hole pattern: To center of the pattern Peck drilling: To Z approach position Grooving: To approach position

What Must Happen Each Time? You must determine what happens each time through the loop Bolt hole pattern: Machine one hole Peck drilling: Make one peck & retract Be careful! Beginners tend to do too much! Grooving: Make one plunge & retract

Peck Drilling Example Main program: O0001 (1/2 drill) N005 T01 M06 N010 G54 G90 S200 M03 T02 N015 G00 X2. Y2. N020 G43 H01 Z0.1 N025 G65 P1001 X2. Y2. R.1 Z-4.0 Q1.5 F5. N030 G65 P1001 X3. Y2. R.1 Z-4.0 Q1.5 F5. N035 G91 G28 Z0 M19 N040 M01

Peck Drilling Example Main program: O0001 (1/2 drill) N005 T01 M06 N010 G54 G90 S200 M03 T02 N015 G00 X2. Y2. N020 G43 H01 Z0.1 N025 G65 P1001 X2. Y2. R.1 Z-4.0 Q1.5 F5. N030 G65 P1001 X3. Y2. R.1 Z-4.0 Q1.5 F5. N035 G91 G28 Z0 M19 N040 M01

Peck Drilling Example Main program: O0001 (1/2 drill) N005 T01 M06 N010 G54 G90 S200 M03 T02 N015 G00 X2. Y2. N020 G43 H01 Z0.1 N025 G65 P1001 X2. Y2. R.1 Z-4.0 Q1.5 F5. N030 G65 P1001 X3. Y2. R.1 Z-4.0 Q1.5 F5. N035 G91 G28 Z0 M19 N040 M01

Peck Drilling Example Main program: O0001 (1/2 drill) N005 T01 M06 N010 G54 G90 S200 M03 T02 N015 G00 X2. Y2. N020 G43 H01 Z0.1 N025 G65 P1001 X2. Y2. R.1 Z-4.0 Q1.5 F5. N030 G65 P1001 X3. Y2. R.1 Z-4.0 Q1.5 F5. N035 G91 G28 Z0 M19 N040 M01 #24 #17 #7 #18 #25 #9

Peck Drilling Example In custom macro B: O1001 #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Program number O1001 #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Initialize counter O1001 #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Initialize amount of Z motion #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Initialize number of passes #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Initialize recalculated peck depth O1001 #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Initialize current approach position O1001 #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Initialize current bottom position O1001 #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Rapid to hole center in XY #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Rapid to R plane O1001 #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Test if loop is finished #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Rapid to current Z approach position O1001 #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B: This positioning movement is not required the first time through the loop

Peck Drilling Example In custom macro B: Feed to current peck depth #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Retract out of hole O1001 #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Step counter O1001 #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Step current Z approach position O1001 #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Step current peck bottom position O1001 #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Go back to test O1001 #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Are we done now? (no) O1001 #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Rapid to current Z approach position O1001 #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B: For each successive peck, this movement is necessary (the tool is at the initial approach position)

Peck Drilling Example In custom macro B: Drill to current peck depth #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Retract out of hole O1001 #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Step counter O1001 #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Step current approach position O1001 #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Step current peck bottom #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

Peck Drilling Example In custom macro B: Go back to test O1001 #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B:

After the last peck, this IF statement will be true Peck Drilling Example Are we done yet? O1001 #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B: After the last peck, this IF statement will be true

Peck Drilling Example In custom macro B: End of loop (and custom macro in this case) O1001 #101 = 1 (Counter) #102 = #18 - #26 (Total Z movement) #103 = ROUND[#102 / #17] (# of passes) #104 = #102 / #103 (New peck depth) #105 = #18 (Current peck approach) #106 = -[#104] (Current peck bottom) G00 X#24 Y#25 (Rapid to hole XY position) Z#18 (Rapid to initial Z approach position) N1 IF [#101 GT #103] GOTO 99 (IF finished, exit) G00 Z#105 (Rapid to current peck approach) G01 Z#106 F#9 (Machine to current peck bottom) G00 Z#18 Retract to initial rapid plane) #101 = #101 + 1 (Step counter) #105 = #105 - #104 (Step current peck approach) #106 = #106 - #104 (Step current peck bottom) GOTO 1 (Go back to test) N99 M99 (End of custom macro) In custom macro B: