Hello Guest it is March 28, 2024, 06:53:24 AM

Author Topic: Skip Tool-change if tool is loaded?  (Read 2513 times)

0 Members and 1 Guest are viewing this topic.

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Skip Tool-change if tool is loaded?
« on: September 04, 2016, 03:12:35 AM »
I have some code from fusion 360 for a little part i make batches of. It starts with a tool-change of course and i need the tool height offset so don't want to remove the TC.

Is it possible to alter the M6start / end macros to skip a change and do nothing if the tool selected is the same as the current tool??

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Skip Tool-change if tool is loaded?
« Reply #1 on: September 04, 2016, 03:40:30 AM »
Maybe add...

If GetSelectedTool() = GetCurrentTool() Then Exit Sub

As the first line in M6Start  ??

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Skip Tool-change if tool is loaded?
« Reply #2 on: September 04, 2016, 07:27:25 AM »
maybe - but why use guesswork?

Make a copy of your existing M6Start macro and create a new one consisting solely of your proposed addition (with msgbox output to give you some debug feedback) and you test it.

e.g. you might do something like this:

If GetSelectedTool() = GetCurrentTool() then
  msgbox "tools are the same"
else
  msgbox "tools are different"
end if

If you're happy it does what you want you mod your existing one. But you KEEP the copy until you're 100% sure you're good. Then you can easily start from a known point if you need to.

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Skip Tool-change if tool is loaded?
« Reply #3 on: September 04, 2016, 08:04:17 AM »
If GetSelectedTool() = GetCurrentTool() Then
End
 End If

That is what I have and it works 100%.

Hood

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Skip Tool-change if tool is loaded?
« Reply #4 on: September 04, 2016, 09:45:03 AM »
Just trying to teach a man to fish etc.

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Skip Tool-change if tool is loaded?
« Reply #5 on: September 04, 2016, 09:47:22 AM »
Ian, my reply was actually meant for Daves initial post, sorry for the confusion, was not meaning to ignore what you were recommending.

Hood

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Skip Tool-change if tool is loaded?
« Reply #6 on: September 04, 2016, 09:53:26 AM »
No worries  ;)

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Skip Tool-change if tool is loaded?
« Reply #7 on: September 04, 2016, 09:54:47 AM »
I have the fishing rod out now ;)

I will test this out as soon as other issues have been ironed out :)