'MACRO incremental probing -X, stepover -Y''this macro runs probing code and checks for edge losing'retracts probe after a hit by stepover distance'DRO#s:'Stepover:	1002'Probing FR: 	1003'Retact FR: 	1004'Probe Travel: 	1005'Xlength: 	1006'Ylength: 	1007Option ExplicitDim PAx, PAxN, SAx, DP, DS' probing axisPAx="X"	If PAx="X" Then   PAxN=0Else   PAxN=1End If' probing directionDP=-1	' Stepover axisSAx="Y"' stepover directionDS=-1Dim StepoverStepover = getoemdro(1002)Dim NN = 1 + Int(getoemdro(1007) / Stepover)Dim Pos1, Pos2, ProbeTravel ProbeTravel = getoemdro(1005) * DP ' dirction of probingDim ProbFR, RetrFRProbFR = getoemdro(1003)RetrFR = getoemdro(1004)Dim RetrcDist1, RetrcDist2, OverTravel, codestrRetrcDist1 = Stepover * -1 * DP ' neg proping direction' normal retractRetrcDist2 = (abs(ProbeTravel)-(Stepover*1.5)) * -1 *DP ' neg probing direction' lost edge retractcode "G71 G91"Pos1 = opendigfile()While N>0  ' allow for finishing of moves  While IsMoving()    Sleep (100)  Wend  Pos1= getdro(PAxN)  ' remember starting position   code "G91 G31 " & PAx & ProbeTravel & "F"&ProbFR  'do probing  While IsMoving()    Sleep (100)  Wend  Pos2= getdro(PAxN)  ' notice final position  ' test for lost edge  OverTravel=Abs(Pos2-Pos1)-Abs(ProbeTravel)+0.2     If Overtravel < 0  Then  ' next sample  Else  ' lost edge    code "G00 " & PAx & RetrcDist2    N=0 ' terminate loop  End If  ' set retract feed rate    code "F" & RetrFR    ' extended retract ?  If getoemled(1168) Then code "G01 " & PAx & RetrcDist1    ' normal circular retract  If PAx="X" Then    If (DP*DS)=1 Then 	codestr = "G2"    Else 	codestr = "G3"    End If    codestr = codestr & "X" & RetrcDist1 & "Y" & (DS*Stepover) & "J" & (DS*Stepover)  Else  ' PAx="Y"     If (DP*DS)=1 Then 	codestr = "G3"    Else 	codestr = "G2"    End If    codestr = codestr & "X" & (DS*Stepover) & "Y" & RetrcDist1 & "I" & (DS*Stepover)  End If  If N>1 Then     code codestr    ' circular retract if not last cycle  Else    If N>0 Then code "G00" & PAx &RetrcDist1    ' linear retract on last cycle  End If    N = N-1Wendclosedigfile()code "G90"code "M30"End        