Post by rational1 on Aug 23, 2012 13:25:16 GMT -8
When I installed MSM my tool changer macro quit working.
I inserted my tool change macro into M6ATC, and put it into the correct profile macro folder
1) Windows XP 32
2) Using Mill version Pro
3) Mach3 Version R3.43.062
4) Galil Plugin and interface
When I try to do a tool change I get the error message: "M6ATC Wrapper Error
Script to be run \Macros\MillVulcanMMS\M6ATC
Error=Unknown Error From Runscript
RS Error Value = -101"
So I ran the file M6ATC in the VBScript Editor, and I do get an error that OldTool hasn't been initialized, but this script runs fine in Non MSM M6Start.
Below is the M6ATC file with my tool change script inserted:
Option Explicit
'********DO NOT remove or change the expand line or the included file contents******************
' MachStdMIll license terms REQUIRE that the copyright and License terms remain a part of this source file
#expand <Masters\Headers\CopyRightAndLicenseNotice>
'**************************************************************************************
' this is a template script for M6ATC.m1s
' This template is installed by MSM into <mach install dir>\MachStdMill\Profile Macro Masters\Templates
'
' the Auto Tool Changer implementer should flesh this template out with appropriate code.
' this script is called from MSMM6start for AutoTC mode
' the script will be looked for by M6Start in the macro dir for the current profile
' i.e. in "<mach install dir>\Macros\<GetActiveProfileName() >\" and the name of the script in that dir must be "M6ATC"
'
' this script is responsible for physically putting GetSelectedTool() into the spindle
' this script should returns when the tool mount is complete
'
' the routine should do all TC operations in G53 coordinates
' Routine is entered with G90 G00 G40
' entry point into the script
' dummy code just to let us know the script was called
'msgbox "M6ATC was called."
'home machine
If(GetOemLed(807) Or GetOemLed(808) Or GetOemLed(809)) Then
Message(" Please Home Machine before Tool Change")
DoButton(3) 'Cycle Stop
Exit Sub
End If
'assign OldTool
If IsActive(OEMTRIG5) Then
If IsActive(OEMTRIG6) Then
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
OldTool = 6 '1111 'This is where the code now stops
Else
OldTool = 13 '1110
End If
Else
If IsActive(OEMTRIG8) Then
OldTool = 2 '1101
Else
OldTool = 9 '1100
End If
End If
Else
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
OldTool = 4 '1011
Else
OldTool = 11 '1010
End If
Else
If IsActive(OEMTRIG8) Then
OldTool = 15 '1001
Else
OldTool = 7 '1000
End If
End If
End If
Else
If IsActive(OEMTRIG6) Then
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
OldTool = 5 '0111
Else
OldTool = 12 '0110
End If
Else
If IsActive(OEMTRIG8) Then
OldTool = 1 '0101
Else
OldTool = 8 '0100
End If
End If
Else
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
OldTool = 3 '0011
Else
OldTool = 10 '0010
End If
Else
If IsActive(OEMTRIG8) Then
OldTool = 14 '0001
Else
OldTool = 0 '0000
End If
End If
End If
End If
NewTool = GetSelectedTool()
'---------------------------BEGIN TOOL CHANGE-------------------------------
If NewTool <> OldTool Then ' new if statement
message("M6 Start")
GotoSafeZ
While IsMoving()
Wend
message("Z to Zero")
' If 'is not at safeZ
' GotoSafeZ
' While IsMoving()
' Wend
' End If
ActivateSignal( OUTPUT8 )
While Not IsActive(OEMTRIG9) 'GALIL DI13
Wend
DEActivateSignal( OUTPUT8 )
HaveMoved = 0
ToolDif = NewTool - OldTool
MaxToolNum = 15
While (NewTool < 1)Or(NewTool >15 )
NewTool = Question ("Enter New Tool Number up to " & MaxToolNum)
Wend
'how far to move
If Abs(ToolDif) > 8 Then
If ToolDif > 0 Then
ToolDif8 = ToolDif - 15
Else
ToolDif8 = ToolDif + 15
End If
Else
ToolDif8 = ToolDif
End If
NumChange = Abs(ToolDif8)
'figure out which direction to move and start moving
If ToolDif < -8 Or (ToolDif > 0 And ToolDif <= 8) Then
ActivateSignal( OUTPUT3 ) 'set carrosel to turn cw
cw = 1
message( "OUTPUT3 is active...going CW" )
Else
ActivateSignal( OUTPUT4 ) 'set carrosel to turn ccw
cw = 0
message( "OUTPUT4 is active...going CCW" )
End If
'initially, wait a little to account for acceleration
Sleep 25
While (OldTool <> NewTool)
Sleep 320
If IsActive(OEMTRIG5) Then
If IsActive(OEMTRIG6) Then
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
OldTool = 6 '1111
Else
OldTool = 13 '1110
End If
Else
If IsActive(OEMTRIG8) Then
OldTool = 2 '1101
Else
OldTool = 9 '1100
End If
End If
Else
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
OldTool = 4 '1011
Else
OldTool = 11 '1010
End If
Else
If IsActive(OEMTRIG8) Then
OldTool = 15 '1001
Else
OldTool = 7 '1000
End If
End If
End If
Else
If IsActive(OEMTRIG6) Then
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
OldTool = 5 '0111
Else
OldTool = 12 '0110
End If
Else
If IsActive(OEMTRIG8) Then
OldTool = 1 '0101
Else
OldTool = 8 '0100
End If
End If
Else
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
OldTool = 3 '0011
Else
OldTool = 10 '0010
End If
Else
If IsActive(OEMTRIG8) Then
OldTool = 14 '0001
Else
OldTool = 0 '0000
End If
End If
End If
End If
Wend
'stop moving
DeActivateSignal( OUTPUT4 )
DeActivateSignal( OUTPUT3 )
Sleep 3000
If IsActive(OEMTRIG5) Then
If IsActive(OEMTRIG6) Then
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
ToolCheck = 6 '1111
Else
ToolCheck = 13 '1110
End If
Else
If IsActive(OEMTRIG8) Then
ToolCheck = 2 '1101
Else
ToolCheck = 9 '1100
End If
End If
Else
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
ToolCheck = 4 '1011
Else
ToolCheck = 11 '1010
End If
Else
If IsActive(OEMTRIG8) Then
ToolCheck = 15 '1001
Else
ToolCheck = 7 '1000
End If
End If
End If
Else
If IsActive(OEMTRIG6) Then
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
ToolCheck = 5 '0111
Else
ToolCheck = 12 '0110
End If
Else
If IsActive(OEMTRIG8) Then
ToolCheck = 1 '0101
Else
ToolCheck = 8 '0100
End If
End If
Else
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
ToolCheck = 3 '0011
Else
ToolCheck = 10 '0010
End If
Else
If IsActive(OEMTRIG8) Then
ToolCheck = 14 '0001
Else
ToolCheck = 0 '0000
End If
End If
End If
End If
If (NewTool <> ToolCheck) Then
MsgBox("incorrect tool! new tool should be,1 " & NewTool)
If Response = 1 Then
Message("wtf")
End If
End If
SetCurrentTool( NewTool )
ActivateSignal( OUTPUT6 )
While Not IsActive( OEMTRIG10 )
Wend
DeActivateSignal( OUTPUT6 )
'------------------------------END TOOL CHANGE------------------------------
Else
message("tool in use!")
End If
message("toolchange finished!")
End
exit sub
I inserted my tool change macro into M6ATC, and put it into the correct profile macro folder
1) Windows XP 32
2) Using Mill version Pro
3) Mach3 Version R3.43.062
4) Galil Plugin and interface
When I try to do a tool change I get the error message: "M6ATC Wrapper Error
Script to be run \Macros\MillVulcanMMS\M6ATC
Error=Unknown Error From Runscript
RS Error Value = -101"
So I ran the file M6ATC in the VBScript Editor, and I do get an error that OldTool hasn't been initialized, but this script runs fine in Non MSM M6Start.
Below is the M6ATC file with my tool change script inserted:
Option Explicit
'********DO NOT remove or change the expand line or the included file contents******************
' MachStdMIll license terms REQUIRE that the copyright and License terms remain a part of this source file
#expand <Masters\Headers\CopyRightAndLicenseNotice>
'**************************************************************************************
' this is a template script for M6ATC.m1s
' This template is installed by MSM into <mach install dir>\MachStdMill\Profile Macro Masters\Templates
'
' the Auto Tool Changer implementer should flesh this template out with appropriate code.
' this script is called from MSMM6start for AutoTC mode
' the script will be looked for by M6Start in the macro dir for the current profile
' i.e. in "<mach install dir>\Macros\<GetActiveProfileName() >\" and the name of the script in that dir must be "M6ATC"
'
' this script is responsible for physically putting GetSelectedTool() into the spindle
' this script should returns when the tool mount is complete
'
' the routine should do all TC operations in G53 coordinates
' Routine is entered with G90 G00 G40
' entry point into the script
' dummy code just to let us know the script was called
'msgbox "M6ATC was called."
'home machine
If(GetOemLed(807) Or GetOemLed(808) Or GetOemLed(809)) Then
Message(" Please Home Machine before Tool Change")
DoButton(3) 'Cycle Stop
Exit Sub
End If
'assign OldTool
If IsActive(OEMTRIG5) Then
If IsActive(OEMTRIG6) Then
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
OldTool = 6 '1111 'This is where the code now stops
Else
OldTool = 13 '1110
End If
Else
If IsActive(OEMTRIG8) Then
OldTool = 2 '1101
Else
OldTool = 9 '1100
End If
End If
Else
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
OldTool = 4 '1011
Else
OldTool = 11 '1010
End If
Else
If IsActive(OEMTRIG8) Then
OldTool = 15 '1001
Else
OldTool = 7 '1000
End If
End If
End If
Else
If IsActive(OEMTRIG6) Then
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
OldTool = 5 '0111
Else
OldTool = 12 '0110
End If
Else
If IsActive(OEMTRIG8) Then
OldTool = 1 '0101
Else
OldTool = 8 '0100
End If
End If
Else
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
OldTool = 3 '0011
Else
OldTool = 10 '0010
End If
Else
If IsActive(OEMTRIG8) Then
OldTool = 14 '0001
Else
OldTool = 0 '0000
End If
End If
End If
End If
NewTool = GetSelectedTool()
'---------------------------BEGIN TOOL CHANGE-------------------------------
If NewTool <> OldTool Then ' new if statement
message("M6 Start")
GotoSafeZ
While IsMoving()
Wend
message("Z to Zero")
' If 'is not at safeZ
' GotoSafeZ
' While IsMoving()
' Wend
' End If
ActivateSignal( OUTPUT8 )
While Not IsActive(OEMTRIG9) 'GALIL DI13
Wend
DEActivateSignal( OUTPUT8 )
HaveMoved = 0
ToolDif = NewTool - OldTool
MaxToolNum = 15
While (NewTool < 1)Or(NewTool >15 )
NewTool = Question ("Enter New Tool Number up to " & MaxToolNum)
Wend
'how far to move
If Abs(ToolDif) > 8 Then
If ToolDif > 0 Then
ToolDif8 = ToolDif - 15
Else
ToolDif8 = ToolDif + 15
End If
Else
ToolDif8 = ToolDif
End If
NumChange = Abs(ToolDif8)
'figure out which direction to move and start moving
If ToolDif < -8 Or (ToolDif > 0 And ToolDif <= 8) Then
ActivateSignal( OUTPUT3 ) 'set carrosel to turn cw
cw = 1
message( "OUTPUT3 is active...going CW" )
Else
ActivateSignal( OUTPUT4 ) 'set carrosel to turn ccw
cw = 0
message( "OUTPUT4 is active...going CCW" )
End If
'initially, wait a little to account for acceleration
Sleep 25
While (OldTool <> NewTool)
Sleep 320
If IsActive(OEMTRIG5) Then
If IsActive(OEMTRIG6) Then
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
OldTool = 6 '1111
Else
OldTool = 13 '1110
End If
Else
If IsActive(OEMTRIG8) Then
OldTool = 2 '1101
Else
OldTool = 9 '1100
End If
End If
Else
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
OldTool = 4 '1011
Else
OldTool = 11 '1010
End If
Else
If IsActive(OEMTRIG8) Then
OldTool = 15 '1001
Else
OldTool = 7 '1000
End If
End If
End If
Else
If IsActive(OEMTRIG6) Then
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
OldTool = 5 '0111
Else
OldTool = 12 '0110
End If
Else
If IsActive(OEMTRIG8) Then
OldTool = 1 '0101
Else
OldTool = 8 '0100
End If
End If
Else
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
OldTool = 3 '0011
Else
OldTool = 10 '0010
End If
Else
If IsActive(OEMTRIG8) Then
OldTool = 14 '0001
Else
OldTool = 0 '0000
End If
End If
End If
End If
Wend
'stop moving
DeActivateSignal( OUTPUT4 )
DeActivateSignal( OUTPUT3 )
Sleep 3000
If IsActive(OEMTRIG5) Then
If IsActive(OEMTRIG6) Then
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
ToolCheck = 6 '1111
Else
ToolCheck = 13 '1110
End If
Else
If IsActive(OEMTRIG8) Then
ToolCheck = 2 '1101
Else
ToolCheck = 9 '1100
End If
End If
Else
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
ToolCheck = 4 '1011
Else
ToolCheck = 11 '1010
End If
Else
If IsActive(OEMTRIG8) Then
ToolCheck = 15 '1001
Else
ToolCheck = 7 '1000
End If
End If
End If
Else
If IsActive(OEMTRIG6) Then
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
ToolCheck = 5 '0111
Else
ToolCheck = 12 '0110
End If
Else
If IsActive(OEMTRIG8) Then
ToolCheck = 1 '0101
Else
ToolCheck = 8 '0100
End If
End If
Else
If IsActive(OEMTRIG7) Then
If IsActive(OEMTRIG8) Then
ToolCheck = 3 '0011
Else
ToolCheck = 10 '0010
End If
Else
If IsActive(OEMTRIG8) Then
ToolCheck = 14 '0001
Else
ToolCheck = 0 '0000
End If
End If
End If
End If
If (NewTool <> ToolCheck) Then
MsgBox("incorrect tool! new tool should be,1 " & NewTool)
If Response = 1 Then
Message("wtf")
End If
End If
SetCurrentTool( NewTool )
ActivateSignal( OUTPUT6 )
While Not IsActive( OEMTRIG10 )
Wend
DeActivateSignal( OUTPUT6 )
'------------------------------END TOOL CHANGE------------------------------
Else
message("tool in use!")
End If
message("toolchange finished!")
End
exit sub