330 lines
9.6 KiB
Plaintext
330 lines
9.6 KiB
Plaintext
(author: Chris P)
|
|
(version: 0.2)
|
|
(date: 06/27/24)
|
|
|
|
(Probe calibration offset using defined diam round 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<probe_cal_round_boss> sub
|
|
|
|
(uses NGCGUI style arg spec)
|
|
(number after "=" in comment is default value)
|
|
#<probe_tool_number> = #3014 (=99)
|
|
#<probe_slow_fr> = #3015 (=0)
|
|
#<probe_fast_fr> = #3016 (=10.0)
|
|
#<probe_traverse_fr> = #3017 (=50)
|
|
#<max_xy_distance> = #3018 (=0.5000)
|
|
#<xy_clearance> = #3019 (=0.1000)
|
|
#<max_z_distance> = #3020 (=0.5000)
|
|
#<z_clearance> = #3021 (=0.1000)
|
|
#<extra_probe_depth> = #3022 (=0.0000)
|
|
#<step_off_width> = #3023 (=0.5000)
|
|
#<probe_mode> = #3030 (=0)
|
|
#<cal_diameter> = #3033 (=0)
|
|
#<sq_cal_axis> = #3036 (=0)
|
|
|
|
(Cancel G92 offsets)
|
|
G92.1
|
|
|
|
(Cancel Feedrate Override)
|
|
M50 P0
|
|
|
|
#<workspace_x> = #[5201 + [20 * #5220]]
|
|
#<workspace_y> = #[5202 + [20 * #5220]]
|
|
#<workspace_z> = #[5203 + [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 #<probe_tool_number>]
|
|
(DEBUG, Specified probe tool %d#<probe_tool_number> not in spindle, aborting)
|
|
M50 P1
|
|
o<probe_cal_round_boss> return
|
|
o100 endif
|
|
|
|
(Probe Diameter)
|
|
#<probe_diameter> = #5410
|
|
|
|
(Probe Radius)
|
|
#<probe_radius> = [#<probe_diameter> / 2]
|
|
|
|
(Probe Centerline Offset)
|
|
#<probe_center_offset> = [#<probe_radius>]
|
|
|
|
(remove probe tip diam and cal offset from probed width calculations)
|
|
#<probe_diameter_offset> = [#<probe_diameter>]
|
|
|
|
#<z_probe_stack> = [#<z_clearance> + #<probe_diameter> + #<extra_probe_depth>]
|
|
|
|
(Call sub "probe_z_minus_sub" to Probe top of Workpiece)
|
|
o<probe_z_minus_sub> call [#3014][#3015][#3016][#3017][#3020][#3021][#3030][#3032]
|
|
|
|
(Probe X Positioning Move, X hint/2 + Step Off Width)
|
|
G91
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 X-[#<cal_diameter>/2 + #<step_off_width>]
|
|
|
|
(Probe X Positioning Move, to Probing Depth)
|
|
F[#<probe_fast_fr>]
|
|
G38.3 Z-[#<z_probe_stack>]
|
|
|
|
(Call sub "probe_x_plus" to Probe x+ side of Workpiece)
|
|
o<probe_x_plus> call [#3014][#3015][#3016][#3017][#3018][#3019][#3032]
|
|
|
|
#<x_plus_probed> = #5061
|
|
|
|
(first side Probe Completion Move to Z Clearance Plane)
|
|
G91
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 Z[#<z_probe_stack>]
|
|
|
|
(Positioning move in X, X Hint + Step Off Width at Rapid Speed)
|
|
G91
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 X[#<cal_diameter> + #<step_off_width> + #<xy_clearance>]
|
|
|
|
(Probe X Positioning Move, to Probing Depth)
|
|
F[#<probe_fast_fr>]
|
|
G38.3 Z-[#<z_probe_stack>]
|
|
|
|
(Call sub "probe_x_minus" to Probe x- side of Workpiece)
|
|
o<probe_x_minus> call [#3014][#3015][#3016][#3017][#3018][#3019][#3032]
|
|
|
|
#<x_minus_probed> = #5061
|
|
|
|
(probed center calulation)
|
|
#<x_center_probed> = [[#<x_minus_probed> + #<x_plus_probed>] / 2]
|
|
|
|
#1002 = #<x_center_probed>
|
|
(DEBUG, EVAL[vcp.getWidget{"x_center_probed"}.setValue{#1002}])
|
|
|
|
G91
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 Z[#<z_probe_stack>]
|
|
G90
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 X[#<x_center_probed>]
|
|
|
|
(Probe Y Positioning Move, Y hint/2 + Step Off Width)
|
|
G91
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 Y-[#<cal_diameter>/2 + #<step_off_width>]
|
|
|
|
(Probe Y Positioning Move, to Probing Depth)
|
|
F[#<probe_fast_fr>]
|
|
G38.3 Z-[#<z_probe_stack>]
|
|
|
|
(Call sub "probe_y_plus" to Probe y+ side of Workpiece)
|
|
o<probe_y_plus> call [#3014][#3015][#3016][#3017][#3018][#3019][#3032]
|
|
|
|
#<y_plus_probed> = #5062
|
|
|
|
(first side Probe Completion Move to Z Clearance Plane)
|
|
G91
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 Z[#<z_probe_stack>]
|
|
|
|
(Positioning move in Y, Y Hint + Step Off Width at Rapid Speed)
|
|
G91
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 Y[#<cal_diameter> + #<step_off_width> + #<xy_clearance>]
|
|
|
|
(Probe Y Positioning Move, to Probing Depth)
|
|
F[#<probe_fast_fr>]
|
|
G38.3 Z-[#<z_probe_stack>]
|
|
|
|
(Call sub "probe_y_minus" to Probe y- side of Workpiece)
|
|
o<probe_y_minus> call [#3014][#3015][#3016][#3017][#3018][#3019][#3032]
|
|
|
|
#<y_minus_probed> = #5062
|
|
|
|
(probed center calulation)
|
|
#<y_center_probed> = [[#<y_minus_probed> + #<y_plus_probed>] / 2]
|
|
|
|
#1004 = #<y_center_probed>
|
|
(DEBUG, EVAL[vcp.getWidget{"y_center_probed"}.setValue{#1004}])
|
|
|
|
(Move to z clearance plane)
|
|
G91
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 Z[#<z_probe_stack>]
|
|
|
|
(Move to Y Center)
|
|
G90
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 Y[#<y_center_probed>]
|
|
|
|
(Probe X Positioning Move, X hint/2 + Step Off Width)
|
|
G91
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 X-[#<cal_diameter>/2 + #<step_off_width>]
|
|
|
|
(Probe X Positioning Move, to Probing Depth)
|
|
F[#<probe_fast_fr>]
|
|
G38.3 Z-[#<z_probe_stack>]
|
|
|
|
(Call sub "probe_x_plus" to Probe x+ side of Workpiece)
|
|
o<probe_x_plus> call [#3014][#3015][#3016][#3017][#3018][#3019][#3032]
|
|
|
|
#<x_plus_probed> = #5061
|
|
|
|
(first side Probe Completion Move to Z Clearance Plane)
|
|
G91
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 Z[#<z_probe_stack>]
|
|
|
|
(Positioning move in X, X Hint + Step Off Width at Rapid Speed)
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 X[#<cal_diameter> + #<step_off_width> + #<xy_clearance>]
|
|
|
|
(Probe X Positioning Move, to Probing Depth)
|
|
F[#<probe_fast_fr>]
|
|
G38.3 Z-[#<z_probe_stack>]
|
|
|
|
(Call sub "probe_x_minus" to Probe x- side of Workpiece)
|
|
o<probe_x_minus> call [#3014][#3015][#3016][#3017][#3018][#3019][#3032]
|
|
|
|
#<x_minus_probed> = #5061
|
|
|
|
(probed center calulation)
|
|
#<x_center_probed> = [[#<x_minus_probed> + #<x_plus_probed>] / 2]
|
|
|
|
(calculate X Width Probed)
|
|
o110 if [#<x_minus_probed> GT #<x_plus_probed>]
|
|
#<x_raw_width> = [#<x_minus_probed> - #<x_plus_probed>]
|
|
o110 else
|
|
#<x_raw_width> = [#<x_plus_probed> - #<x_minus_probed>]
|
|
o110 endif
|
|
|
|
(Completed probed width calculations)
|
|
#<x_probed_width> = [#<x_raw_width> - #<probe_diameter_offset>]
|
|
|
|
#1001 = #<x_probed_width>
|
|
(DEBUG, EVAL[vcp.getWidget{"x_probed_width"}.setValue{#1001}])
|
|
|
|
#1002 = #<x_center_probed>
|
|
(DEBUG, EVAL[vcp.getWidget{"x_center_probed"}.setValue{#1002}])
|
|
|
|
G91
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 Z[#<z_probe_stack>]
|
|
G90
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 X[#<x_center_probed>]
|
|
|
|
(Probe Y Positioning Move, Y hint/2 + Step Off Width)
|
|
G91
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 Y-[#<cal_diameter>/2 + #<step_off_width>]
|
|
|
|
(Probe Y Positioning Move, to Probing Depth)
|
|
F[#<probe_fast_fr>]
|
|
G38.3 Z-[#<z_probe_stack>]
|
|
|
|
(Call sub "probe_y_plus" to Probe y+ side of Workpiece)
|
|
o<probe_y_plus> call [#3014][#3015][#3016][#3017][#3018][#3019][#3032]
|
|
|
|
#<y_plus_probed> = #5062
|
|
|
|
(first side Probe Completion Move to Z Clearance Plane)
|
|
G91
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 Z[#<z_probe_stack>]
|
|
|
|
(Positioning move in Y, Y Hint + Step Off Width at Rapid Speed)
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 Y[#<cal_diameter> + #<step_off_width> + #<xy_clearance>]
|
|
|
|
(Probe Y Positioning Move, to Probing Depth)
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 Z-[#<z_probe_stack>]
|
|
|
|
(Call sub "probe_y_minus" to Probe y- side of Workpiece)
|
|
o<probe_y_minus> call [#3014][#3015][#3016][#3017][#3018][#3019][#3032]
|
|
|
|
#<y_minus_probed> = #5062
|
|
|
|
(probed center calulation)
|
|
#<y_center_probed> = [[#<y_minus_probed> + #<y_plus_probed>] / 2]
|
|
|
|
(calculate Y Width Probed)
|
|
o120 if [#<y_minus_probed> GT #<y_plus_probed>]
|
|
#<y_raw_width> = [#<y_minus_probed> - #<y_plus_probed>]
|
|
o120 else
|
|
#<y_raw_width> = [#<y_plus_probed> - #<y_minus_probed>]
|
|
o<probe_round_boss> return
|
|
o120 endif
|
|
|
|
(Completed probed width calculations)
|
|
#<y_probed_width> = [#<y_raw_width> - #<probe_diameter_offset>]
|
|
|
|
#1003 = #<y_probed_width>
|
|
(DEBUG, EVAL[vcp.getWidget{"y_probed_width"}.setValue{#1003}])
|
|
|
|
#1004 = #<y_center_probed>
|
|
(DEBUG, EVAL[vcp.getWidget{"y_center_probed"}.setValue{#1004}])
|
|
|
|
#<averaged_diam> = [[#<x_probed_width> + #<y_probed_width>] / 2]
|
|
|
|
#1010 = #<averaged_diam>
|
|
(DEBUG, EVAL[vcp.getWidget{"averaged_diam"}.setValue{#1010}])
|
|
|
|
G91
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 Z[#<z_probe_stack>]
|
|
G90
|
|
F[#<probe_traverse_fr>]
|
|
G38.3 X[#<x_center_probed>] Y[#<y_center_probed>]
|
|
|
|
o130 if [#<cal_diameter> GT #<x_probed_width>]
|
|
(calculate calibration error and adjust calibration offset)
|
|
#<x_cal_error> = [[#<cal_diameter> - #<x_probed_width>] / 2]
|
|
#<new_x_cal_offset> = [#<x_cal_error>]
|
|
o130 else
|
|
#<x_cal_error> = [[#<x_probed_width> - #<cal_diameter>] / 2]
|
|
#<new_x_cal_offset> = [#<x_cal_error>]
|
|
o130 endif
|
|
|
|
o140 if [#<cal_diameter> GT #<y_probed_width>]
|
|
(calculate calibration error and adjust calibration offset)
|
|
#<y_cal_error> = [[#<cal_diameter> - #<y_probed_width>] / 2]
|
|
#<new_y_cal_offset> = [#<y_cal_error>]
|
|
o140 else
|
|
#<y_cal_error> = [[#<y_probed_width> - #<cal_diameter>] / 2]
|
|
#<new_y_cal_offset> = [#<y_cal_error>]
|
|
o140 endif
|
|
|
|
#<new_avg_cal_offset> = [[#<new_x_cal_offset> + #<new_y_cal_offset>] / 2]
|
|
|
|
o150 if [#<sq_cal_axis> EQ 0]
|
|
#3032 = [ABS[#<new_avg_cal_offset>]]
|
|
(DEBUG, EVAL[vcp.getWidget{"calibration_offset_3032"}.setValue{#3032}])
|
|
o150 else if [#<sq_cal_axis> EQ 1]
|
|
#3032 = [ABS[#<new_x_cal_offset>]]
|
|
(DEBUG, EVAL[vcp.getWidget{"calibration_offset_3032"}.setValue{#3032}])
|
|
o150 else
|
|
#3032 = [ABS[#<new_y_cal_offset>]]
|
|
(DEBUG, EVAL[vcp.getWidget{"calibration_offset_3032"}.setValue{#3032}])
|
|
o150 endif
|
|
|
|
#<x_zero> = [#<x_center_probed> + #<workspace_x>]
|
|
|
|
#<y_zero> = [#<y_center_probed> + #<workspace_y>]
|
|
|
|
(probe mode rules for WCO or probe position measuring only)
|
|
o160 if [#<probe_mode> EQ 0]
|
|
(Record XY Zero in selected WCO)
|
|
G10 L2 P#5220 X[#<x_zero>] Y[#<y_zero>]
|
|
o160 endif
|
|
|
|
(Reinstate Feedrate Override)
|
|
M50 P1
|
|
|
|
o<probe_cal_round_boss> endsub
|
|
|
|
M2 (end program)
|