Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: thespindoctor on April 01, 2017, 06:05:43 PM
-
Why does this fail with error that the file cannot be created?
Not sure how to open and close files for probe data.
local rc=mc.mcCntlProbeFileOpen (inst, "KFCProbeFile.csv", "%.4Axis_X, %.4Axis_Y", TRUE)
local rc=mc.mcCntlProbeFileClose(inst)
Thanks
-
Hi,
the file open statement requires a path in addition to the filename.
Have a look at m401 in Mach4Hobby/LuaExamples/ProbeToFile .
Craig
-
I don't understand the M401 code but how about this? It still does not write to the file during the probe operation.
local path="c:\\Mach4Hobby\\Modules\\KFCProbeFile.csv"
mc.mcCntlProbeFileOpen(inst, path, "%.4Axis_X, %.4Axis_Y", TRUE)
Thanks Craig
-
Hi,
I don't think you've got the path right yet...
This is a register I use to access a file which is subsequently used in a macro:
C:\Users\craig\Documents\eagle\fourthFOC\AEProbeData.txt
Try putting your probefile in the same directory as your Gcode, not your modules directory.
Craig
-
Got it? TRUE is not valid but true is... case sensitive!
Also \\ double slashes is correct so this below worked great
mc.mcCntlProbeFileOpen(inst, "C:\\mach4Hobby\\GcodeFiles\\KFCProbeValues.csv","%.4AXIS_ %.4AXIS_Y\n", true)
only problem is that the G31 move will only run twice in a row then it kicks out...
-
Hi,
in LUA a backslash, '\', is an escape character. Consequently if you wish to put a backslash in a LUA string the backslash
will have to be quoted or preceeded by an escape character ie another backslash.
Your instruction:
mc.mcCntlProbeFileOpen(inst, "C:\\mach4Hobby\\GcodeFiles\\KFCProbeValues.csv","%.4AXIS_ %.4AXIS_Y\n", true)
does require the double backslashes however if you have a path string with backslashes embedded:
mc.mcCntlProbeFileOpen(inst,path,"%.4AXIS_ %.4AXIS_Y\n", true)
will work.
Craig
-
Thanks!