(author: Chris P) (version: 0.1) (date: 04/25/19) (Probe Z Minus direction and set Z 0 in current WCO) (Start probe position is over stock within max z distance) (ensure all settings have been set properly according to help diagrams) o sub (uses NGCGUI style arg spec) (number after "=" in comment is default value) # = #1 (=99) # = #2 (=0.5000) # = #3 (=0.5000) # = #4 (=0.1000) # = #5 (=0.1000) # = #6 (=0.5000) # = #7 (=0.0000) # = #8 (=0.0) # = #9 (=10.0) # = #10 (=0.0000) # = #11 (=1.0000) # = #12 (=1.0000) # = #13 (=1.0000) # = #14 (=0.5000) # = #15 (=0) (Cancel G92 offsets) G92.1 G43.1 Z0 # = #[5203 + [20 * #5220]] (Probe Tool Safety Check) o<110> if [#5400 NE #] (MSG, Specified probe tool # not in spindle, aborting) o return o<110> endif (Current Z Position including offsets in current program units) # = #5422 (Initial Fast Z- Probe) G91 (Incremental mode) F[#] G38.2 Z-[#] # = #5063 (Probe Error check, #5070 will be 0 if failed) o<120> if [#5070 EQ 0] (back to start point and feed) G90 (Absolute mode) G0 Z# F[#] (return from sub) o return o<120> endif (Move to z_clearance height for slow probe) G90 (Absolute mode) G0 Z[# + #] (Slow Probe Rule, if Slow Probe FR is set to 0, Slow Probe is Bypassed) o<130> if [# GT 0] (Initiate Slow Z- Probe) G91 (Incremental mode) F[#] G38.2 Z-[# * 2] # = #5063 ; (debug, Probed Pos: #5063 Z Pos: #<_z>) G90 (Absolute mode) G0 Z[#+#] o<130> endif (defines the edge as z_probed_position for DRO reporting) # = # (analog aio output to gui DRO "Z PROBED POSITION") M68 E7 Q[#] # = [# + #] (probe mode rule for WCO or probe position measuring only) o<140> if [# EQ 0] (Record Z zero in selected WCO) G90 (PRINT, 5220=#5220) (PRINT, z_minus_probed=#) (PRINT,5063=#5063) (PRINT, workspace_z=#) (PRINT, _ini[PROBE]LENGTH>=#<_ini[PROBE]LENGTH>) #[4000 + [#5220]]=0.00000 G10 L2 P#5220 Z[# + #] #[4000 + [#5220]] = [# + # - #<_ini[PROBE]LENGTH>] (Added by JHK) o return o<140> endif o endsub M2 (end program)