Udostępniam gdyby ktoś chciał poćwiczyć sobie technikę budowy Macro dla Macha3 (VBScript)
Kod: Zaznacz cały
Sub main
Dim iToolNum As Integer
Dim iCwSteps As Integer
Dim iCcwSteps As Integer
Dim iHoldingDRO As Integer
Dim iSelectTool As Integer
Dim iCurrentTool As Integer
Dim iCwFeed As Integer
Dim iCcwFeed As Integer
Dim RefTool As Integer
Dim moves
'Konfiguracja
iToolNum = 8 'maksymalna ilosc narzedzi
RefTool = 1 'numer narzedzia po wyzerowaniu osi
iCwFeed = 5000 'posuw zmiany
iCcwFeed = 1000 'posuw cofania
'Najazd na punkt wymiany narzedzia
Code "G90 G00 G53 Z-2 X-2"
While IsMoving()
Message "Najazd na ptk wymiany"
sleep(100)
Wend
sleep(200)
Message ""
iSelectTool = GetSelectedTool()
iCurrentTool = GetCurrentTool()
iCwSteps = 360/iToolNum
iCcwSteps = iCwSteps/2
iHoldingDRO = 1050
iCurrentFeed = GetOEMDRO(818)
If Not (IsOutputActive(Output4)) Then
Message "Pozycja magazynu nie jest znana"
sleep(1500)
Message ""
CODE "G90 G92 Y0"
CODE "G90 G28.1 Y0"
While IsMoving
Message "Bazowanie osi magazynu"
sleep(500)
Message ""
sleep(250)
Wend
Message ""
iCurrentTool = RefTool
ActivateSignal(Output4)
End If
If (iSelectTool > iToolNum) Or (iSelectTool < 1) Then
Message "Numer Narzedzia z poza zakresu"
Code "M30"
End
End If
Message ("Wybrano Narzedzie nr = " & iSelectTool)
sleep(250)
If (iSelectTool = iCurrentTool) Then
'NOP
Else
If (iSelectTool < iCurrentTool) Then
moves = iToolNum - iCurrentTool + iSelectTool
End If
If (iSelectTool > iCurrentTool) Then
moves = iSelectTool - iCurrentTool
End If
total_move = (moves * iCwSteps)+(iCcwSteps)
Code "G94 G91 G01 Y" & total_move & " F" & iCwFeed
Code "G94 G91 G01 Y-" & iCcwSteps & " F" & iCcwFeed
While IsMoving()
sleep(10)
Wend
SetCurrentTool(iSelectTool)
SetUserDRO(iHoldingDRO,iSelectTool)
Code "G90 F" & iCurrentFeed
End If
Message ""
End Sub
Pozdrawiam!!