Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Davek0974 on September 04, 2016, 03:12:35 AM

Title: Skip Tool-change if tool is loaded?
Post by: Davek0974 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??
Title: Re: Skip Tool-change if tool is loaded?
Post by: Davek0974 on September 04, 2016, 03:40:30 AM
Maybe add...

If GetSelectedTool() = GetCurrentTool() Then Exit Sub

As the first line in M6Start  ??
Title: Re: Skip Tool-change if tool is loaded?
Post by: stirling 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.
Title: Re: Skip Tool-change if tool is loaded?
Post by: Hood 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
Title: Re: Skip Tool-change if tool is loaded?
Post by: stirling on September 04, 2016, 09:45:03 AM
Just trying to teach a man to fish etc.
Title: Re: Skip Tool-change if tool is loaded?
Post by: Hood 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
Title: Re: Skip Tool-change if tool is loaded?
Post by: stirling on September 04, 2016, 09:53:26 AM
No worries  ;)
Title: Re: Skip Tool-change if tool is loaded?
Post by: Davek0974 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 :)