Hello Guest it is April 26, 2024, 07:32:18 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - DazTheGas

51
Mach4 General Discussion / Re: terminate lua script
« on: November 14, 2018, 11:05:50 AM »
Quote
I realize that I could have each function return a number and I could check for that number before running any further functions

Thats the route I would take......

DazTheGas

52
Mach4 General Discussion / Re: Font gngrave wizard
« on: November 08, 2018, 07:02:39 AM »
There is a video on the MachSupport Youtube channel https://www.youtube.com/watch?v=vvjLEMvBRYQ

DazTheGas

53
Mach4 General Discussion / Re: If is running lua code
« on: November 02, 2018, 04:44:10 AM »
Probably better for you then is to use the states of the machine (MC_STATE_FRUN and MC_STATE_FRUN_FH)

DazTheGas

54
Mach4 General Discussion / Re: If is running lua code
« on: October 31, 2018, 05:34:31 PM »
You can do it by using an output signal IE


Code: [Select]
hSig, rc = mc.mcSignalGetHandle( inst, mc.OSIG_RUNNING_GCODE )
if rc == 0 then
GC_State = mc.mcSignalGetState(hSig)
if GC_State == 1 then
wx.wxMessageBox('GCode is running')
else
wx.wxMessageBox('GCode is not running')
end
else
wx.wxMessageBox('rc returned '..tostring(rc))
end

Place this in a button to test the effect with and without gcode running

DazTheGas

55
Mach4 General Discussion / Re: Button hide show?
« on: September 28, 2018, 04:20:23 PM »
Yes that is correct use the scr.SetProperty

scr.SetProperty('ctrlName','Hidden','0') -- ctrlName is visible
scr.SetProperty('ctrlName','Hidden','1') -- ctrlName is Hidden

DazTheGas

56
Mach4 Plugins / Re: mcX360 Plugin for Lua
« on: September 27, 2018, 04:55:03 PM »
I know absolutely nothing about the PMC/Ladder logic, ive always preferred to code what i need. Take a look at this example from an earlier post.

http://www.machsupport.com/forum/index.php/topic,33121.msg236608.html#msg236608

DazTheGas

57
Mach4 Plugins / Re: mcX360 Plugin for Lua
« on: September 26, 2018, 12:30:13 PM »
Glad you have it working, the problem I have is I can only test with an xbox controller as I dont have PS3 controller and I know it works. So as long as theres no typo`s then all should be good.

DazTheGas

58
Mach4 Plugins / Re: mcX360 Plugin for Lua
« on: September 25, 2018, 09:28:12 AM »
Your GetXin function is incorrect

your code
Code: [Select]
function GetXin(Xinput)
   local hreg = mc.mcRegGetHandle(mInst , string.format("mcX360_LUA/%s") , Xinput)
   return mc.mcRegGetHandle(hreg) -- This line is wrong
end

code should be
Code: [Select]
function GetXin(xinput)
local hreg = mc.mcRegGetHandle(inst, string.format("mcX360_LUA/%s", xinput))
return mc.mcRegGetValue(hreg) -- or return mc.mcRegGetValueLong(hreg)
end

DazTheGas

59
Mach4 Videos / Screen Timer Script
« on: September 20, 2018, 06:35:38 PM »
Ever wondered how the Screen Timer Script works

https://youtu.be/wNPMqjkcJ_8


Code used in video

Code: [Select]
if timer == 0 then
timer0()
elseif timer == 1 then
timer1()
elseif timer == 2 then
timer2()
elseif timer == 3 then
timer3()
elseif timer == 4 then
timer4()
elseif timer == 5 then
timer5()
elseif timer == 6 then
timer6()
elseif timer == 7 then
timer7()
elseif timer == 8 then
timer8()
elseif timer == 9 then
timer9()
else
mc.mcCntlSetLastError(inst, 'Timer Number Out Of Range')
end

function timer0()
local col = scr.GetProperty('btnMachCoord','Bg Color')
if col == '' then
scr.SetProperty('btnMachCoord','Bg Color','#00FF00')
else
scr.SetProperty('btnMachCoord','Bg Color','')
end
end

function timer1()
wx.wxMessageBox('I came from a Timer 1')
end

Enjoy

DazTheGas

60
Mach4 Plugins / Re: mcX360 Plugin for Lua
« on: September 19, 2018, 04:52:24 PM »
It would be easier to post what code you are using.

DazTheGas