Hello Guest it is November 22, 2019, 07:11:46 AM

Author Topic: Is there a way to tell IF gcode is loaded  (Read 1473 times)

0 Members and 1 Guest are viewing this topic.

Offline Bodini

*
  •  216 216
    • View Profile
Is there a way to tell IF gcode is loaded
« 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
Re: Is there a way to tell IF gcode is loaded
« Reply #1 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

Offline Bodini

*
  •  216 216
    • View Profile
Re: Is there a way to tell IF gcode is loaded
« Reply #2 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
Re: Is there a way to tell IF gcode is loaded
« Reply #3 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

Offline Bodini

*
  •  216 216
    • View Profile
Re: Is there a way to tell IF gcode is loaded
« Reply #4 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.