Kod: Zaznacz cały
( Rectangular area probe )
( adapted for ngcgui-compatibility from smartprobe.ngc written by Chris Radek )
( This program repeatedly probes a regular XY grid and writes the )
( probed locations to the file 'probe_result.txt' in the same directory )
( as the .ini file )
( Requires a probe connected to motion.probe-input )
( or use scripts/simulate_probe )
(info: Probe a rectangular area)
o<probe> sub
#<xmin> = #1 (= 0.0)
#<xmax> = #2 (= 10.0)
#<xinterval> = #3 (= 0.1)
#<ymin> = #4 (= 0.0 nie dotykaj dla tokarki)
#<ymax> = #5 (= 0.0 zostaw dla tokarki)
#<yinterval> = #6 (= 1.0 nierusz dla tokarki)
#<zsafe> = #7 (= 1.0)
#<zretract> = #8 (= 2.0 wycofanie Z offset)
#<zprobe> = #9 (= -10.)
#<probespeed> = #10 (= 200)
#<in_or_mm> = #11 (= 21 in|mm 20|21)
#<wait> = #12 (= 1 Wait for Start)
O1 if [ [#<in_or_mm> ne 20] and [#<in_or_mm> ne 21]]
(debug, in_or_mm invalid: #<in_or_mm> - EXITING)
(print, in_or_mm invalid: #<in_or_mm> - EXITING)
(AXIS,notify, probe: in_or_mm invalid - EXITING)
m2
O1 endif
#<xsteps> = [fix [abs[#<xmax> - #<xmin>]/#<xinterval> + 1]]
#<ysteps> = [fix [abs[#<ymax> - #<ymin>]/#<yinterval> + 1]]
G#<in_or_mm>
#<points> = [#<xsteps> * #<ysteps>]
(debug, Probing #<xsteps> * #<ysteps> = #<points> points)
(LOGOPEN,probe_result.txt)
(LOG,# xmin = #<xmin> xmax = #<xmax> xinterval = #<xinterval> xsteps = #<xsteps>)
/(LOG,# ymin = #<ymin> ymax = #<ymax> yinterval = #<yinterval> ysteps = #<ysteps>)
#<yct> = 0
#<xct> = 0
G0Z#<zsafe>
F#<probespeed>
O2 while [#<yct> lt #<ysteps>]
#<xct> = 0
/ G0 Y[#<ymin>+#<yinterval>*#<yct>]
O3 while [#<xct> lt #<xsteps>]
#<xtarget> = 0
O4 if [[#<yct>/2] - fix[#<yct>/2] eq 0]
#<xtarget> = [#<xmin> + #<xinterval> * #<xct>]
O4 else
#<xtarget> = [#<xmin> + #<xinterval> * [#<xsteps> - #<xct> - 1]]
O4 endif
#<probesuccess> = 1
O5 while [#<probesuccess> NE 0]
G38.5 z#<zsafe> (probe until no contact away from work, no error)
#<probesuccess> = #5070
G38.3 x#<xtarget> (probe until contact, toward work, no error)
#<probesuccess> = #5070
O5 endwhile
O6 if [[#<wait> eq 1] and [[#<yct> eq 0] and [#<xct> eq 0]]]
(debug, S to Begin Probe)
m0 (mandatory stop)
/ M110 (axisui.notifications-clear)
O6 endif
G38.2Z#<zprobe> (probe until contact, toward work, with error)
(G0z#<zsafe>)
G91
G0Z#<zretract>
G90
#<probex> = #5061
#<probey> = #5062
#<probez> = #5063
/ (LOG,X#<probex> Y#<probey> Z#<probez>) odkomentuj dla frezarki
(LOG,X#<probex> Z#<probez>)
#<xct> = [#<xct> + 1]
O3 endwhile
(G0Z#<zsafe>)
G91
G0Z#<zretract>
G90
#<yct> = [#<yct> + 1]
O2 endwhile
(LOG,# Finished: total points = #<points>)
(LOGCLOSE)
(debug, Finished: see probe_result.txt)
G0Z#<zsafe>
G0X#<xmin>
/Y#<ymin>
o<probe> endsub