' Mar 04 - 2008 Changed loop limit on line 119 from 30 to 300.  Change made
'               By John Guenther, j.guenther@verizon.net

' Feb 25 - 2005 Got the Macro working and will do a Full peck with                      

  'C=0 and High speed peck the C=1 that will retract to the last peck depth                                  

' Feb 23 - 2005 Added parameters and file call to Turn section                                   

                                   

' DRill G83 X (optional)  Z (mandatory) Q (Mandatory) R                        

                    

' added tTaper to replace C parameter C will be 0 for G83, 1 for G83.1                    

                     

Test = False                  

                       

EndX = tEndX() ' this is the X in the G83 call                                   

EndZ = tEndZ() ' this is the Z in the G83                                   

 Q = ABS(tInFeed()) ' Q value , must be included.                                    

 R = tZClear() ' R value, must be specified                                   

 C = tTaper() ' C value will be zero or one    

 RMode = RetractMode()  

                                

StartZ = tZStart()                                   

' code here for drill cycle..                 

If EndZ< R Then                 

Right_Left = -1                 

Else                 

Right_Left = 1                 

End If                 

                                   

ZClearance = .01                                  

If GetLED (2) Then                                   

ZClearance = ZClearance *25.4                                  

End If                                  

Code "G00 Z" & R & "X" & EndX                                   

Last_Pass = 0           

NCounter = 1                                   

Last_Depth = R        

If Test = True Then                                    

OpenTeachFile( "TestIt.tap")        

Code "(R= " & R &")"           

Code "(X= " & EndX &")"           

Code "(Z= " & EndZ &")"           

Code "(Q= " & Q &")"           

Code "(Right_Left= " & Right_Left &")"           

Code "(Last_Depth= " & Last_Depth &")"    

Code "(Mode is " & C & ")"           

End If           

Code "G00 Z" & Last_Depth 

Do                                    

Depth_pass = NCounter * Q *Right_Left                                  

If Depth_pass <= EndZ Then                                    

Depth_pass = EndZ                                   

Last_Pass = 1                                   

End If                                   

Code "G01 Z" & Depth_Pass                                   

If C = 1 Then                                  

Code "G00 Z" & Last_Depth                                  

Else                                  

Code "G00 Z" & R                                   

End If                                  

Last_Depth = Depth_Pass + ZClearance                                    

NCounter = NCounter + 1          

If NCounter = 300 Then Exit Do                                   

Loop While (Last_Pass < 1)   

If RMode = 1 Then                                

  Code "G00 Z" & StartZ  

End If       

If Test = True Then                   

CloseTeachFile()                   

LoadTeachFile()           

End If                               

                                 

                                   
 