Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Airobot on March 14, 2022, 02:13:40 PM

Title: Enforce Ref-All-Home
Post by: Airobot on March 14, 2022, 02:13:40 PM
Hi, I have just migrated over from Mach3 to Mach4 for a new build.
I can not find a way in Mach4 to enforce a Ref-All-Home upon bootup. I have this set on my Mach3 machines as within a commercial environment this is essential.

Likewise, I am unable to find a way to enable by default, Soft-Limits. Again this is essential in my opinion.
On the mach3 machines, you can not move any axes until Ref-All-Home is successful and then Soft-Limits enables.
How do you do this with Mach3?

Thank You
Title: Re: Enforce Ref-All-Home
Post by: nick952 on March 14, 2022, 04:30:55 PM
This is the script for Auto Soft Limits from here:- https://www.youtube.com/watch?v=IXuuGRACU1I
I can't confirm if it works or not, but worth a try.

Hopefully one of the Mach team will be along to help you with the Ref All .

New script to turn on soft limits after homing:

---------------------------------------------------------------
-- Ref All Home() function.
---------------------------------------------------------------
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.\nSoft Limits Set.')
    SetSoftlimits()
end

-------------------------------------------------------
--  Set Soft Limits
-------------------------------------------------------
function SetSoftlimits()
    for v = 0, 5, 1 do --start, end, increment
        mc.mcSoftLimitSetState(inst, v, mc.MC_ON)
       
    end
    scr.SetProperty("tbtnSoftLimits", "Button State", tostring(1))
    scr.SetProperty("tbSoftLimits", "Button State", tostring(1))
   
end
Title: Re: Enforce Ref-All-Home
Post by: thosj on March 15, 2022, 09:26:36 AM
I'm not sure I'd want RefAllHome to just run on boot up, commercial environment or otherwise!! I ran Mach3 for years and I don't remember it running all by itself on bootup! Seems scary to me, but perhaps I misunderstand.

Just hit the RefAllHome button after it boots.
Title: Re: Enforce Ref-All-Home
Post by: KatzYaakov on March 15, 2022, 10:48:32 AM
we had similar chat several weeks ago
also got some suggest but nothing do the job
only swiftyJ give i think something that work
 i still not test on machine but i think its can solve
use G28.1
Title: Re: Enforce Ref-All-Home
Post by: Airobot on March 15, 2022, 03:46:47 PM
Thanks, nick952 I will have a look at this. :)

HI, thosj, good point, and I was probably misleading.

I didn't actually mean for it to automatically do the Ref-All-Home on boot.
What I meant to say is, you can not move the axis or run Gcode, until you have successfully completed a Ref-All-Home.

Thanks for the replies.
Title: Re: Enforce Ref-All-Home
Post by: Bill_O on March 15, 2022, 06:17:37 PM
I modified the CycleStart() to not run unless a Reference has been done if they have an ATC.
I think that is what you will need to do.
Time to code in LUA.

Bill
Title: Re: Enforce Ref-All-Home
Post by: joeaverage on March 15, 2022, 11:24:18 PM
Hi,
I had for some time had programmed that <Cycle Start> and <MDI Cycle Start> were greyed out, ie inactive until the machine was referenced.
I had a smaller auxillary <MDI Cycle Start> if I absolutely had to have movement prior to referencing the machine. It worked perfectly well.

Craig