Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: jtiedeman on April 13, 2017, 06:02:39 PM

Title: Code works in script editor but not from M code
Post by: jtiedeman on April 13, 2017, 06:02:39 PM
I have made a large tube plasma system (40' long, up to 10" diameter with 3/8 wall thickness  ;D) and do a lot of cutoffs with it. I have a certain program that does a lot of incremental cuts in the Y axis so at the end of the program I want to re-home the y axis (it homes in place). I don't want to just zero the work offset because I use multiple work offsets. If I don't home it before the next tube it wants to completely unwind the y axis to start the next program from Y0. I am trying to use an M code to home my Y axis and it works great when I run it from the script editor but I can't seem to get it to do anything when I run it in MDI with an m code. Is there something I am missing or doing wrong here?

Code: [Select]
function m101()
    inst=mc.mcGetInstance()
    mc.mcAxisHome(inst,1)
end

if (mc.mcInEditor() == 1) then
    m101()
end

I have a button to home the Y axis that works great, I am just trying to save some extra mouse clicks between tubes. Any help would be great. Thanks!

Joel
Title: Re: Code works in script editor but not from M code
Post by: DazTheGas on April 14, 2017, 02:07:59 AM
Mach4 core will not allow you to home from an mcode,

DazTheGas
Title: Re: Code works in script editor but not from M code
Post by: jtiedeman on April 14, 2017, 11:40:45 AM
Oh, that would explain why nothing I try works. I've got some ideas to change the program and work around it.

Thanks for the reply!

Joel