Files
probe-basic-sim/configs/atc_sim/macros_sim/probe_z_minus_sub.ngc
2025-12-14 18:29:18 +01:00

85 lines
2.3 KiB
Plaintext

(author: Chris P)
(version: 0.2)
(date: 06/27/24)
(Probe Z Minus direction and set Z 0 in current WCO)
(Start probe position is over stock within max z distance)
(ensure all settings have been set properly according to help diagrams)
o<probe_z_minus_sub> sub
(uses NGCGUI style arg spec)
(number after "=" in comment is default value)
#<probe_tool_number> = #1
#<probe_slow_fr> = #2
#<probe_fast_fr> = #3
#<probe_traverse_fr> = #4
#<max_z_distance> = #5
#<z_clearance> = #6
#<probe_mode> = #7
(Cancel G92 offsets)
G92.1
#<workspace_z> = #[5203 + [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)
o<probe_z_minus_sub> return
o100 endif
(Current Z Position including offsets in current program units)
#<z> = #5422
(Initial Fast Z- Probe)
G91
F[#<probe_fast_fr>]
G38.2 Z-[#<max_z_distance>]
#<z_minus_probed> = #5063
(Probe Error check, #5070 will be 0 if failed)
o110 if [#5070 EQ 0]
(back to start point and feed)
G90
G1 F[#<probe_traverse_fr>] Z#<z>
F[#<probe_fast_fr>]
(return from sub)
o<probe_z_minus_sub> return
o110 endif
(Move to z_clearance height for slow probe)
G90
G1 F[#<probe_traverse_fr>] Z[#<z_minus_probed> + #<z_clearance>]
(Slow Probe Rule, if Slow Probe FR is set to 0, Slow Probe is Bypassed)
o120 if [#<probe_slow_fr> GT 0]
(Initiate Slow Z- Probe)
G91
F[#<probe_slow_fr>]
G38.2 Z-[#<z_clearance> * 2]
#<z_minus_probed> = #5063
G90
G1 F[#<probe_traverse_fr>] Z[#<z_minus_probed> + #<z_clearance>]
o120 endif
(defines the edge as z_probed_position for DRO reporting)
#<z_minus_probed_position> = #<z_minus_probed>
(output to gui DRO "Z PROBED POSITION")
#1009 = #<z_minus_probed_position>
(DEBUG, EVAL[vcp.getWidget{"z_minus_probed_position"}.setValue{#1009}])
#<z_finish_height> = [#<z_minus_probed> + #<z_clearance>]
(probe mode rule for WCO or probe position measuring only)
o130 if [#<probe_mode> EQ 0]
(Record Z zero in selected WCO)
G10 L2 P#5220 Z[#<z_minus_probed> + #<workspace_z>]
o<probe_z_minus_sub> return
o130 endif
o<probe_z_minus_sub> endsub [#<z_finish_height>]
M2 (end program)