Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: henri on September 09, 2021, 04:52:57 AM
-
Hi
I am retrofitting 16A20 lathe and using Mach 4 with CSMIO IP-S controller. I built operation panel with push buttons but don´t know how to script the programm.
For START, FEEDHOLD and STOP I´ve got it worked, but need also script for SET Z OFFSET, SET X OFFSET, REF ALL, REF Z, REF X, MDI tab, GCode tab, Fixture Offset, Turn Cycles, Spindle CW, Spindle CWW etc.
Can anyone give some advice or tutorial?
Thanks in advance,
Henri
-
Hi,
all of those features are already included in Mach4. If you go into 'Screen Edit' mode and click on each feature
you will be able to see how NFS coded each.....all you require is to duplicate that for each feature in the SigLib table,
one entry in the table per external button.
Craig
-
Hi,
all of those features are already included in Mach4. If you go into 'Screen Edit' mode and click on each feature
you will be able to see how NFS coded each.....all you require is to duplicate that for each feature in the SigLib table,
one entry in the table per external button.
Craig
Thank you, Craig!
I tried to script the REF ALL, but it is giving LUA error. Do you have any examples how do you have it done?
Henri
-
Hi,
I haven't had any problem with <RefAll>.
What you need to do is assign an input signal, say ISIG_INPUT10 to your external button via your controller.
In the SigLib table whenever that input goes high have it call the existing <RefAll> script, you are just using an external
button to trigger an existing Mach4 function.
Post the error message. You may have noted that the standard <RefAll> script homes all four axes....but if you only have three then
it will fault. You need to go to the RefAll script in the ScreenLoad script and edit the fourth axis out of the sequence.
Craig
-
Hi,
I haven't had any problem with <RefAll>.
What you need to do is assign an input signal, say ISIG_INPUT10 to your external button via your controller.
In the SigLib table whenever that input goes high have it call the existing <RefAll> script, you are just using an external
button to trigger an existing Mach4 function.
Post the error message. You may have noted that the standard <RefAll> script homes all four axes....but if you only have three then
it will fault. You need to go to the RefAll script in the ScreenLoad script and edit the fourth axis out of the sequence.
Craig
Hi
It gives following Lua error: error while running chunk. Have no idea how to repair it.
I added some pics about the Signal Library and the error.
henri
-
Hi,
that's what the stack dump is for.
Open your Screenscript.lua and look at line locations 242, 84 and 620. There or there abouts is the error or errors. Note that the Screenscrpit.lua
IS NOT editable, it is the compiled chunk that includes ALL the Lua chunks and macros. You have to go back the the source script to edit it,
thereafter a new Screenscript.lua will be compiled and include the changes you have made.
Craig
-
If you are just wanting the external button to do what the screen button does then all you need to do is add the script from the screen button to the siglib IE:
[mc.ISIG_INPUT5] = function (state)
if (state == 1) then
wait = coroutine.create (RefAllHome)
end
end,
But remember you must add some more code to check that the controller is in a state that will allow you to home too
DazTheGas
-
Thank you for advice. ""RefAllHome" works!
Have you anybody an idea how to script SET X and Z OFFSET? Is it right to copy all the script from SETTOOLXOFFSET (Clicked script) to Signal Library or is there any shortcut for that?
And also how to script tabs (between GCode and MDI)?
henri
-
Hi again
Can someone suggest somebody who is experienced with Mach4 LUA scripting and wants to script some functions in Signal Library?
I´m willing to pay for the work.
Functions that needs to be scripted as inputs are following:
Pages:
Program Run
Turn Cycles
Tables:
Tool table
Fixture Offset
Tabs:
GCode
MDI
REF X
REF Z
REF ALL
Set X Offset
Set Z Offset
Spindle CW
Spindle CCW
Jog mode:
INCREMENTAL
CONTINOUS
JOG rate/speed:
25%
50%
75%
100%
BR,
henri
-
these functions are of great interest to me too!
were you able to recall MDI via button?