5038
« on: March 15, 2018, 01:41:09 AM »
Hi,
two ways to do this, simply or very simply....
This is the standard Ref All Home function in the screen load script, around line 200 depending on the build version and whether you've added any extra code preceeding
this.
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
Notice the API call mc.mcAxisHomeAll(inst)
Just replace the Home All with homing individual axes:
mc.mcAxisHome(inst,mc.X_AXIS)
mc.mcAxisHome(inst,mc.Y_AXIS)
The code would now be:
function RefAllHome()
mc.mcAxisDerefAll(inst) --Just to turn off all ref leds
--mc.mcAxisHomeAll(inst)
mc.mcAxisHome(inst,mc.X_AXIS)
mc.mcAxisHome(inst,mc.Y_AXIS)
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
Note rather than delete the original API call I commented it out ( put '--' in front of it ) so that if I want to revert back to standard I can do so easily.
That was the simple way but there is an even simpler way:
In the pic attached is the home order of my machine, Z axis first. If I assigned 0 to the Z axis home order it wouldn't be homed at all. Just assign 1 and 2 as
home order for X and Y axes and your done. No coding at all!