/ nc_files / smartprobe.ngc
smartprobe.ngc
 1  ( Rectangular Probing                                                   )
 2  (                                                                       )
 3  ( This program repeatedly probes in a regular XY grid and writes the    )
 4  ( probed location to the file 'probe-results.ngc' in the same directory )
 5  ( as the .ini file                                                      )
 6  ( increment x count = probe area                                        )
 7  
 8  (Configuration section)
 9  G20    (Inches)
10  F20    (probe speed)
11  
12  #1=-1  (X start)
13  #2=.04 (X increment)
14  #3=51  (X count)
15  
16  #4=-1  (Y start)
17  #5=.04 (Y increment)
18  #6=51  (Y count)
19  
20  #7=1.1 (Z safety)
21  #8=-.1 (Z probe)
22  (End configuration section)
23  
24  (LOGOPEN,probe-results.ngc)
25  #9=0 #10=0
26  G0Z#7
27  O1 while [#9 lt #6]
28      #10=0
29      G0 Y[#4+#5*#9]
30      O2 while [#10 lt #3]
31          O3 if [[#9/2] - fix[#9/2] eq 0]
32              #11=[#1+#2*#10]
33          O3 else      
34              #11=[#1+#2*[#3-#10-1]]
35          O3 endif
36          (#11 is X target)
37          #5070=1
38          O4 while [#5070 NE 0]
39              G38.5 z#7
40              G38.3 x#11
41          O4 endwhile
42  
43          G38.2Z#8
44          (LOG,G1 X#5061 Y#5062 Z#5063)
45          #10=[#10+1]
46      O2 endwhile
47      G0Z#7
48      #9=[#9+1]
49  O1 endwhile
50  
51  (LOGCLOSE)
52  G0Z#7
53  G0X#1Y#4
54  M2