Hello Guest it is April 28, 2024, 05:52:55 PM

Author Topic: Do a function that is in the load screen when m3 or m5 is send  (Read 616 times)

0 Members and 1 Guest are viewing this topic.

Do a function that is in the load screen when m3 or m5 is send
« 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:
Code: [Select]
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
Re: Do a function that is in the load screen when m3 or m5 is send
« Reply #1 on: January 31, 2022, 04:33:23 PM »
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
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Do a function that is in the load screen when m3 or m5 is send
« Reply #2 on: January 31, 2022, 09:14:35 PM »
Thank you verry much, i understand.
Re: Do a function that is in the load screen when m3 or m5 is send
« Reply #3 on: February 04, 2022, 12:44:59 AM »
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