(author: Chris P) (version: 0.2) (date: 06/27/24) (Probe calibration offset using defined width square pocket) (Start probe position is over left side edge of pocket wall) (inside the step off width distance 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) # = #3014 (=99) # = #3015 (=0) # = #3016 (=10.0) # = #3017 (=50) # = #3018 (=0.5000) # = #3019 (=0.1000) # = #3020 (=0.5000) # = #3021 (=0.1000) # = #3022 (=0.0000) # = #3023 (=0.5000) # = #3024 (=0.5000) # = #3030 (=0) # = #3034 (=0) # = #3035 (=0) # = #3036 (=0) (Cancel G92 offsets) G92.1 (Cancel Feedrate Override) M50 P0 # = #[5201 + [20 * #5220]] # = #[5202 + [20 * #5220]] (clear current probe calibration offset) #3032 = 0 (DEBUG, EVAL[vcp.getWidget{"calibration_offset_3032"}.setValue{#3032}]) (Probe Tool Safety Check) o100 if [#5400 NE #] (DEBUG, Specified probe tool %d# not in spindle, aborting) M50 P1 o return o100 endif (Probe Diameter) # = #5410 (remove probe tip diam and cal offset from probed width calculations) # = [#] # = [# + # + #] (Call sub "probe_z_minus_sub" to Probe top of Workpiece) o call [#3014][#3015][#3016][#3017][#3020][#3021][#3030][#3032] (Probe X Positioning Move, Step Off Width) G91 F[#] G38.3 X[#] (Probe X Positioning Move, to Probing Depth) F[#] G38.3 Z-[#] (Call sub "probe_x_minus" to Probe x- side of Workpiece) o call [#3014][#3015][#3016][#3017][#3018][#3019][#3032] # = #5061 (Call sub "probe_x_plus" to Probe x+ side of Workpiece) o call [#3014][#3015][#3016][3017][#3018 + #3034][#3019][#3032] # = #5061 (probed center calculation) # = [[# + #] / 2] (calculate X Width Probed) # = [# - #] (Completed probed width calculations) # = [# + #] #1001 = # (DEBUG, EVAL[vcp.getWidget{"x_probed_width"}.setValue{#1001}]) #1002 = # (DEBUG, EVAL[vcp.getWidget{"x_center_probed"}.setValue{#1002}]) (Probe Completion Move to Z Clearance Plane, and X Zero, Y Zero) G90 F[#] G38.3 X[#] (Call sub "probe_y_plus" to Probe Y+ side of Workpiece) o call [#3014][#3015][#3016][3017][#3018 + #3035 / 2][#3019][#3032] # = #5062 (Call sub "probe_y_minus" to Probe Y- side of Workpiece) o call [#3014][#3015][#3016][3017][#3018 + #3035][#3019][#3032] # = #5062 (probed center calculation) # = [[# + #] / 2] (calculate Y Width Probed) # = [# - #] (Completed probed width calculations) # = [# + #] #1003 = # (DEBUG, EVAL[vcp.getWidget{"y_probed_width"}.setValue{#1003}]) #1004 = # (DEBUG, EVAL[vcp.getWidget{"y_center_probed"}.setValue{#1004}]) G90 F[#] G38.3 Y[#] G91 F[#] G38.3 Z[#] o110 if [# GT #] (calculate calibration error and adjust calibration offset) # = [[# - #] / 2] # = [#] o110 else # = [[# - #] / 2] # = [#] o110 endif o120 if [# GT #] (calculate calibration error and adjust calibration offset) # = [[# - #] / 2] # = [#] o120 else # = [[# - #] / 2] # = [#] o120 endif # = [[# + #] / 2] o130 if [# EQ 0] #3032 = [ABS[#]] (DEBUG, EVAL[vcp.getWidget{"calibration_offset_3032"}.setValue{#3032}]) o130 else if [# EQ 1] #3032 = [ABS[#]] (DEBUG, EVAL[vcp.getWidget{"calibration_offset_3032"}.setValue{#3032}]) o130 else #3032 = [ABS[#]] (DEBUG, EVAL[vcp.getWidget{"calibration_offset_3032"}.setValue{#3032}]) o130 endif # = [# + #] # = [# + #] (probe mode rules for WCO or probe position measuring only) o140 if [# EQ 0] (Record X Zero in selected WCO) G10 L2 P#5220 X[#] Y[#] o140 endif (Reinstate Feedrate Override) M50 P1 o endsub M2 (end program)