(author: Chris P) (version: 0.1) (date: 04/26/19) (Probe round pocket center measure x and y Diam, find xy center position) (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) # = #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) # = #16 (=50) (Cancel G92 offsets) G92.1 # = #[5201 + [20 * #5220]] # = #[5202 + [20 * #5220]] (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 (remove probe tip diam and cal offset from probed width calculations) # = [# - [# * 2]] # = [# + # + #] (Call sub "probe_z_minus_sub" to Probe top of Workpiece) o call [#1][#2][#5][#8][#9][#15] (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-) o call [#1][#3][#4][#8][#9][#10] # = #5061 (Call sub "probe_x_plus" to Probe x+) o call [#1][#3 + #13][#4][#8][#9][#10] # = #5061 (probed center calculation) # = [[# + #] / 2] #1002 = # (DEBUG, EVAL[vcp.getWidget{"x_center_probed"}.setValue{#1002}]) (Probe Completion Move to Z Clearance Plane, and X Zero) G90 F[#] G38.3 X[#] (Call sub "probe_y_plus" to Probe Y+) o call [#1][#3 + #13 / 2][#4][#8][#9][#10] # = #5062 (Call sub "probe_y_minus" to Probe Y-) o call [#1][#3 + #13][#4][#8][#9][#10] # = #5062 (probed center calculation) # = [[# + #] / 2] #1004 = # (DEBUG, EVAL[vcp.getWidget{"y_center_probed"}.setValue{#1004}]) (Probe Completion Move to Z Clearance Plane, Y Zero) G90 F[#] G38.3 Y[#] (Call sub "probe_x_minus" to Probe x-) o call [#1][#3 + #13 / 2][#4][#8][#9][#10] # = #5061 (Call sub "probe_x_plus" to Probe x+) o call [#1][#3 + #13][#4][#8][#9][#10] # = #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}]) G90 F[#] G38.3 X[#] (Call sub "probe_y_plus" to Probe Y+) o call [#1][#3 + #13 / 2][#4][#8][#9][#10] # = #5062 (Call sub "probe_y_minus" to Probe Y-) o call [#1][#3 + #13][#4][#8][#9][#10] # = #5062 (probed center calculation) # = [[# + #] / 2] (calculate Y Width Probed) # = [# - #] (Completed probed diameter calculations) # = [# + #] #1003 = # (DEBUG, EVAL[vcp.getWidget{"y_probed_width"}.setValue{#1003}]) #1004 = # (DEBUG, EVAL[vcp.getWidget{"y_center_probed"}.setValue{#1004}]) # = [[# + #] / 2] #1010 = # (DEBUG, EVAL[vcp.getWidget{"averaged_diam"}.setValue{#1010}]) G90 F[#] G38.3 Y[#] G91 F[#] G38.3 Z[#] (probe mode rules for WCO or probe position measuring only) o<120> if [# EQ 0] (Record Y Zero in selected WCO) G10 L2 P#5220 X[# + #] G10 L2 P#5220 Y[# + #] (Probe Completion Move to Z Clearance Plane, and X Zero, Y Zero) o return o<120> endif o endsub M2 (end program)