-Open the profile you wish to change the button in.
-With Mach4 disabled, click on the "Operator" tab at the top.
-Then, "Edit Screen."
-In the "Screen Tree Manager" (top left), click on the wx4, or whatever is listed. This is the screen currently loaded for this profile.
-Down the column under properties, you will see what look like two text doc icons. One is properties and the other, looks like it has a lightning bolt through it. Click on that one, which is the "Events" tab.
-The first item that appears in the list is the screen load script. Click on this and then click on the box with three dots that shows up. (this is the edit box)
-The Screen Load script should appear on the screen. If not, look for the LUA editor down in the task bar and expand it. Sometimes the editor will open in the minimized form. The editor will need to be expanded before continuing.
-Find the GoToWork zero function. Ctrl+F will allow you to search for keywords, or you can simply scroll until you find it. This function runs here and is called by the button from the Run Screen.
-Replace the function with the one pasted at the bottom of this page.
-There is a note in the function explaining how it will work. It is now configured for Z to now move first to home (Machine Coordinate Zero) and then X and Y to Work Coordinate Zero.
-Once the edits are complete, go to "Screen" and "Save Screen As". Give your screen a unique name so the original wx4.set is left in tact. This will also prevent your screen from being overwritten if you update in the future.
-Click the "Operator" drop down menu again, then "Edit Screen". This will exit the screen editor and return Mach4 to the run screen in disable mode.
-Enable Mach4 and test the newly configured Go To Work Zero Button.
**Click the Link Below to the MACH SUPPORT CHANNEL to view the supporting video.**
https://www.youtube.com/watch?v=SZuEJn046Pw
---------------------------------------------------------------
-- Go To Work Zero() function that acts like a safe Z in Mach3
---------------------------------------------------------------
function GoToWorkZero()
mc.mcCntlMdiExecute(inst, "G00 G53 Z0\nG00 X0 Y0")
--G53 Z0 will send Z "home, Then will send X and Y to Work coords, Zero
--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