``` (author: Chris P) (version: 0.1) (date: 08/02/2018) (Probe front left top corner for x,y,z 0,0,0 position) (Start probe position is over front left corner of stock) (inside the step off width square and 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 (=.5000) # = #3 (=.5000) # = #4 (=0.0000) # = #5 (=0.10000) # = #6 (=0 what is this?) # = #7 (=0) # = #8 (=5) # = #9 (=20) # = #10 (=.1250) # = #11 (=0) # = #12 (=0) # = #13 (=.7500) (Cancel G92 offsets) G92.1 o100 if [#5220 EQ 1] (G54, 5520 = current work space ID 1-9) # = #5221 # = #5222 # = #5223 o100 elseif [#5220 EQ 2] (G55) # = #5241 # = #5242 # = #5243 o100 elseif [#5220 EQ 3] (G56) # = #5261 # = #5262 # = #5263 o100 elseif [#5220 EQ 4] (G57) # = #5281 # = #5282 # = #5283 o100 elseif [#5220 EQ 5] (G58) # = #5301 # = #5302 # = #5303 o100 elseif [#5220 EQ 6] (G59) # = #5321 # = #5322 # = #5323 o100 elseif [#5220 EQ 7] (G59.1) # = #5341 # = #5342 # = #5343 o100 elseif [#5220 EQ 8] (G59.2) # = #5361 # = #5362 # = #5363 o100 elseif [#5220 EQ 9] (G59.3) # = #5381 # = #5382 # = #5383 o100 else (default to G54) # = #5221 # = #5222 # = #5223 o100 endif (Probe Tool Safety Check) o<110> if [#5400 NE #] (MSG, Specified probe tool # not in spindle, aborting) o return o<110> endif (Probe Diameter) # = #5410 (Probe Centerline Offset) # = [# / 2] (Current Z Position including offsets in current program units) # = #5422 (Current Feed Rate) # = #<_feed> (Probe Top of Workpiece) G91 (Initial Fast Z- Probe) 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 G0 Z# F# (return from sub) o return o<120> endif (Move to z_clearance height for slow probe) G90 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 F[#] G38.2 Z-[# * 2] # = #5063 (debug, Probed Pos: #5063 Z Pos: #<_z>) G90 G0 Z[# + #] o<130> endif (Record Z zero in selected WCO) G10 L2 P#5220 Z[#5063 + #] (Probe X Positioning Move, Step Off Width) G91 G0 X-[#] (Probe X Positioning Move, to Probing Depth) F[#] G1 Z-[# + # + #] (Current X Position including offsets in current program units) # = #5420 (Initiate Fast X+ Probe) G38.2 X[#] # = #5061 (Probe Error check, #5070 will be 0 if failed) o<140> if [#5070 EQ 0] (back to start point and feed) G90 G0 X# F# (return from sub) o return o<140> endif (Move to xy_clearance distance for slow probe) G90 G0 X[# - #] (Slow Probe Rule, if Slow Probe FR is set to 0, Slow Probe is Bypassed) o<150> if [# GT 0] (Initiate Slow X+ Probe) G91 F[#] G38.2 X[# * 2] # = #5061 (debug, Probed Pos: #5061 X Pos: #<_x>) G90 G0 X[# - #] o<150> endif (Record X Zero in selected WCO) G10 L2 P#5220 X[#5061 + # - #] (Probe Y Positioning Move, up to Z clearance plane) G91 G0 Z[# + # + #] (Probe Y Positioning Move, Traverse Workpiece Top at Z Clearance Height plane) G0 X[#] Y-[#] (Probe Y Positioning Move,to Probing Depth) F[#] G1 Z-[# + # + #] (Current Y Position including offsets in current program units) # = #5421 (Initiate Fast Y+ Probe) G38.2 Y[#] # = #5062 (Probe Error check, #5070 will be 0 if failed) o<160> if [#5070 EQ 0] (back to start point and feed) G90 G0 Y# F# (return from sub) o return o<160> endif (Move to xy_clearance distance for slow probe) G90 G0 Y[# - #] (Slow Probe Rule, if Slow Probe FR is set to 0, Slow Probe is Bypassed) o<170> if [# GT 0] (Initiate Slow Y+ Probe) G91 F[#] G38.2 Y[# * 2] # = #5062 (debug, Probed Pos: #5062 Y Pos: #<_y>) G90 G0 Y[# - #] o<170> endif (Record Y Zero in selected WCO) G10 L2 P#5220 Y[#5062 + # - #] (Probe Completion Move to Z Clearance Plane, and X Zero, Y Zero) G90 G0 Z[#] G0 X0.0000 Y0.0000 o endsub M02 (end program)