Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: TTalma on April 02, 2018, 10:14:47 AM

Title: How do I make "Go to Work 0" work?
Post by: TTalma on April 02, 2018, 10:14:47 AM
I completed setting up Mach 4 with my machine. I have everything working except the "Go to work 0" button. When I press it, it does nothing.

What I am doing.
1. Power up machine
2. Star mach 4
3. Home machine
4. Find the corner of my board
5. Press the "Zero X", "Zero Y", "Zero Z"
6. move to a random spot on the table
7. Hit "Go To Work 0"

Nothing happens except the screen flashes.

I am using an ESS smooth stepper if that makes a difference.

I'm ready to purchase a license for Mach 4, but unless I can get this feature working, the program is useless for my projects. After all the work setting it up I'd hate to abandon it.
Title: Re: How do I make "Go to Work 0" work?
Post by: Cbyrdtopper on April 02, 2018, 10:52:29 AM
If you are running the demo, make sure it hasn't timed out.  You only have a limited time frame in the demo.

Restart Mach4 and try again.
Title: Re: How do I make "Go to Work 0" work?
Post by: joeaverage on April 02, 2018, 02:28:57 PM
Hi,
if you open the screen editor and have a look at the script attached to the Go To Work Zero button you will find a function:
GoToWorkZero().

The function it self is in the screen load script, in my somewhat modified screenset  around line 250:
Code: [Select]
---------------------------------------------------------------
-- 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

Note there are two lines, the second is commented out so only the first line is active. The comment associated with that line says 'Without Z moves' but note also that it demands that
the A axis be sent to work zero as well.  My machine does not have an A axis and is not defined  and therefore this line of code fails.  If I modify the line to not include the non existant
axis like this:
Code: [Select]
---------------------------------------------------------------
-- Go To Work Zero() function.
---------------------------------------------------------------
function GoToWorkZero()
    mc.mcCntlMdiExecute(inst, "G00 X0 Y0 ")--Without Z moves
    --mc.mcCntlMdiExecute(inst, "G00 G53 Z0\nG00 X0 Y0 A0\nG00 Z0")--With Z moves
end
The button now works.

Craig
Title: Re: How do I make "Go to Work 0" work?
Post by: Cbyrdtopper on April 02, 2018, 02:43:53 PM
I never noticed the "A" being in there.  I generally always set up the A Axis on mills (we use the 4th axis) so I have never had this issue.  
Good to know, thanks Craig!
Title: Re: How do I make "Go to Work 0" work?
Post by: DazTheGas on April 02, 2018, 05:11:51 PM
I sometimes have the same problem myself after doing a probe move, I overcome this by pressing the reset before the GotoZero.

DazTheGas
Title: Re: How do I make "Go to Work 0" work?
Post by: TTalma on April 02, 2018, 06:42:59 PM
 :D

Joeaverage! Your fix worked! about 5 min editing and everything is running perfectly now!

Big Thanks!
Title: Re: How do I make "Go to Work 0" work?
Post by: trodono on May 21, 2021, 09:03:58 AM
Hi Guys,

I'm having the same issue over here. I'm attempting to edit the load screen script like 'joeaverage' is suggesting but when I try and save the changes, I'm getting this error:

Unable to save file C:\Mach4Hobby\ScreenScript.lua; access is denied

I'm logged in as an admin on the computer so I don't think it's a permissions thing but no sure.

I also tried to edit the actual ScreenScript.lua file with Notepad. I can make the change and save but it gets overwritten when I relaunch Mach 4.

Does anyone have a solution? Thanks so much for your time and expertise!

Tony
Title: Re: How do I make "Go to Work 0" work?
Post by: thosj on May 21, 2021, 02:57:33 PM
I'm far from an expert, but I don't think you can edit screenscript.lua, you need to edit the function in the screen load script in the screen editor.
Title: Re: How do I make "Go to Work 0" work?
Post by: joeaverage on May 21, 2021, 05:15:02 PM
Hi,

Quote
Unable to save file C:\Mach4Hobby\ScreenScript.lua; access is denied

thosj is correct, you cannot edit ScreenScript.lua directly. ScreenScript.lua is a file that is put together from all the lua fragments
throughout Mach at runtime. It is compiled and run. The combined source file is for you to view but you cannot edit it.

If you wish to edit the ScreenScript what you must do is edit the lua fragment that generated the code in the combined file, which
in this case is the screen load script accessed in the screen editor file tree.

Craig
Title: Re: How do I make "Go to Work 0" work?
Post by: --colin-- on August 05, 2021, 04:08:54 PM
I'm trying to figure out how to edit these scripts.  I know the ScreenScript.lua can't be edited, but I also have two other files, ScreenScript Mod.lua and ScreenScript-Mod.lua.  Both of those files can be edited but they do not appear to have any effect.  How do I identify the lua fragment?  I've looked all through the screen editor file tree and this fragment is not obvious.

For me the GoToWorkZero screen button works fine.  I would like to change it so that Z-Axis also zeros, but removing comments from either of the two editable files mentioned above does not work.

Ultimately, what I really want is a screen button to Home the machine back to machine zero.  I need to figure out how to do basic edits to existing scripts before attempting to create a new one.  I did this in Mach3 but Mach4 is much less intuative.  I've watched the basis screen edit video on Youtube but it doesn't go into script editing.  Thanks for any suggestions.
Title: Re: How do I make "Go to Work 0" work?
Post by: Bill_O on August 05, 2021, 04:35:43 PM
Colin,

Go to Operator then Edit Screen.
Under Screen Tree Manager select the top item.

Under Properties click on Icon with the lightning bolt (center)
Click on the code to the right of  Screen Load Script then click on the button with 3 dots.

Scroll down to the GoToWorkZero
Edit
Save Screen under Screen
Exit Screen Edit
Close Mach and restart



Title: Re: How do I make "Go to Work 0" work?
Post by: --colin-- on August 05, 2021, 04:48:55 PM
Bill,

Thank you, I got it to work.  Didn't have to close Mach and restart though.  I found the solution just before receiving your message.  It's covered in the Youtube video "Mach4 Basics: Homing and Soft Limits" near the end when she discusses how to make soft limits ON by default.

It's certainly not very intuative but I appreciate your response.
Title: Re: How do I make "Go to Work 0" work?
Post by: thosj on August 05, 2021, 06:33:48 PM
It's only ever "intuitive" if you know how to do it!!
Title: Re: How do I make "Go to Work 0" work?
Post by: Toshio.K on August 08, 2021, 04:38:57 PM
Hello.
I also imitated.
It went well. Thank you.

I may be in trouble.
I want to add "REF ALL HOME" to the numeric keypad.
Please tell me.