391
General Mach Discussion / Re: Mach3
« on: May 06, 2021, 12:56:46 PM »
usb Controller will Need a plugin.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Sub Main
'Get tool information
newtool = GetSelectedTool() ' get the newtool
acttool = GetCurrentTool() ' get the acttool
Message "New Tool = " &newtool
Sleep(200)
' new and acttool = 0
If ((newtool = 0) and (acttool = 0)) Then
message("new and old tool = 0 -> abort toolchange !")
Sleep(500)
Exit Sub
End If
' new tool = 0
If (newtool = 0) Then
DoButton(1003)
message("new tool = 0 -> abort toolchange !")
Sleep(500)
Exit Sub
End If
' new and acttool are the same
If newtool = acttool Then
message("acttool and newtool are the same -> do nothing!")
Sleep(500)
Exit Sub
End If
'check toolnumber in range
If (((newtool > 14) Or (newtool < 1)) And (newtool <> 0)) Then
DoButton(1003)
Message (" toolnumber " & newtool & " is not in range (1-" &MaxTool &"). abort toolchange ! ")
MsgBox (" toolnumber " & newtool & " is not in range (1-" &MaxTool &"). abort toolchange ! ")
Exit Sub
End If
'toolnumber 1 mastertool
If newtool = 1 Then
Code ("G52 X0 Y0")
End If
'toolnumber 2
If newtool = 2 Then
Code ("G52 X32 Y0")
End If
'toolnumber 3
If newtool = 3 Then
Code ("G52 X64 Y0")
End If
'And so ON
'set new tool
SetCurrentTool( newtool )
Code ("G43 H" & newtool)
Message " "
End Sub