probe_right_outside.ngc
1 (author: Chris P) 2 (version: 0.3) 3 (date: 04/25/19) 4 5 (Probe right top side for x,z 0,0 position) 6 (Start probe position is over right side edge of stock) 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_right_outside> 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_right_top_side> return 39 o<110> endif 40 41 (Probe Diameter) 42 #<probe_diameter> = #5410 43 44 (Probing depth from the z probed clearance height, used for z moves) 45 #<z_probe_stack> = [#<z_clearance> + #<probe_diameter> + #<extra_probe_depth>] 46 47 (Probe X Positioning Move, Step Off Width) 48 G91 49 G0 X[#<step_off_width>] 50 51 (Probe X Positioning Move, to Probing Depth) 52 F[#<probe_fast_fr>] 53 G1 Z-[#<z_probe_stack>] 54 55 (Call sub "probe_x_minus" to Probe x- side of Workpiece) 56 o<probe_x_minus> call [#1][#3][#4][#8][#9][#10] 57 58 #<x_minus_zero_edge> = #<_value> 59 60 (value returned safety check, aborts if no value returned) 61 o<120> if [#<probe_mode> EQ 1 AND #<_value_returned> NE 1] 62 (MSG, Missing X Sub returned edge parameter, aborting) 63 o<probe_right_top_side> return 64 o<120> endif 65 66 (Probe Completion Move to Z Clearance Plane, and Y Zero) 67 G91 68 G0 Z[#<z_probe_stack>] 69 G90 70 G0 X[#<x_minus_zero_edge>] 71 72 (probe mode rules for WCO or probe position measuring only) 73 o<130> if [#<probe_mode> EQ 0] 74 (Record Zero in selected axes and WCO) 75 G10 L2 P#5220 X[#<x_minus_zero_edge> + #<workspace_x>] 76 o<probe_right_top_side> return 77 o<130> endif 78 79 o<probe_right_outside> endsub 80 81 M2 (end program) 82