o sub ;(debug, in change tool_in_spindle=# current_pocket=#) ;(debug, selected_tool=# selected_pocket=#) ;otherwise after the M6 this information is gone! # = # # = # o100 if [#=<#selected_tool>] o100 o endsub [1] o100 endif ; we must execute this only in the milltask interpreter ; or preview will break, so test for '#<_task>' which is 1 for ; the milltask interpreter and 0 in the UI's O200 if [#<_task> EQ 0] (debug, Task ist Null) O200 return [999] O200 endif ;first go up G53 G0 Z[#<_ini[CHANGE_POSITION]Z>] ; then move to change position G53 G0 X[#<_ini[CHANGE_POSITION]X>] Y[#<_ini[CHANGE_POSITION]Y>] ; cancel tool offset G49 ; using the code being remapped here means 'use builtin behaviour' M6 O300 if [#<_hal[gmoccapy.toolmeasurement]> EQ 0] O300 return [3] ; indicate no tool measurement O300 endif G53 G0 X[#<_ini[TOOLSENSOR]X>] Y[#<_ini[TOOLSENSOR]Y>] G53 G0 Z[#<_ini[TOOLSENSOR]Z>] O400 if [#<_hal[gmoccapy.searchvel]> LE 0] O400 return [-1] ; indicate searchvel <= 0 O400 endif O500 if [#<_hal[gmoccapy.probevel]> LE 0] O500 return [-2] ; indicate probevel <= 0 O500 endif F #<_hal[gmoccapy.searchvel]> G91 G38.2 Z #<_ini[TOOLSENSOR]MAXPROBE> ;G0 Z2 G0 Z0.5 ; This is commented out only for sim. F #<_hal[gmoccapy.probevel]> ;G38.2 Z-4 G38.2 Z-0.75 O600 if [#5070 EQ 0] G90 O600 return [-3] ; indicate probe contact failure to epilog O600 endif G90 G53 G0 Z[#<_ini[CHANGE_POSITION]Z>] # = #5063 # = #<_hal[gmoccapy.probeheight]> # = #<_hal[gmoccapy.blockheight]> ;(DEBUG, # # #) G10 L1 P# Z[# - #<_hal[gmoccapy.probeheight]> + #<_hal[gmoccapy.blockheight]>] G43 G0 G54 Y0.0 X0.0 ;G10 L2 P0 Z[# - #<_hal[gmoccapy.probeheight]> + #<_hal[gmoccapy.blockheight]>] ;G10 L2 P1 Z[# - #<_hal[gmoccapy.probeheight]>] ;G54 G0 Y0.0 X0.0 ; signal success be returning a value > 0: o endsub [1]