1
VB and the development of wizards / Re: Set Position Automated Tool Height Sensor G06Start/end
« on: December 28, 2020, 05:46:02 PM »
Thanks,
That was it, it also allowed me to simply the process as well. only thing I have to figure out is how to get the spindle to start moving back to the work coordinates while the spindle is spinning up, (dwell setup in spindle acceleration time) rather than starting up in the tool change position then dwelling then moving to the work coordinates.
Anyone with any ideas there?
For posterity and those looking to copy here is my M6Start.ms1;
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 Z0" 'Move Z to 0 In machine Coordinate
While IsMoving ' wait for z to move
Wend
Code "G53 G0 X-290 Y101" 'Move to Tool Setter in Machine Coordinate
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 "G53 G00 Z-0"
'Code "G00 X" & x & "Y" & y & "Z" & z 'Move back to where the tool change was prompted
While IsMoving
Wend
End
That was it, it also allowed me to simply the process as well. only thing I have to figure out is how to get the spindle to start moving back to the work coordinates while the spindle is spinning up, (dwell setup in spindle acceleration time) rather than starting up in the tool change position then dwelling then moving to the work coordinates.
Anyone with any ideas there?
For posterity and those looking to copy here is my M6Start.ms1;
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 Z0" 'Move Z to 0 In machine Coordinate
While IsMoving ' wait for z to move
Wend
Code "G53 G0 X-290 Y101" 'Move to Tool Setter in Machine Coordinate
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 "G53 G00 Z-0"
'Code "G00 X" & x & "Y" & y & "Z" & z 'Move back to where the tool change was prompted
While IsMoving
Wend
End