(author: Chris P) (version: 0.1) (date: 05/8/19) (Probe calibration offset using defined width square boss) (Start probe position is over center of stock in X and Y axis) (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 (=0.0000) # = #17 (=1.0000) # = #18 (=1.0000) # = #19 (=1) (Cancel G92 offsets) G92.1 # = #[5201 + [20 * #5220]] # = #[5202 + [20 * #5220]] # = #[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 (Probe Diameter) # = #5410 (Probe Radius) # = [# / 2] (Probe Centerline Offset) # = [# - #] (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, X hint/2 + Step Off Width) G91 G0 X-[#/2 + #] (Probe X Positioning Move, to Probing Depth) F[#] G1 Z-[#] (Call sub "probe_x_plus" to Probe x+ side of Workpiece) o call [#1][#3][#4][#8][#9][#10] # = #5061 (first side Probe Completion Move to Z Clearance Plane) G91 G0 Z[#] (Positioning move in X, X Hint + Step Off Width at Rapid Speed) G91 G0 X[# + # + #] (Probe X Positioning Move, to Probing Depth) F[#] G1 Z-[#] (Call sub "probe_x_minus" to Probe x- side of Workpiece) o call [#1][#3][#4][#8][#9][#10] # = #5061 (probed center calculation) # = [[# + #] / 2] (calculate X Width Probed) # = [# - #] (Completed probed width calculations) # = [# - #] M68 E0 Q[#] M68 E10 Q[#] G91 G0 Z[#] G90 G0 X[#] (Probe Y Positioning Move, Y hint/2 + Step Off Width) G91 G0 Y-[#/2 + #] (Probe Y Positioning Move, to Probing Depth) F[#] G1 Z-[#] (Call sub "probe_y_plus" to Probe y+ side of Workpiece) o call [#1][#3][#4][#8][#9][#10] # = #5062 (first side Probe Completion Move to Z Clearance Plane) G91 G0 Z[#] (Positioning move in Y, Y Hint + Step Off Width at Rapid Speed) G91 G0 Y[# + # + #] (Probe Y Positioning Move, to Probing Depth) F[#] G0 Z-[#] (Call sub "probe_y_minus" to Probe y- side of Workpiece) o call [#1][#3][#4][#8][#9][#10] # = #5062 (probed center calculation) # = [[# + #] / 2] (calculate Y Width Probed) # = [# - #] (Completed probed width calculations) # = [# - #] M68 E1 Q[#] M68 E11 Q[#] G91 G0 Z[#] G90 G0 X[#] Y[#] o<120> if [# GT #] (calculate calibration error and adjust calibration offset) # = [[# - #] / 2] # = [# - #] o<120> else # = [[# - #] / 2] # = [# + #] o<120> endif o<130> if [# GT #] (calculate calibration error and adjust calibration offset) # = [[# - #] / 2] # = [# - #] o<130> else # = [[# - #] / 2] # = [# + #] o<130> endif # = [[# + #] / 2] o<140> if [# EQ 0] M68 E12 Q[ABS[#]] o<140> else if [# EQ 1] M68 E12 Q[ABS[#]] o<140> else M68 E12 Q[ABS[#]] o<140> endif # = [# + #] # = [# + #] (probe mode rules for WCO or probe position measuring only) o<150> if [# EQ 0] (Record XY Zero in selected WCO) G10 L2 P#5220 X[#] Y[#] (Probe Completion Move to Z Clearance Plane, and X Zero, Y Zero) o return o<150> endif o endsub M2 (end program)