;Based on Chris Radek's P-hole.ngc ;modified for NGCGUI ;g0 moves changed to g1 ;added correction fields for center location of hole ;added correction field for x and y diameter ;jog probe to hole location, jog probe to z depth inside hole ;finds center of hole and retracts Z when finished ;March 22, 2012 o sub # = #1 (=10 Fast prb) ;speed for 1st probe at each location # = #2 (=5 Slow prb) ;speed for 2nd slow speed probe at each loacation # = #3 (=.035 Prb dis) ;distance for slow probe # = #4 (=.117 Prb Diam) # = #5 (=0.00 X cor) ;X correction center of hole # = #6 (=0.00 Y cor) ;Y correction center of hole # = #7 (=2.00 radius max) ;max radius hole size to probe # = #8 (=20 Trvl Spd) ;speed to travel on non probe moves # = #9 (=.125) ;distance to retract z when finished # = #10 (=0.00 X size cor) ;X correction size of hole # = #11 (=0.00 Y size cor) ;Y correction size of hole G40 (Cancel cutter radius compensation) G49 (Cancel tool length offset) G20 F#1 #1000= #7 G91 G38.3 F#1 Z.00001 #1001=#5061 #1002=#5062 ;first search G91 G38.2 F#1 X#1000 (find 1st x) #1003=#5061 (store) G90 G1 F#8 X#1001 (go back to org post) G91 G38.2 F#1 X[0-#1000] (look for 2nd x) #1004=#5061 (store) #1001=[[#1003+#1004]/2] (calc center of x) G90 G1 F#8 X#1001 (goto center of x) G91 G38.2 F#1 Y#1000 (find 1st y) #1005=#5062 G90 G1 F#8 Y#1002 (go back to org post) G91 G38.2 F#1 Y[0-#1000] (look for 2nd y) #1006=#5062 #1002=[[#1005+#1006]/2](calc center of y) G90 G1 F#8 Y#1002 (goto center of y) ;repeat above in rough center G91 G38.2 F#1 X#1000 #1003=#5061 G90 G1 F#8 X#1001 G91 G38.2 F#1 X[0-#1000] #1004=#5061 #1001=[[[#1003+#1004]/2]+ #5] (calculate center and apply x correction) G90 G1 F#8 X#1001 G91 G38.2 F#1 Y#1000 #1005=#5062 G90 G1 F#8 Y#1002 G91 G38.2 F#1 Y[0-#1000] #1006=#5062 #1002=[[[#1005+#1006]/2]+ #6] (calculate center and apply y correction) G90 G1 F#8 Y#1002 (goto center of y) G90 G1 F#8 X[#1003-#3] (goto 1st x minus slow probe dist) G91 G38.2 F#2 X[#3*2] (slow probe) #1003=#5061 G90 G1 F#8 X[#1004+#3] (go to 2nd x minus slow probe dist) G91 G38.2 F#2 X-[#3*2] #1004=#5061 #1001=[[[#1003+#1004]/2] + #5] (calculate center and apply x correction) G90 G1 F#8 X#1001 (goto center of x) G90 G1 F#8 Y[#1005-#3](goto 1st y minus slow probe dist) G91 G38.2 F#2 Y[#3*2](slow probe) #1005=#5062 G90 G1 F#8 Y[#1006+#3](go to 2nd y minus slow probe dist) G91 G38.2 F#2 Y-[#3*2](slow probe) #1006=#5062 #1002=[[[#1005+#1006]/2]+#6] (calculate center and apply y correction) G90 G1 F#8 Y#1002 (goto center of y) G91 G1 Z#9 G90 #1007=[[#1003-#1004]+[#4 + #10]] (calculate X dia and apply X diam correction) #1008=[[#1005-#1006]+[#4 + #11]](calculate Y dia and apply Y diam correction) #1009=[[#1007+#1008]/2] #1010=[atan[#1002]/[#1001]] #1011=[sqrt[[#1001*#1001]+[#1002*#1002]]] (debug,Xdia #1007 Ydia #1008 Dia #1009 Ang #1010 Dist #1011) o endsub