Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: Bill_O on March 11, 2019, 02:24:02 PM
-
Why will the attached work as a button but not as a mcode?
-
Ignore the last 2 lines.
They are not in the one I am using.
-
I believe the state must be 'idle' for the axes to be homed. Therefore you will not be able to use your code in an mcode. If you use the following code in your m100 script and run it, you will most likely get a return value of -18. This is error: MERROR_NOT_NOW - The operation could not be completed at this time.
function m100()
--home material and arm
local inst = mc.mcGetInstance()
local rc = mc.mcAxisHome(inst, 0)
mc.mcCntlSetLastError(inst, tostring(rc))
end
if (mc.mcInEditor() == 1) then
m100()
end
-
Looking in the G Code Mill Manual; I see G28.1: Home Axis. I
I have never used this and I'm not at a machine at the moment so I can't test this, but has anyone tried this?
-
Used it in a lathe m6 this week. Works a treat (in the last dev. version I know).
-
We did end up using G28.1 to do the homing.
Thanks for the tip.
Bill
-
Bill,
Glad to hear that.
How did you use it? In the Macro? Using the MDIExecute or GCodeExecute call?
-
Chad,
We used the GcodeExecute
Bill