Hello Guest it is March 28, 2024, 08:25:27 AM

Author Topic: How do I make "Go to Work 0" work?  (Read 3777 times)

0 Members and 1 Guest are viewing this topic.

How do I make "Go to Work 0" work?
« 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.
Re: How do I make "Go to Work 0" work?
« Reply #1 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.
Chad Byrd
Re: How do I make "Go to Work 0" work?
« Reply #2 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
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: How do I make "Go to Work 0" work?
« Reply #3 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!
Chad Byrd

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: How do I make "Go to Work 0" work?
« Reply #4 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
New For 2022 - Instagram: dazthegas
Re: How do I make "Go to Work 0" work?
« Reply #5 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!
Re: How do I make "Go to Work 0" work?
« Reply #6 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

Offline thosj

*
  •  532 532
    • View Profile
Re: How do I make "Go to Work 0" work?
« Reply #7 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.
--
Tom
Re: How do I make "Go to Work 0" work?
« Reply #8 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
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: How do I make "Go to Work 0" work?
« Reply #9 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.
--Colin--