Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: biggermens on March 26, 2019, 01:40:26 PM

Title: G-Code to reference all axis
Post by: biggermens on March 26, 2019, 01:40:26 PM
Hi There

I been looking for a while, would be here a G-Code that will reference all axis like clicking the Home Button ???


Thanks
Biggs
Title: Re: G-Code to reference all axis
Post by: joeaverage on March 26, 2019, 02:04:15 PM
Hi,

https://www.machsupport.com/forum/index.php?topic=39729.0 (https://www.machsupport.com/forum/index.php?topic=39729.0)

Craig
Title: Re: G-Code to reference all axis
Post by: biggermens on March 26, 2019, 02:49:02 PM
I Looked at that
I can call the script with a M code ??


-- Ref All Home() function.
---------------------------------------------------------------
function RefAllHome()
    mc.mcAxisDerefAll(inst)  --Just to turn off all ref leds
    mc.mcAxisHomeAll(inst)
    coroutine.yield() --yield coroutine so we can do the following after motion stops
    ----See ref all home button and plc script for coroutine.create and coroutine.resume
    wx.wxMessageBox('Referencing is complete')
end
Title: Re: G-Code to reference all axis
Post by: joeaverage on March 26, 2019, 03:00:09 PM
Hi,
no, not directly.

When you call an M code the Gcode interpreter has control of the  machine, that is Machs Core chunk.
The function whose code you posted is in the screen load script , that is its part of the GUI chunk.
Only one chunk can run at a time.

You can make your own M code using the same API's although I wouldn't bother with the co-routine part.

Craig