43
« on: June 23, 2013, 12:15:12 PM »
i think i manage to make a macro for the turret it seems it is working at home i will try it on the machine tomorrow
now the big issue is the spindle i have to find a way to make it working also i have the spindle with the encoder so i have to see how to connect that to the spindle csmio extention
Sub Main()
NewTool = GetSelectedTool()
OldTool = GetCurrentTool()
MaxToolNum = 7 'Max number of tools for the changer
While NewTool > MaxToolNum
NewTool = Question ("Enter New Tool Number up to " & MaxToolNum)
Wend
If NewTool = OldTool Or NewTool = 0 Then
Exit Sub
End If
If OldTool <> NewTool Then
While Slot <> NewTool
ActivateSignal(OUTPUT3) 'start rotating forward
If IsActive(INPUT3) And Not IsActive(INPUT2) And Not IsActive (INPUT1) Then
Slot = 1
End If
If Not IsActive(INPUT3) And IsActive(INPUT2) And Not IsActive (INPUT1) Then
Slot = 2
End If
If IsActive(INPUT3) And IsActive(INPUT2) And Not IsActive (INPUT1) Then
Slot = 3
End If
If Not IsActive(INPUT3) And Not IsActive(INPUT2) And IsActive(INPUT1) Then
Slot = 4
End If
If IsActive(INPUT3) And Not IsActive(INPUT2) And IsActive(INPUT1) Then
Slot = 5
End If
If Not IsActive(INPUT3) And IsActive(INPUT2) And IsActive(INPUT1) Then
Slot = 6
End If
If IsActive(INPUT3) And IsActive(INPUT2) And IsActive (INPUT1) Then
Slot = 7
End If
Wend
Sleep(100)
DeActivateSignal(OUTPUT3) 'stop rotating forward, rotate backward now
Sleep (100)
ActivateSignal(OUTPUT4)
Sleep (3000)
DeActivateSignal(OUTPUT4)
End If
SetOEMDRO(824,NewTool)
Code "G4 P2" 'A pause time of 2 seconds to give your reverse turret time to seat
While IsMoving
Wend
End Sub
Main