Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: jorgan202 on November 23, 2017, 12:33:42 PM

Title: Connection between button function and script
Post by: jorgan202 on November 23, 2017, 12:33:42 PM
When I'm in edit mode and have a button highlighted, it shows eg, btnReturn, how does Lua know that this function is been call?  I assume if a button has the name of btn(114), its just been placed but not been given a function yet?  The button (btn(114)) has been titled "Touch" but doesn't seem to do anything.

I have downloaded the latest version, expecting it all to work, seems like I was wrong, how much does one have to do to get just whats on the display to work.....
Title: Re: Connection between button function and script
Post by: Peter Knell on November 23, 2017, 01:04:39 PM
This is the problem i am having. Mach 4 seems to be really good but i think the amount of learning into LUA you need to do just for basic functions is a mistake.
Have you tryed going to "Screen Load" and then loading the wx4.set screen? Apparently this is the most up to date screen set and has the probing screen included and working.
Also you will need to edit you "A" axis out of the "Go to Zero" button if you only have 3 Axis as it will try to command A Axis to move and error out.
Title: Re: Connection between button function and script
Post by: jorgan202 on November 23, 2017, 01:20:50 PM
So when say edit out, edit out where, in the Lua (wx.4.set) script, or Darwin? And if its in the script how do I find it and what do I do to edit it out or make it a comment type line?

Thanks btw
Title: Re: Connection between button function and script
Post by: Peter Knell on November 23, 2017, 01:34:45 PM
"Operator"
"edit screen"
Under the title "screen tree Manager" click on "wx4"
Then under the screen tree manager youll see a page with a lightening signal on it click that
Then click on the "screen load script"
Scroll down till you find this...
---------------------------------------------------------------
-- Go To Work Zero() function.
---------------------------------------------------------------
function GoToWorkZero()
    mc.mcCntlMdiExecute(inst, "G00 X0 Y0 A0")--Without Z moves
    --mc.mcCntlMdiExecute(inst, "G00 G53 Z0\nG00 X0 Y0 A0\nG00 Z0")--With Z moves
end

Change this to
either this....

---------------------------------------------------------------
-- Go To Work Zero() function.
---------------------------------------------------------------
function GoToWorkZero()
    mc.mcCntlMdiExecute(inst, "G00 X0 Y0")--Without Z moves
end


Or if you want Z moves change it to this....

---------------------------------------------------------------
-- Go To Work Zero() function.
---------------------------------------------------------------
function GoToWorkZero()
    mc.mcCntlMdiExecute(inst, "G00 G53 Z0\nG00 X0 Y0\nG00 Z0")--With Z moves
end

Hope this helps.
As i say this is for the wx4.set screen and only if your using 3 axis
Title: Re: Connection between button function and script
Post by: jorgan202 on November 23, 2017, 02:24:18 PM
Thanks, I do have 3 axis at moment, so will use that. So does this mean that the "Touch" button will now work or does that also need to be added to the script as it only has a title btn(114)?

Just noticed its gone to demo mode, should it do that when you up-load to the newer version 3841?
Title: Re: Connection between button function and script
Post by: jorgan202 on November 23, 2017, 02:28:37 PM
Do u by any chance know why I get the following error failed  mwSim.m4pw?
Title: Re: Connection between button function and script
Post by: joeaverage on November 23, 2017, 02:31:29 PM
Hi,
I'm not at all sure that Darwin supports Touch.

Many of the interesting Mach functions require implementation in the motion controller. Darwin is a motion controller
but is quite limited in features it supports. My ESS runs the Touch module fine.

Craig
Title: Re: Connection between button function and script
Post by: jorgan202 on November 23, 2017, 02:39:32 PM
Hi Craig
When you look at the "Touch" button in the script what name / title does it have?  Does yours also have btn(114) or something else like the return button has btnReturn?

Thanks
Dion
Title: Re: Connection between button function and script
Post by: Peter Knell on November 23, 2017, 02:42:13 PM
Like Joe says do some research make sure that the Darwin actually supports the probe and touch function first.
If it does then the "Touch" button in the wx4.set screen should work with no extra scripting i think.
The mwsim.m4pw is your motion control plugin i think?
This probably means Mach is having trouble talking to your motion controller? But im not 100% sure?

Title: Re: Connection between button function and script
Post by: jorgan202 on November 23, 2017, 02:57:12 PM
The LED comes on when I touch the plate, What happens in the video that I've seen is that a window opens up, in mine it doesn't.  So is that a module that needs to be added? Please have a look at the script in yours and let me know what the button reference is? Thanks
Title: Re: Connection between button function and script
Post by: Peter Knell on November 23, 2017, 03:04:39 PM
What screen set are you using? Make sure you go to "load Screen" and load up the wx4.set screen.
Once in here you should get a pop up with the probing stuff when you hit touch.
Title: Re: Connection between button function and script
Post by: joeaverage on November 23, 2017, 03:23:38 PM
Hi,
the Touch Module is included with the last several builds of Mach.

Go to the help tab and find the build number currently installed.

Craig
Title: Re: Connection between button function and script
Post by: jorgan202 on November 23, 2017, 04:06:19 PM
wx4.set, using 3 axis and ver 3481
Title: Re: Connection between button function and script
Post by: joeaverage on November 23, 2017, 04:39:25 PM
Hi,
well that is certainly the latest build, and the Touch module is included. I think the problem may be because the use
of Demo. My understanding is that the Touch module doesn't work with Demo.

Do you have a licence for Mach4? I'm also not sure that the Sim motion controller will work with Touch, after all
how can you simulate a probe strike? Darwin can probe OK but not sure whether it supports all the Touch functions.

Craig
Title: Re: Connection between button function and script
Post by: jorgan202 on November 23, 2017, 05:17:47 PM
Hi
I do have a license, but noticed that its gone to Demo mode, not sure if that happened when I installed 3481??, as luck has it I have tried to update my license on the site but that has gone pear shaped, so waiting for an email response.

Getting to better grips with this, so changed the code to remove the A0 axis and the go to working zero works brilliantly, but the ref all now just locks up till I press stop, LEDs dont change and nothing moves.