Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: Bodini on May 27, 2014, 11:01:07 PM
-
Is there a way for Lua to check IF Mach4 has a gcode file loaded? ???
Thanks, Nick
-
might try
filename = mc.mcCntrlGcodeFile(inst)
or
linecount = mc.mcCntrlGcodeLineCount(inst)
then see if filename = nil
or linecount > 1
-
Good thinking, Craig.
Thanks,
Nick
inst = mc.mcGetInstance()
local linecount = mc.mcCntlGetGcodeLineCount(inst)
if linecount > 0 then
wx.wxMessageBox ("File loaded")--file is loaded
else
wx.wxMessageBox ("No file loaded")--no file loaded
end
-
Not sure I'd use zero (0) as the default seems to be 1
think that needs to be addressed at some point before release.
But your welcome
-
The Dro says "1" but the var says "0" (since I'm checking the var, then the script works). Like you say, that should probably be addressed.