Hello Guest it is March 28, 2024, 04:27:10 AM

Author Topic: GoToWorkZero  (Read 3609 times)

0 Members and 1 Guest are viewing this topic.

Re: GoToWorkZero
« Reply #10 on: March 10, 2019, 03:51:28 PM »
Hi,
you should attempt to use the signal library instead.

If you wish to use the PLC script it will still work.

Have a close look at the API you are using:

Quote
LUA Syntax:
rc = mc.mcCntlGotoZero(
      number mInst)

Description:
Move the X,Y,A,B,C and then the Z axis to zero of the current fixture offset.

Parameters: Parameter Description
mInst The controller instance.


Returns: Return Code Description
MERROR_NOERROR No Error.
MERROR_INVALID_INSTANCE The mInst parameter was out of range.
MERROR_NOT_NOW The operation could not be completed at this time.

Note in particular the return codes. Alter you code to test the return code. I will almost guarantee that the machine
is not in 'idle' state and cannot therefore GoToWorkZero because its busy.

Code: [Select]
local rc=mc.mcCntlGotoZero(inst)
if (rc== -180 then
        wx.wxMessageBox('Machine not in idle state')
        do return end
end

Note that if you use the SigLib{} approach you avoid this difficulty because the GoToWorkZero() function is
in the Screen script and does not have to switch chunks as your approach does.

Try wx4.set, it is way more complete/developed.

Craig

'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: GoToWorkZero
« Reply #11 on: March 10, 2019, 04:02:48 PM »
Hi,
apologies, have just noticed a typo in the code, it should read:

Code: [Select]
local rc=mc.mcCntlGotoZero(inst)
if (rc== -18) then
        wx.wxMessageBox('Machine not in idle state')
        do return end
end

I have had another thought, the API you are using calls a standard Mach Action which is programmed in the core and you can't
view or edit it. If it calls for an A axis move you will encounter the same fault, namely that the machine attempts to move
the A axis to zero despite you not having an A axis defined.

If that is the case you will HAVE to use the modified GoToWorkZero() function in the sceern load script as I originally
suggested.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: GoToWorkZero
« Reply #12 on: March 10, 2019, 04:21:18 PM »
Hi,  I put that last script in the siglib and when I exit and hit the Enable button mach4 froze up, so I just now removed that script and back to normal again for now.
Re: GoToWorkZero
« Reply #13 on: March 10, 2019, 04:24:16 PM »
Hi,
then use the screen load function GoToWorkZero().

I have made three suggestions and you have ignored all of them......

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: GoToWorkZero
« Reply #14 on: March 10, 2019, 04:40:37 PM »
Hi,   I don't have that screen set wx4.set,   This is all I have in mach folder.  Is there a place to download it because when I googled it, nothing comes up.

Thanks
Re: GoToWorkZero
« Reply #15 on: March 10, 2019, 04:42:46 PM »
Hi,
what build  of Mach are you using? (Help/About wil reveal the build number.)

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: GoToWorkZero
« Reply #16 on: March 10, 2019, 04:49:09 PM »
Hi,
look on the ftp site for the latest Mach4Hobby builds:

ftp://ftp.machsupport.com/Mach4/DevlopmentVersions/

I'm using 4095 on my laptop but 3805 on my machine.

4095 has the new THC features and Surface features.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: GoToWorkZero
« Reply #17 on: March 10, 2019, 04:53:23 PM »
3804 the latest
Re: GoToWorkZero
« Reply #18 on: March 10, 2019, 04:57:23 PM »
Hi,  Where are you getting all these versions?   I only see the the latest mach4 on mach's website.

Thanks
Re: GoToWorkZero
« Reply #19 on: March 10, 2019, 05:00:21 PM »
Maybe all my problems are because I'm on windows10.  I now see that's not listed under pc requirements for mach4.   shucks.