'load Tool position 1'################# load Tool position 11/2018 CNC4XR7#############################'#################ISO 20 Style holders Slide in ########################################################Sub Main()DoSpinStop()                 	Code"M09"                    '################ ################x = GetToolChangeStart( 0 )y = GetToolChangeStart( 1 ) z = GetToolChangeStart( 2 ) '########################################MaxToolNum = 99     OldTool=GetUserDro(1201)  Tool = GetUserDro(1224)  TCFR = GetOEMDRO(1251) y1=GetUserDro(1231)ToolDown   = GetUserDro(1221)  ToolUp     = GetUserDro(1222)  Xstart  = GetUserDro(1225)  Xrack = GetUserDRO(1220)  '#############  #######################If OldTool = (0) ThenMessage" Moving to Rack Position"End IfIf Tool > MaxToolNum ThenMessage " Tool # " & Tool & " Exceeds Maximun Tool # " & MaxToolNumStop End IfWhile OldTool > (0)Dim Msg, Style, TitleMsg = "Verify Tool # " & OldTool & " Is Not In Slot or Delete DRO          " ' Style = 1 + 32 + 0  Title = "    Slot Position Full "   Response = MsgBox(Msg, Style, Title)If Response = (4) Then  ElseStopEnd IfWend'######################################Code "G00 G53 Z0.0"While IsMoving()WendCode "G00 G53 X" & XstartCode "G00 G53 Y" & y1While IsMoving()WendCode "F" & TCFRCode "G53 Z" & ToolDown Code "G4 P.75"While IsMoving()WendCode "G53 X" & XrackWhile IsMoving()WendCode "M7" 'Air blastCode "G4 P.25"Code "M9"ActivateSignal(Output6)Sleep(2000) Code "G4 P1.0"   Call PdbOpen()Code "G00 G53 Z" & ToolUpCode "G00 Z "& z & " X" & x & " Y" & ySetUserDRO(1201,Tool)SetUserDRO(1224,0)End SubSub PdbOpenDim UnclampUnclamp = GetOEMLed(823)If Unclamp = (False)ThenMessage" PDB Released"ElseCall  PdbFaultEnd IfEnd SubSub PdbFaultDim Msg, Style, TitleMsg = "Tool Not Released Clear Jam?          " 'Style = 5 + 16 + 0   ' Title = "    PDB Failed "   ' Response = MsgBox(Msg, Style, Title)If Response = (4) Then Call PdbOpen ElseCode "M30"StopEnd IfEnd SubSub PdbCloseDim ClampedClamped = GetOEMLed(823)If Clamped = (True)ThenMessage" Tool secure"ElseCall ClampFaultEnd IfEnd SubSub ClampFaultDim Msg, Style, TitleMsg = "       Tool Not Secure Clear Jam?          "  Style = 5 + 16 + 0   Title = "    PDB Clamp Failed "   Response = MsgBox(Msg, Style, Title)If Response = (4) Then Call PdbClose ElseCode "M30"StopEnd IfEnd SubMain     