/ nc_files / probe / basic_probe / macros / probe_valley_x.ngc
probe_valley_x.ngc
  1  (author: Chris P)
  2  (version: 0.1)
  3  (date: 04/25/19)
  4  
  5  (Probe valley in x, find Z0, X0 valley center position)
  6  (Start probe position is over left side edge of valley wall)
  7  (inside the 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_valley_x> 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  
 30    (Cancel G92 offsets)
 31    G92.1
 32  
 33    #<workspace_x> = #[5201 + [20 * #5220]]
 34  
 35    (Probe Tool Safety Check)
 36    o<110> if [#5400 NE #<probe_tool_number>]
 37    (MSG, Specified probe tool #<probe_tool_number> not in spindle, aborting)
 38     o<probe_valley_x> return
 39    o<110> endif
 40  
 41    (Probe Diameter)
 42    #<probe_diameter> = #5410
 43  
 44    (remove probe tip diam and cal offset from probed width calculations)
 45    #<probe_diameter_offset> = [#<probe_diameter> - [#<calibration_offset> * 2]]
 46  
 47    #<z_probe_stack> = [#<z_clearance> + #<probe_diameter> + #<extra_probe_depth>]
 48  
 49    (Probe Z Positioning Move, to Probing Depth)
 50    G91
 51    F[#<probe_fast_fr>]
 52    G1 Z-[#<z_probe_stack>]
 53  
 54    (Probe X Positioning Move, Step Off Width)
 55    G0 X-[#<x_hint>/2 - #<step_off_width>]
 56  
 57    (Call sub "probe_x_minus" to Probe x- side of Workpiece)
 58    o<probe_x_minus> call [#1][#3][#4][#8][#9][#10]
 59  
 60    #<x_minus_probed> = #5061
 61  
 62    (Probe X Positioning Move, Step Off Width)
 63    G91
 64    G0 X[#<x_hint> - #<step_off_width>*2]
 65  
 66    (Call sub "probe_x_plus" to Probe x+ side of Workpiece)
 67    o<probe_x_plus> call [#1][#3][#4][#8][#9][#10]
 68  
 69    #<x_plus_probed> = #5061
 70  
 71    (probed center calculation)
 72    #<x_center_probed> = [[#<x_plus_probed> + #<x_minus_probed>] / 2]
 73  
 74    (calculate X Width Probed)
 75    #<raw_width> = [#<x_plus_probed> - #<x_minus_probed>]
 76  
 77    (Completed probed width calculations)
 78    #<x_probed_width> = [#<raw_width> + #<probe_diameter_offset>]
 79  
 80    M68 E0 Q[#<x_probed_width>]
 81  
 82    M68 E10 Q[#<x_center_probed>]
 83  
 84    (Probe Completion Move to Z Clearance Plane, and X Zero)
 85    G90
 86    G0 X[#<x_center_probed>]
 87    G91
 88    G0 Z[#<z_probe_stack>]
 89  
 90    (probe mode rules for WCO or probe position measuring only)
 91    o<120> if [#<probe_mode> EQ 0]
 92      (Record X Zero in selected WCO)
 93      G10 L2 P#5220 X[#<x_center_probed> + #<workspace_x>]
 94      o<probe_valley_x> return
 95    o<120> endif
 96  
 97  
 98  o<probe_valley_x> endsub
 99  
100  M2 (end program)
101