' Macro to determine probe diameterOption ExplicitDim Xr, Xl, Xz, Yo, Yu, Yz, PdX, PdY, CFDim Xpos, Ypos, Zposcode "G90 G00Z4"While IsMoving()       'wait while it happensWendCF = GetOemDRO(818)       'Get the current feedrate to return to latersetoemDRO(221,0)'If GetOemLed (825)=0 Then       'Check to see if the probe is already grounded or faulty   Xpos = GetDro(0)   Ypos = GetDro(1)   Zpos = GetDro(2)' find center' ------ Probe in -X direction ------      Code "G31 X" & Xpos -50 & " F200"   'probing move, can set the feed rate here as well as how far to move   While IsMoving()       'wait while it happens   Wend   Xl = GetVar(2000)    'get the axact point the probe was hit   code "G00X" & Xpos' ------ Probe in -X direction ------   Code "G31 X" & Xpos +50 & " F200"   'probing move, can set the feed rate here as well as how far to move   While IsMoving()       'wait while it happens   Wend   Xr = GetVar(2000)    'get the axact point the probe was hit   '------ Re-position probe ready for Y direction probing ------   Xz=((Xr-Xl)/2)+Xl   Code "G0 X" &Xz   'go to X center    ' ------ Probe in -Y direction ------      Code "G31 Y" & Ypos -50 & " F200"   'probing move, can set the feed rate here as well as how far to move   While IsMoving()       'wait while it happens   Wend   Yu = GetVar(2001)    'get the axact point the probe was hit   code "G00Y" & Ypos' ------ Probe in +Y direction ------      Code "G31 Y" & Ypos +50 & " F200"   'probing move, can set the feed rate here as well as how far to move   While IsMoving()       'wait while it happens   Wend   Yo = GetVar(2001)    'get the axact point the probe was hit   '------ Re-position probe ready for Y direction probing ------   Yz=((Yo-Yu)/2)+Yu   Code "G0 Y" &  Yz 'go to Y center    While IsMoving()       'wait while it happens   Wend   setDRO(0,0)   setDRO(1,0)   sleep(1000) 'allow for update of DROs' find probe diameter   Xpos = GetDro(0)   Ypos = GetDro(1)   Zpos = GetDro(2)' ------ Probe in -X direction ------      Code "G31 X" & Xpos -50 & " F100"   'probing move, can set the feed rate here as well as how far to move   While IsMoving()       'wait while it happens   Wend   Xl = GetVar(2000)    'get the axact point the probe was hit   code "G00X" & Xpos' ------ Probe in -X direction ------   Code "G31 X" & Xpos +50 & " F100"   'probing move, can set the feed rate here as well as how far to move   While IsMoving()       'wait while it happens   Wend   Xr = GetVar(2000)    'get the axact point the probe was hit   '------ Re-position probe ready for Y direction probing ------   Xz=((Xr-Xl)/2)+Xl   Code "G0 X" &Xz   'go to X center   ' ------ Probe in -Y direction ------      Code "G31 Y" & Ypos -50 & " F100"   'probing move, can set the feed rate here as well as how far to move   While IsMoving()       'wait while it happens   Wend   Yu = GetVar(2001)    'get the axact point the probe was hit   code "G00Y" & Ypos' ------ Probe in +Y direction ------      Code "G31 Y" & Ypos +50 & " F100"   'probing move, can set the feed rate here as well as how far to move   While IsMoving()       'wait while it happens   Wend   Yo = GetVar(2001)    'get the axact point the probe was hit   '------ Re-position probe ready for Y direction probing ------   Yz=((Yo-Yu)/2)+Yu   Code "G0 Y" &  Yz 'go to Y center PdX=50.17-(Xr-Xl)PdY=50.17-(Yo-Yu)setoemDRO(221,(PdX+PdY)/2)Message "Probe dia set to " & (PdX+PdY)/2  code "G00X-50Z20"  code "G00Z4"  code"G31X0F100"   While IsMoving()       'wait while it happens   Wend   Xl = GetVar(2000)    'get the axact point the probe was hit  code "G00Z10"  code "G00X0Y-40"  code "G00Z4"  code"G31Y0F100"   While IsMoving()       'wait while it happens   Wend   Yu = GetVar(2001)    'get the axact point the probe was hit  code "G00Z10"  code "G00X50Y0"  code "G00Z4"  code"G31X0F100"   While IsMoving()       'wait while it happens   Wend   Xr = GetVar(2000)    'get the axact point the probe was hit  code "G00Z10"  code "G00X0Y40"  code "G00Z4"  code"G31Y0F100"   While IsMoving()       'wait while it happens   Wend   Yo = GetVar(2001)    'get the axact point the probe was hit  code "G00Z10"  code "G00X0Y0Z50"   While IsMoving()       'wait while it happens   Wendsetoemdro(1010, Xr-Xl)setoemdro(1011, Yo-Yu)Message "X=" & Xr-Xl & "  Y=" & Yo-Yu	End 