Hi,
now understand how errorcodes are passed around, thanks DTG.
I'm not out of the woods yet tho...
if(file:ShowModal() == wx.wxID_OK)then
local path = file:GetPath()
local linecount
local buf
local rc
local pathGenerating=1
rc=mc.mcCntlLoadGcodeFile(inst, path)
wx.wxMessageBox(tostring(rc))
rc = mc.mcToolPathGenerate(inst)
while(pathGenerating==1)do
pathGenerating, rc = mc.mcToolPathGetGenerating(inst)
end
linecount, rc = mc.mcCntlGetGcodeLineCount(inst)
buf, rc = mc.mcCntlGetGcodeFileName(inst)
wx.wxMessageBox(buf.." lines loaded "..linecount)
end
The file dialog gets a good path and filename. If I debug it works ok.
If I run it as m150 at the MDI line it fails. The file dialog operates normally
but the file does not load or generate a toolpath neither the message boxes
come up to indicate progress.
One possibility I considered was that the instructions imediatley following the load
were happening so fast that it was 'breaking' the load.
You can see I've tried to put a while loop in there to allow the load/generate to
complete. It didn't work either, although that may be my poor coding than anything.
The other possibility that occurred to me is that when I start the macro the panel is
showing the MDI input and maybe the Gcode has got nowhere to go.
Might point out that this is not really necessary macro but rather an experiment
in Lua coding.
Craig