Convert Mach3 M6 macro for UCCNC
Posted: Wed Nov 08, 2023 11:23 pm
I am wanting to convert this Mach3 tool change macro for use with UCCNC and would like some help with it as i have no idea how.
Its from here that i got the macro https://www.youtube.com/watch?v=26_N4uwRWmQ&t=178s
Its from here that i got the macro https://www.youtube.com/watch?v=26_N4uwRWmQ&t=178s
- Code: Select all
'Tool Change Macro For Manual tool change 09/14 CNC4XR7
'###############################################################
DoSpinStop() ' Make sure the spindle is OFF
Code"M09" ' Make sure the coolant is OFF
OldTool = GetOEMDRO (1224) 'Tool In spindle DRO You must add this to your settings screen
'x = GetToolChangeStart( 0 ) ' Get x tool change start position
'y = GetToolChangeStart( 1 ) ' Get y tool change start position
'z = GetToolChangeStart( 2 ) ' Get z tool change start position
tool = GetSelectedTool() ' tool to be changed to
NewTool = tool
If NewTool = OldTool Then
Exit Sub
End If
Code "G53 G0 Z-1.0" ' Move z to tool change position in Machine cord.
While IsMoving ' wait for z to move
Wend
Call SetUserDRO (1224,NewTool)
SetCurrentTool( NewTool ) ' input new tool into tool in spindle dro
Code "G43 H" & tool ' Call tool offsets for new tool
' Verify Tool Change Complete message box
Dim Msg, Style, Title, Help, Ctxt, Response,MyString
Msg = "Please Insert Tool : " & " ( " & GetSelectedTool( ) & " ) " & " " & GetToolDesc(NewTool)
'Msg = "Please Insert Tool Number " & " ( " & GetSelectedTool() & " ) " & " " & GetToolDesc(Tool) ' Define message
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons
Style = 0 + 48 + 0 ' Define buttons.
Title = "Tool Change Requested" ' Define title
Help = "DEMO.HLP" ' Define Help file
Ctxt = 1000 ' Define topic
'context.
' Display message.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbOk Then ' User chose Ok
MyString = "Ok" ' Perform some action
End If
'Show user the current tool description
Message "Tool # " & GetCurrentTool() & " : " & GetToolDesc(GetCurrentTool) & " Installed " & " Returning to Tool Change Start Position"
Code "G00 Z.25"
'Code "G00 X" & x & "Y" & y & "Z" & z 'Move back to where the tool change was prompted
While IsMoving
Wend
End