Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: smallpoul on January 30, 2022, 11:40:29 PM
-
Hi,
i have a function that i've put in the load screen and i will like that when mach4 receive a m3 or m5 command, it trigger also this function. I I just don't know how.
Here is the code:
function Dustcollector()
TimerPanel = wx.wxPanel (wx.NULL, wx.wxID_ANY, wx.wxDefaultPosition, wx.wxSize( 0,0 ) )
timer = wx.wxTimer(TimerPanel)
local sig = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT1)
mc.mcSignalSetState(sig, 1)
timer:Start(2000)
TimerPanel:Connect(wx.wxEVT_TIMER,
function (event)
mc.mcSignalSetState(sig, 0)
timer:Stop()
end)
end
Thanks
-
Hi,
what you need to do is write your own m3 and m5 scripts.
m3 and m5 are considered built in scripts and you need a specific reason to write your own as your m3 and m5 scripts will dominate the built in scripts.
The procedure is that when the Gcode interpreter encounters an m3 call it will in the first instance look in the macros folder of your profile. If it finds your m3 script
there it will run it. If it does not find an m3 script it will search up the file tree until it finds one, usually the built-in script.
If you open the screen editor and investigate the event properties of the <m3> button on Machs screen you will see that Machs core runs a function SpinCW().
If you include this in your own script your m3 will have at least the same functionality of the the built in script. Now you just need to include whatever extra
functionality you want, namely turning on the dust collector.
Craig
-
Thank you verry much, i understand.
-
i sugest you not touch basic function like M3 M4 M5 M30... because you will never know which softwre you will use in future and which other
element you want run or not run while use that basic function
much batter way its add M function and update also on yours pp