Hi Weedy, Graham,
Sorry for the late response (i had to spend some holidays with my family) . I have tried another solution for the work offset, because in the old version is making troubles, if the machine is in G91 (incremental) mode. In this mode, moving with machine coordinates will not work.
In my new version, the mode will not influence the moving.
BTW: How can i realize a "do nothing" in VB Script ?
'Werkzeugwechslermakro f. Trolcut430, Helmut Heigl, R0.8 08/01/05
Sub Main()
OldTool = GetOEMDRO (1200) 'actual tool
tool = GetSelectedTool()'new tool selected
incremental= GetOEMLED (49)'get coordinate system (absolute or incremental)
NewTool = tool
MaxToolNum = 4 'number of tools
ToolFreistX = 40 'Offset "X"
ToolFreistZ = 40 'Offset "Z"
If NewTool = OldTool Then
Exit Sub
End If
While NewTool > MaxToolNum
NewTool = Question ("Bitte andere Werkzeugnummer eingeben: 1-" & MaxToolNum)
Wend
Code "G91"'change to relative coordinates
While IsMoving()
Wend
Code "G00 X" & ToolFreistX & " Z" & ToolFreistZ 'offset tool
While IsMoving()
Wend
ActivateSignal(Output1) 'turning toolpost clockwise "ON"
Call MovePos(NewTool)
While IsMoving()
Wend
DeActivateSignal(Output1) 'turning toolpost clockwise "OFF"
Code "G4 P.5" 'short time- delay, can possibly been deleted
While IsMoving()
Wend
ActivateSignal(Output2) 'turning toolpost CCW (clamping)"ON"
Code "G4 P0.5" 'wait for clamping
While IsMoving()
Wend
DeActivateSignal(Output2) 'turning toolpost CCW (clamping)"OFF"
Call SetUserDRO (1200,NewTool)
SetCurrentTool( NewTool )'show new tool
Code "G00 X-" & ToolFreistX & " Z-" & ToolFreistZ 'set new tool to old coordinates
If incremental = 1 Then
Code "G91"
While IsMoving()
Wend
Else
Code "G90"
While IsMoving()
Wend
End If
End Sub
.
.
.
.
Greets from Austria,
Helmut