1
General Mach Discussion / starting cycle after tool change
« on: September 24, 2008, 09:18:42 AM »
Hello friends,
i have a router with 3 head (tool changer) connected to Zaxis and activated by 3 pneumatic actuator.(output 1 to 3)
everything is working well the machine change positoning and tools ,but i need the machine to recontinue the automatic cycle after tool changing without pressing cycle start.
here is my m6start.m1s
OldTool = GetOEMDRO (1200) 'Tool In spindle DRO You must add this to your settings screen
x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
a = GetToolChangeStart( 3 )
b = GetToolChangeStart( 4 )
c = GetToolChangeStart( 5 )
tool = GetSelectedTool()
NewTool = tool
MaxToolNum = 3 'Max number off tools for the changer
ToolDown = -3.125 'Z Pos to Get or drop a tool
ToolUp = 10.0 'Z Hieght to Rapid from tool to tool
If NewTool = OldTool Then
Exit Sub
End If
While NewTool > MaxToolNum
NewTool = Question ("Enter New Tool Number up to " & MaxToolNum)
Wend
Code "G00 G53 Z" & ToolUp
While IsMoving()
Wend
Call oldPos(OldTool) 'get the old tools position
While IsMoving()
Wend
DeActivateSignal(Output1) 'turn off 1st head
DeActivateSignal(Output2) 'turn off 2nd head
DeActivateSignal(Output3) 'turn off 3rd head
Xo = GetOEMDRO (1150) 'old position
Yo = GetOEMDRO (1151) 'old position
While IsMoving()
Wend
Call newPos(NewTool)'get the new tools position
While IsMoving()
Wend
Xn = GetOEMDRO (1152) 'new position
Yn = GetOEMDRO (1153) 'new position
While IsMoving()
Wend
SetCurrentTool( NewTool )
Code "G91 X" & (Xn-Xo) &"Y" & (Yn-Yo) 'change position to new tools
Code "G92 X" & x & "Y" & y
code "G90"
Code "G0 Z" & z
Call SetUserDRO (1200,NewTool)
End Sub
Sub oldPos(ByVal ToolNumber As Integer)
Select Case ToolNumber
Case Is = 1
Xpos1 = 0
YPos1 = 10
Case Is = 2
Xpos1 = 0
YPos1 = 20
Case Is = 3
Xpos1 = 0
YPos1 = 30
End Select
Call SetUserDRO (1150,Xpos1) 'old position
Call SetUserDRO (1151,Ypos1) 'old position
End Sub
Sub newPos(ByVal ToolNumber As Integer)
Select Case ToolNumber
Case Is = 1
Xpos = 0 'position of first tools
YPos = 10
ActivateSignal(Output1)' active first tools
Case Is = 2
Xpos = 0 ' position of 2nd tools
YPos =20
ActivateSignal(Output2)' active 2nd tools
Case Is = 3
Xpos = 0 'position of 3rd tools
YPos = 30
ActivateSignal(Output3)' active 3rd tools
End Select
Call SetUserDRO (1152,Xpos) ' new position
Call SetUserDRO (1153,Ypos) ' new position
End Sub
Main
i have a router with 3 head (tool changer) connected to Zaxis and activated by 3 pneumatic actuator.(output 1 to 3)
everything is working well the machine change positoning and tools ,but i need the machine to recontinue the automatic cycle after tool changing without pressing cycle start.
here is my m6start.m1s
Code: [Select]
Sub Main()OldTool = GetOEMDRO (1200) 'Tool In spindle DRO You must add this to your settings screen
x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
a = GetToolChangeStart( 3 )
b = GetToolChangeStart( 4 )
c = GetToolChangeStart( 5 )
tool = GetSelectedTool()
NewTool = tool
MaxToolNum = 3 'Max number off tools for the changer
ToolDown = -3.125 'Z Pos to Get or drop a tool
ToolUp = 10.0 'Z Hieght to Rapid from tool to tool
If NewTool = OldTool Then
Exit Sub
End If
While NewTool > MaxToolNum
NewTool = Question ("Enter New Tool Number up to " & MaxToolNum)
Wend
Code "G00 G53 Z" & ToolUp
While IsMoving()
Wend
Call oldPos(OldTool) 'get the old tools position
While IsMoving()
Wend
DeActivateSignal(Output1) 'turn off 1st head
DeActivateSignal(Output2) 'turn off 2nd head
DeActivateSignal(Output3) 'turn off 3rd head
Xo = GetOEMDRO (1150) 'old position
Yo = GetOEMDRO (1151) 'old position
While IsMoving()
Wend
Call newPos(NewTool)'get the new tools position
While IsMoving()
Wend
Xn = GetOEMDRO (1152) 'new position
Yn = GetOEMDRO (1153) 'new position
While IsMoving()
Wend
SetCurrentTool( NewTool )
Code "G91 X" & (Xn-Xo) &"Y" & (Yn-Yo) 'change position to new tools
Code "G92 X" & x & "Y" & y
code "G90"
Code "G0 Z" & z
Call SetUserDRO (1200,NewTool)
End Sub
Sub oldPos(ByVal ToolNumber As Integer)
Select Case ToolNumber
Case Is = 1
Xpos1 = 0
YPos1 = 10
Case Is = 2
Xpos1 = 0
YPos1 = 20
Case Is = 3
Xpos1 = 0
YPos1 = 30
End Select
Call SetUserDRO (1150,Xpos1) 'old position
Call SetUserDRO (1151,Ypos1) 'old position
End Sub
Sub newPos(ByVal ToolNumber As Integer)
Select Case ToolNumber
Case Is = 1
Xpos = 0 'position of first tools
YPos = 10
ActivateSignal(Output1)' active first tools
Case Is = 2
Xpos = 0 ' position of 2nd tools
YPos =20
ActivateSignal(Output2)' active 2nd tools
Case Is = 3
Xpos = 0 'position of 3rd tools
YPos = 30
ActivateSignal(Output3)' active 3rd tools
End Select
Call SetUserDRO (1152,Xpos) ' new position
Call SetUserDRO (1153,Ypos) ' new position
End Sub
Main