Test = false       ' testet December 12/2011, use onely for turn mode                                                              ' do not work in scaling mode ( G51 Z <> +1 ) (issue in Mach3)EndZ = tEndZ()     ' this is the Z in the G83  , must be included,                                 Q = Abs(tInFeed()) ' Q value , must be included                                     R = tZClear()      ' R value, must be included                                                                                           StartZ = tZStart()                                   scaling = GetOemDro(61)  ' look is scaling activeIf scaling <> 1 Then                                 message("scaling active on G83 turn cycle !")MsgBox("scaling active on G83 turn cycle !")Code "M30"EndEnd If                                             If EndZ< R Then                 Right_Left = -1                 Else                 Right_Left =  1                 End If                 ZClearance = 0.02                                 If GetLED (2) Then                                   ZClearance = ZClearance * 25.4                                  End If If Right_Left = -1 Then                          ZClearance = ZClearance                                                                   Else ZClearance = ZClearance * Right_Left              End If                                  Last_Pass = 0           NCounter = 1                                   Last_Depth = R        If Test = True Then                                    OpenTeachFile( "TestIt.tap")        Code "(R= " & R &")"                    Code "(Z= " & EndZ &")"           Code "(Q= " & Q &")"   Code "(Right_Left= " & Right_Left &")"           Code "(Last_Depth= " & Last_Depth &")"              End If           Code "G00 Z" & R  Do                                                If Last_Depth - ZClearance = EndZ ThenCode "G00 Z" & StartZ              End If         Depth_pass = (NCounter * Q * Right_Left)+R                             If Right_Left = -1 ThenIf Depth_pass <= EndZ Then                                 Depth_pass = EndZ                                   Last_Pass = 1                                   End If                                   ElseIf Depth_pass >= EndZ Then                                 Depth_pass = EndZ                                   Last_Pass = 1                                   End IfEnd IfCode "G01 Z" & Depth_Pass                                  If(Last_Pass < 1) Then                                Code "G00 Z" & RElse  Code "G00 Z" & StartZ  End If                                                               Last_Depth = Depth_Pass + ZClearance If(Last_Pass < 1) ThenCode "G00 Z" & Last_DepthEnd If                                   NCounter = NCounter + 1If NCounter = 300 Then Exit Do                                   Loop While (Last_Pass < 1)                                 If Test = True Then                   CloseTeachFile()                   LoadTeachFile()           End If                           