Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Bodini on May 27, 2014, 11:01:07 PM

Title: Is there a way to tell IF gcode is loaded
Post 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
Title: Re: Is there a way to tell IF gcode is loaded
Post by: Ya-Nvr-No on May 27, 2014, 11:13:03 PM
might try
filename = mc.mcCntrlGcodeFile(inst)
or
linecount = mc.mcCntrlGcodeLineCount(inst)

then see if filename = nil
or linecount > 1
Title: Re: Is there a way to tell IF gcode is loaded
Post by: Bodini on May 28, 2014, 07:57:08 AM
Good thinking, Craig.
Thanks,
Nick

 
Code: [Select]
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
Title: Re: Is there a way to tell IF gcode is loaded
Post by: Ya-Nvr-No on May 28, 2014, 08:46:17 AM
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
Title: Re: Is there a way to tell IF gcode is loaded
Post by: Bodini on May 28, 2014, 08:52:36 AM
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.