Hello Guest it is April 25, 2024, 07:45:19 PM

Author Topic: Custom M6, does not react on toolchange  (Read 756 times)

0 Members and 1 Guest are viewing this topic.

Offline DAAD

*
  •  103 103
    • View Profile
Custom M6, does not react on toolchange
« on: April 09, 2020, 10:22:46 AM »
At the moment i've written a module with separate functions inside to swap between router and spindel.
If i implement them in a macro and test the macro all is working (finally) as it should!

Now i'm trying a very basic m6 for testing purposes that should initiate a tool swap based on toolnumber.
The problem is there is nothing happening when running a test gcode file, it just runs as it only has one tool and doesn't act on the different statements or toolnumbers. It's like it's completely ignoring the tool input.

Is there a way of figuring this out?
In the control panel the tool is already set on use tool on M6 line.

Code: [Select]
function m6()
local inst = mc.mcGetInstance()
local SelectedTool = mc.mcToolGetSelected(inst)
local CurrentTool = mc.mcToolGetCurrent(inst)

package.path = wx.wxGetCwd() .. "\\Modules\\AvidCNC\\?.lua"
zc = require "MyzControl"

if (SelectedTool <=100) then
zc.SpindleM6()
mc.mcToolSetCurrent (inst, SelectedTool)
else
zc.RouterM6()
mc.mcToolSetCurrent (inst, SelectedTool)
end


end


if (mc.mcInEditor() == 1) then
 m6()
end
Re: Custom M6, does not react on toolchange
« Reply #1 on: April 09, 2020, 10:55:55 AM »
I would test to see if  zc is assigned after the require and would put another function in that shows a simple message to test whether zc is working.  Check to make sure there is no other m6() defined in any of the other modules or scripts.

TIA

RT

Offline DAAD

*
  •  103 103
    • View Profile
Re: Custom M6, does not react on toolchange
« Reply #2 on: April 09, 2020, 12:55:06 PM »
Thanks
I know that zc is working because i've made an m280 macro all of the functions out of the same module and there they work.
It's when the tool variable comes into play (m6) that i have a problem.

Will look if there are other m6 files that would be corrupting the setup.

Normally the only ones that are used are internal ones and the ones under used profile/ macro i suppose?

Offline Graham Waterworth

*
  • *
  •  2,673 2,673
  • Yorkshire Dales, England
    • View Profile
Re: Custom M6, does not react on toolchange
« Reply #3 on: April 10, 2020, 07:04:28 PM »
I seem to remember the M6 is case sensitive in the macro and the code, they need to match.

 
Without engineers the world stops

Offline DAAD

*
  •  103 103
    • View Profile
Re: Custom M6, does not react on toolchange
« Reply #4 on: April 12, 2020, 03:38:01 AM »
Thanks for the tip.

Had to do a reinstall of mach 4 to get the code running.
Even the standard m6 was not running anymore...