(author: Chris P) (version: 0.6) (date: 01/28/26) (load tool in spindle safety macro) ; This is called form the ATC page ; Parameter #3991 is used to track the current tool loaded it in the spindle (persistently) ; Parameters #4001 to #4024 are used to track which tool is in which pocket (persistently) ; Parameter #4000 is not populated just used in the maths to calculate the above numbers ; #: The number of pockets the ATC platter has, This is user set in the INI file via #<_ini[atc]pockets> o sub (PRINT, o) # = #1 ; this is the value form the ATC tab # = #3014 ; Update atc pocket count based on INI settings o101 if [EXISTS[#<_ini[atc]pockets>]] # = #<_ini[atc]pockets> o101 endif #10 = 0 #11 = 0 ; 1 if tool is already stored in carousel o110 while [#10 LT #] #10 = [#10+1] o111 if [# EQ #[4000 + #10]] #11 = 1 o111 endif o110 endwhile o120 if [#11 EQ 1] (abort, Tool %d# is already stored in carousel, not loading into spindle) o120 endif o130 if [#11 EQ 0] M61 Q# G43 H# #3991 = # o130 endif o140 if [# EQ #] S0 M5 o140 endif o call o endsub M2 (end program)