33
« on: December 07, 2011, 09:25:25 AM »
My VB skills are not so hot but I understand the idea of basic programs. Anyways I need some help with a script.
What I'm trying to do is when a tool change is initiated I want Mach to look at the current tool and the tool being called, and if they are the same, to ignore the tool change and start running the program. If they are different, go to my selected tool change position and then wait for a cycle start. I have the code working like I want except for a little hiccup. If I have the setting to "Stop spindle, wait for cycle start" it won't automatically start the program if the tools are the same value. If I have it set to "AutoTool Changer" it works great except when the tool values are different it goes to the tool change position and then immediately starts running the program, not giving me a chance to actually change the tool and then hit cycle start. Any help will be greatly appreciated.
Here's what I have
Sub Main()
X = GetUserDRO ( 1200 )
Z = GetUserDRO ( 1201 )
NewTool = GetSelectedTool
OldTool = GetCurrentTool
If NewTool = OldTool Then
Exit Sub
Else
Code "G53 G0 , Z" & Z
While IsMoving
Wend
Code "G53 G0 , X" & X
End If
End Sub
Thanks