Rem VBScript To center probe inside a pipe If GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty Code "(Probe plate is grounded, check connection and try again)" Else FeedCurrent = GetOemDRO(818) 'Get the current settings XCurrent = GetDro(0) YCurrent = GetDro(1) Code "G4 P1" 'Pause 1 second to give time to position probe plate Code "F100" 'slow feed rate to 4 ipm Rem Probe left Rem 'probe 3 inches to left--->>>75cm XNew = Xcurrent - 75 'probe 75cm to left Code "G31 X" &XNew While IsMoving() 'wait for the move to finish Wend REM Append 20090802SEC ------------------ Code "F20" Code "G0 G91 X1" Code "G90 G31 X" &XNew While IsMoving() 'wait for the move to finish Wend Code "F100" REM -------------------------------------- XPos1 = GetVar(2000) 'get the probe touch location Code "G0 X" &XCurrent 'rapid move back to start point Rem Probe right Rem 'probe 3 inches to right--->>>75cm XNew = XCurrent + 75 'probe 75cm to to right Code "G31 X" &XNew While IsMoving() Wend REM Append 20090802SEC ------------------ Code "F20" Code "G0 G91 X-1" Code "G90 G31 X" &XNew While IsMoving() 'wait for the move to finish Wend Code "F100" REM -------------------------------------- XPos2 = GetVar(2000) XCenter = (XPos1 + XPos2) / 2 'center is midway between XPos1 and XPos2 Code "G0 X" &XCenter 'rapid move to the x center location Rem Probe up Rem 'probe 3 inches to F--->>>75cm YNew = YCurrent + 75 Code "G31 Y" &YNew While IsMoving() Wend REM Append 20090802SEC ------------------ Code "F20" Code "G0 G91 Y-1" Code "G90 G31 Y" &YNew While IsMoving() 'wait for the move to finish Wend Code "F100" REM -------------------------------------- YPos1 = GetVar(2001) Code "G0 Y" &YCurrent Rem Probe down Rem 'probe 3 inches to B--->>>75cm YNew = YCurrent - 75 Code "G31 Y" &YNew While IsMoving() Wend REM Append 20090802SEC ------------------ Code "F20" Code "G0 G91 Y1" Code "G90 G31 Y" &YNew While IsMoving() 'wait for the move to finish Wend Code "F100" REM -------------------------------------- YPos2 = GetVar(2001) YCenter = (YPos1 + YPos2) / 2 Rem move to the center Code "G0 Y" &YCenter While IsMoving () Wend Code "F" &FeedCurrent 'restore starting feed rate End If