/ nc_files / probe / basic_probe / macros / probe_front_edge_angle.ngc
probe_front_edge_angle.ngc
  1  (author: Chris P)
  2  (version: 0.4)
  3  (date: 04/25/19)
  4  
  5  (Probe top front edge angle for y,z 0,0 position and edge angle)
  6  (Start probe position is over front edge of stock, set edge width,)
  7  (step off width distance and within max z distance)
  8  (ensure all settings have been set properly according to help diagrams)
  9  
 10  o<probe_front_edge_angle> sub
 11  
 12    (uses NGCGUI style arg spec)
 13    (number after "=" in comment is default value)
 14    #<probe_tool_number> = #1    (=99)
 15    #<max_z_distance> = #2       (=0.5000)
 16    #<max_xy_distance> = #3      (=0.5000)
 17    #<xy_clearance> = #4         (=0.1000)
 18    #<z_clearance> = #5          (=0.1000)
 19    #<step_off_width> = #6       (=0.5000)
 20    #<extra_probe_depth> = #7    (=0.0000)
 21    #<probe_slow_fr> = #8        (=0.0)
 22    #<probe_fast_fr> = #9        (=10.0)
 23    #<calibration_offset> = #10  (=0.0000)
 24    #<x_hint> = #11              (=1.0000)
 25    #<y_hint> = #12              (=1.0000)
 26    #<diameter_hint> = #13       (=1.0000)
 27    #<edge_width> = #14          (=0.5000)
 28    #<probe_mode> = #15          (=0)
 29    #<wco_rotation> = #16        (=0)
 30  
 31    (Cancel G92 offsets)
 32    G92.1
 33  
 34    #<workspace_y> = #[5202 + [20 * #5220]]
 35  
 36      (Probe Tool Safety Check)
 37    o<110> if [#5400 NE #<probe_tool_number>]
 38    (MSG, Specified probe tool #<probe_tool_number> not in spindle, aborting)
 39     o<probe_front_edge_angle> return
 40    o<110> endif
 41  
 42    (Probe Diameter)
 43    #<probe_diameter> = #5410
 44  
 45    (Probing depth from the z probed clearance height, used for z moves)
 46    #<z_probe_stack> = [#<z_clearance> + #<probe_diameter> + #<extra_probe_depth>]
 47  
 48    #<x_start_position> = #5420
 49  
 50    (Probe Y Positioning Move, Step Off Width)
 51    G91
 52    G0 Y-[#<step_off_width>]
 53  
 54    (Probe Y Positioning Move, to Probing Depth)
 55    F[#<probe_fast_fr>]
 56    G1 Z-[#<z_probe_stack>]
 57  
 58    (Call sub "probe_y_plus" to Probe y+ side of Workpiece)
 59    o<probe_y_plus> call [#1][#3][#4][#8][#9][#10]
 60  
 61    #<y_plus_zero_edge_start> = #<_value>
 62  
 63    (value returned safety check, aborts if no value returned)
 64    o<120> if [#<probe_mode> EQ 1 AND #<_value_returned> NE 1]
 65      (MSG, Missing Y Sub returned edge parameter, aborting)
 66      o<probe_front_edge_angle> return
 67    o<120> endif
 68  
 69    (edge width move to edge second probing point)
 70    G91
 71    F[#<probe_fast_fr>]
 72    G1 X[#<edge_width>]
 73  
 74    (Call sub "probe_y_plus" to Probe y+ side of Workpiece)
 75    o<probe_y_plus> call [#1][#3][#4][#8][#9][#10]
 76  
 77    #<y_plus_zero_edge_end> = #<_value>
 78  
 79    (value returned safety check, aborts if no value returned)
 80    o<130> if [#<probe_mode> EQ 1 AND #<_value_returned> NE 1]
 81      (MSG, Missing Y Sub returned edge parameter, aborting)
 82      o<probe_front_edge_angle> return
 83    o<130> endif
 84  
 85    #<edge_delta> = [#<y_plus_zero_edge_end> - #<y_plus_zero_edge_start>]
 86  
 87    #<edge_angle> = [ATAN [#<edge_delta>] / [#<edge_width>]]
 88  
 89    M68 E4 Q[#<edge_delta>]
 90  
 91    M68 E3 Q[#<edge_angle>]
 92  
 93    (Probe Completion Move to Z Clearance Plane, and Y Zero)
 94    G91
 95    G0 Z[#<z_probe_stack>]
 96    G90
 97    G0 X[#<x_start_position>] Y[#<y_plus_zero_edge_start>]
 98  
 99    (probe mode rules for WCO, Rotation and probe position measuring only)
100    o<140> if [#<probe_mode> EQ 0 AND #<wco_rotation> EQ 0]
101      (Record Zero in selected axes and WCO)
102      G10 L2 P#5220 X[#<x_start_position>] Y[#<y_plus_zero_edge_start> + #<workspace_y>]
103      o<probe_front_edge_angle> return
104    o<140> endif
105  
106    (probe mode rules for WCO, Rotation and probe position measuring only)
107    o<150> if [#<probe_mode> EQ 0 AND #<wco_rotation> EQ 1]
108      (Record Zero in selected axes and WCO)
109      G10 L2 P#5220 X[#<x_start_position>] Y[#<y_plus_zero_edge_start> + #<workspace_y>] R[#<edge_angle>]
110      o<probe_front_edge_angle> return
111    o<150> endif
112  
113  o<probe_front_edge_angle> endsub
114  
115  M2 (end program)
116