'Macro M6Start for Boxfor VMC using pokeys 57U to add IO'***********************************************************************************Message""If  GetOEMLed(807) And  GetOemLED(808) And  GetOemLed(809) Then 'Check that all axis are REFMsgBox" 1 or more axis are  NOT REFERENCED cancel program and REF XYZC axis"EndEnd If  Dim OldTool as SingleDim NewTool as SingleDim X as DoubleDim Y As DoubleDim Z As Double'********************************OldTool = GetOEMDRO (1224)  'Tool In spindle DRO on settings screenNewTool = GetSelectedTool()If NewTool = OldTool Then 'If the new tool is the same as the old tool then exit out of macroMessage" Same Tool,  NO ACTION" EndEnd IfIf  NewTool > 8 Or NewTool < 1 ThenMsgBox" Tool # not a valid Number 1-8 ONLY, ENDING Program RUN "DoButton(3)EndEnd If'******************************'Code coppyed from Pokeys manual which looks for pokeys device'DevName = "PoKeys_35915"'Do'SearchName = GetIODevName(DevID)'Search for Pokeys Device'If(SearchName = "NoDevice") Then' MsgBox ("Error Finding Pokeys Device, Connect and try again")' Exit Sub'End If'Loop While (DevName <> SearchName)  '********************************Code"M09, M5"SLEEP(2000)x = GetUserDRO( 1200 ) y = GetUserDRO( 1201 )z = GetUserDRO( 1202 )Code"G00" 'Rapid MoveCode "G53Z" & z 'Move Z to safe Z levelCode "G53X" & x & "Y" & y 'Move X and Y to tool change locationWhile IsMoving()Wend 'Spindle is now is tool change location and spindle is stopped'********************************'after this part I am stuck and this is coppyed from other peoples macros and it just as a guideDoActivateSignal (OutPut3)If GetUserLED (1100) Then Exit DoCode "M3S100"SLEEP (10)LoopSLEEP (1000)DoActivateSignal(OutPut1)If GetUserLED(1005) Then Exit DoSleep 10LoopDoActivateSignal(OutPut3)If GetUserLED(1002) Then Exit DoSleep 10LoopActivateSignal(Output2)       'Turn On Draw bar to release the toolCode "G4 P2.0"          'Wait for the tool to releaseDoActivateSignal(OutPut4)If GetUserLED(1006) Then Exit DoSleep 10LoopCall  MovePos(NewTool)      'The ATC moves to the new tool.While IsMoving()WendDoDeactivateSignal(OutPut4)If GetUserLED(1001) Then Exit DoSleep 10LoopDeactivateSignal(Output2)    'Turn Off Draw bar to lock the toolCode "G4 P1.5"         'Wait for the tool to lockDoDeactivateSignal(OutPut3)If GetUserLED(1003) Then Exit DoSleep 10LoopDeactivateSignal(OutPut7)DoDeactivateSignal(OutPut1)If GetUserLED(1004) Then Exit DoSleep 10LoopSetOemDro(824,NewTool)Sub MovePos(ByVal ToolNumber As Integer)Select Case ToolNumber      'Positions to each tool in C-axis       Case  = 1        Code "G00 G53 C0 "      Case  = 2        Code "G00 G53 C36 "      Case  = 3        Code "G00 G53 C72 "      Case  = 4        Code "G00 G53 C108 "      Case  = 5        Code "G00 G53 C144 "      Case  = 6        Code "G00 G53 C180 "      Case  = 7        Code "G00 G53 C216 "      Case  = 8        Code "G00 G53 C252 "      Case  = 9        Code "G00 G53 C288 "      Case  = 10        Code "G00 G53 C324 "End SelectEnd Sub                                         