Hello Guest it is October 23, 2019, 05:41:53 PM

Author Topic: Mach4 and ESS Homing Offset Script UPDATED  (Read 3931 times)

0 Members and 1 Guest are viewing this topic.

Offline DazTheGas

*
  •  750 750
  • DazTheGas
    • View Profile
Mach4 and ESS Homing Offset Script UPDATED
« on: September 17, 2015, 09:54:14 AM »
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/HhcCGt0Lywo

New PLC Script all the restis the same

Code: [Select]
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
« Last Edit: September 17, 2015, 09:56:32 AM by DazTheGas »
Theres always time for a choccy biccy

Online Chaoticone

*
  • *
  •  5,617 5,617
  • Precision Chaos
    • View Profile
Re: Mach4 and ESS Homing Offset Script UPDATED
« Reply #1 on: September 17, 2015, 05:18:09 PM »
Quote
P.S Does mcAxisSetMachinePos actually work cause I cant do anything with it??

I had it working a while back but haven't tried it lately. I will have to give it a play and let you know what I find.
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Mach4 and ESS Homing Offset Script UPDATED
« Reply #2 on: April 01, 2016, 09:20:44 AM »
Thanks for the lessons DazTheGas.
When SoftLimits Off, everything works OK.
Question: why when SoftLimits On - HommeOffset wrong.

Offline DazTheGas

*
  •  750 750
  • DazTheGas
    • View Profile
Re: Mach4 and ESS Homing Offset Script UPDATED
« Reply #3 on: April 01, 2016, 10:25:54 AM »
I will check on this as I dont use softlimits myself but will have a look over the weekend.

one thing that possibly could help is setting the OSIG_SOFTLIMITS_ON to off at beginning of script then again to turn on after the offsets have been applied.

DazTheGas
Theres always time for a choccy biccy