Heres an update to the homing script I wrote a while back that somewhere during the version updates broke and I never noticed.. Was trying so hard to figure out the mcAxisSetMachinePos to do this until I saw the post by Ya-Nvr-No in regards to using mcMotorSetHomePos, which in substitution done the trick.
https://youtu.be/HhcCGt0LywoNew PLC Script all the restis the same
if (x_enable_offset == "true" and y_enable_offset == "true" and z_enable_offset == "true") then
if (offset_applied == "false") then
xoffset = mc.mcAxisGetHomeOffset(inst, 0);
yoffset = mc.mcAxisGetHomeOffset(inst, 1);
zoffset = mc.mcAxisGetHomeOffset(inst, 2);
mc.mcAxisSetPos(inst, 0, 0.00);
mc.mcAxisSetPos(inst, 1, 0.00);
mc.mcAxisSetPos(inst, 2, 0.00);
mc.mcCntlGcodeExecuteWait(inst, "G00 X"..xoffset.." Y"..yoffset.." Z"..zoffset);
mc.mcMotorSetHomePos(inst, 0, xoffset * mc.mcProfileGetDouble(inst, 'Motor0','CountsPerUnit',0)) --X
mc.mcMotorSetHomePos(inst, 1, yoffset * mc.mcProfileGetDouble(inst, 'Motor1','CountsPerUnit',0)) --Y
mc.mcMotorSetHomePos(inst, 2, zoffset * mc.mcProfileGetDouble(inst, 'Motor2','CountsPerUnit',0)) --Z
mc.mcMotorSetHomePos(inst, 3, yoffset * mc.mcProfileGetDouble(inst, 'Motor3','CountsPerUnit',0)) --Y Slave
mc.mcAxisSetPos(inst, 0, xoffset);
mc.mcAxisSetPos(inst, 1, yoffset);
mc.mcAxisSetPos(inst, 2, zoffset);
offset_applied = "true";
end
end
P.S Does mcAxisSetMachinePos actually work cause I cant do anything with it??
DazTheGas