o sub ; # is the height you spindle needs to be at to clamp/unclamp a tool form the ATC (Set via INI [ATC]Z_TOOL_CHANGE_HEIGHT) ; # is the clearance height you spindle needs to be at to safely clear the ATC (Set via INI [ATC]Z_TOOL_CLEARANCE_HEIGHT) # = -3.9000 o100 if [EXISTS[#<_ini[atc]z_tool_change_height>]] # = #<_ini[atc]z_tool_change_height> o100 endif # = [#<_ini[AXIS_Z]MAX_LIMIT>-0.01] o110 if [EXISTS[#<_ini[atc]z_tool_clearance_height>]] # = #<_ini[atc]z_tool_clearance_height> o110 endif G0 G53 Z# ; move z to clear height M65 P1 ; Turn off carousel home solenoid M64 P0 ; Move Carousel OUT M66 P1 L3 Q5 ; check for carousel out position sensor o120 if [#5399 LT 0] M65 P0 ; switch off atc out solenoid (abort, ATC not in position) o120 endif o endsub [1] M2