Files
probe-basic-sim/configs/probe_basic/subroutines/probe_top_back_edge_angle.ngc
2025-12-14 18:29:18 +01:00

132 lines
4.0 KiB
Plaintext

(author: Chris P)
(version: 0.4)
(date: 06/27/24)
(Probe back top edge angle for y,z 0,0 position and edge angle)
(Start probe position is over back edge of stock, set edge width,)
(step off width distance and within max z distance)
(ensure all settings have been set properly according to help diagrams)
o<probe_top_back_edge_angle> 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)
#<edge_width> = #3024 (=0.5000)
#<probe_mode> = #3030 (=0)
#<wco_rotation> = #3031 (=0)
#<calibration_offset> = #3032 (=0)
(Cancel G92 offsets)
G92.1
(Cancel Feedrate Override)
M50 P0
(set rotation offset to zero for new probe cycle)
G10 L2 P[#5220] R0
#<workspace_y> = #[5202 + [20 * #5220]]
(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_top_back_edge_angle> return
o100 endif
(Probe Diameter)
#<probe_diameter> = #5410
(Probing depth from the z probed clearance height, used for z moves)
#<z_probe_stack> = [#<z_clearance> + #<probe_diameter> + #<extra_probe_depth>]
#<x_start_position> = #5420
(Call sub "probe_z_minus_sub" to Probe top of Workpiece)
o<probe_z_minus_sub> call [#3014][#3015][#3016][#3017][#3020][#3021][#3030]
(Probe Y Positioning Move, Step Off Width)
G91
F[#<probe_traverse_fr>]
G38.3 Y[#<step_off_width>]
(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_zero_edge_start> = #<_value>
(value returned safety check, aborts if no value returned)
o110 if [#<probe_mode> EQ 1 AND #<_value_returned> NE 1]
(DEBUG, Missing Y Sub returned edge parameter, aborting)
M50 P1
o<probe_top_back_edge_angle> return
o110 endif
(edge width move to edge second probing point)
G91
F[#<probe_fast_fr>]
G38.3 X-[#<edge_width>]
(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_zero_edge_end> = #<_value>
(value returned safety check, aborts if no value returned)
o120 if [#<probe_mode> EQ 1 AND #<_value_returned> NE 1]
(DEBUG, Missing Y Sub returned edge parameter, aborting)
M50 P1
o<probe_top_back_edge_angle> return
o120 endif
#<edge_delta> = [#<y_minus_zero_edge_start> - #<y_minus_zero_edge_end>]
#<edge_angle> = [ATAN [#<edge_delta>] / [#<edge_width>]]
#1011 = #<edge_delta>
(DEBUG, EVAL[vcp.getWidget{"edge_delta"}.setValue{#1011}])
#1012 = #<edge_angle>
(DEBUG, EVAL[vcp.getWidget{"edge_angle"}.setValue{#1012}])
(Probe Completion Move to Z Clearance Plane, and Y Zero)
G91
F[#<probe_traverse_fr>]
G38.3 Z[#<z_probe_stack>]
G90
F[#<probe_traverse_fr>]
G38.3 X[#<x_start_position>] Y[#<y_minus_zero_edge_start>]
(probe mode rules for WCO, Rotation and probe position measuring only)
o130 if [#<probe_mode> EQ 0 AND #<wco_rotation> EQ 0]
(Record Zero in selected axes and WCO)
G10 L2 P#5220 X[#<x_start_position>] Y[#<y_minus_zero_edge_start> + #<workspace_y>]
o130 endif
(probe mode rules for WCO, Rotation and probe position measuring only)
o140 if [#<probe_mode> EQ 0 AND #<wco_rotation> EQ 1]
(Record Zero in selected axes and WCO)
G10 L2 P#5220 X[#<x_start_position>] Y[#<y_minus_zero_edge_start> + #<workspace_y>] R[#<edge_angle>]
o140 endif
(Reinstate Feedrate Override)
M50 P1
o<probe_top_back_edge_angle> endsub
M2 (end program)