Hello Guest it is March 28, 2024, 06:49:50 PM

Author Topic: Set Position Automated Tool Height Sensor G06Start/end  (Read 1989 times)

0 Members and 1 Guest are viewing this topic.

Set Position Automated Tool Height Sensor G06Start/end
« on: December 27, 2020, 05:42:12 PM »
Good day,

I am in the Process of creating a macro to set my tool change position; First the information

Tool Setter Machine Coordinate X-290 Y101 Z-10
The tool height setter sits 2.99mm above the machine bed at the above X-Y coordinates.

What I want the machine to do when M06 is called is to retract to G53 G0 Z0
Then Rapid to G53 G0 X-290 Y101
Then once at the above G53 Z-10

The problem I am having is the machine tries to do some of these movements together I am not able to figure out exactly why.

M6Start;
"
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
Code "G53 G0 X-290 Y101" 'Move to Tool Setter in Machine Coordinate
Code "G53 G0 Z-11" 'Move Z to -10 For Tool Change Position


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 Z15"
'Code "G00 X" & x  & "Y" & y & "Z" & z 'Move back to where the tool change was prompted
While IsMoving
Wend
End   
"

I am pretty sure the problem lies in the bold above, but can not figure out the best way to get my desire result.

Then after Cycle start This returns the machine to the work coordinates before the tool change.

M6End;
"
'REM The default script here moves the tool back To m6start If Any movement has occured during the tool change..

'x = GetToolChangeStart( 0 )
'y = GetToolChangeStart( 1 )
'z = GetToolChangeStart( 2 )
'a = GetToolChangeStart( 3 )
'b = GetToolChangeStart( 4 )
'c = GetToolChangeStart( 5 )
'If(IsSafeZ() = 1) Then
'   SafeZ = GetSafeZ()
'   If  SafeZ  > z Then StraightTraverse x, y,SafeZ, a, b, c
'      StraightFeed  x, y,  z  , a, b, c
'Else
'Code"G00 X" & x & "Y" & y
'end if
"

Appreciate your help here.

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: Set Position Automated Tool Height Sensor G06Start/end
« Reply #1 on: December 28, 2020, 01:16:47 AM »
try to put

Code: [Select]
While IsMoving
Wend

after each movement code
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Set Position Automated Tool Height Sensor G06Start/end
« Reply #2 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     

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: Set Position Automated Tool Height Sensor G06Start/end
« Reply #3 on: December 29, 2020, 01:42:44 AM »
Mach3 will allways wait for the spindle dwell time.

to start the spindle without dwell time before going back to the work coordinates is risky, because
there may be a spindlestart sometime without tool Change.
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.