Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: Cbyrdtopper on December 21, 2018, 10:32:15 PM
-
I'm trying to read a custom user field that I'm putting in a tool table.
I want to add the field "Heavy Tool" to the tool table. I've got it set up but I don't know the syntax to read it from the m6.
Going back to my Hurco code, I am reading the Pocket from the tool table, here is that line of code:
local Pocket = mc.mcToolGetData(inst, mc.MTOOL_MILL_POCKET, Tool);
I named my user field "Heavy" to keep it simple for now and tried this code and it did not work...:
local HeavyToolCheck = mc.mcToolGetData(inst, mc.MTOOL_MILL_HEAVY, Tool);
When you set the user field up it asks for a Key Name input, So I made it "Heavy" I figured that would be what I put in the macro, but it isn't.
Anyone know how to do this?
-
Depends on what kind of data is in the custom field you created. A integer, double or string. Looking at the API doc I think it would be this one for a double ........
value, rc = mc.mcToolGetDataExDbl(number mInst, number toolNumber, string fieldName) --This is the explanation of the 3 parameters from the doc
The API call should make you think....... mc.mc Tool Get Data Extended as a double
value, rc = mc.mcToolGetDataExDbl(inst, 2, "Heavy") --This is how it might look in actual use.
Then the 3 parameters are
inst = instance and the manual says its expecting a type number for this parameter
2 = Tool number and its expecting a type number for this parameter
"Heavy" = field Name and it is expecting a type string for this parameter ("" make it a string). 0 = number "0" = string
-
That did it, works like a charm!
I didn't think of using the another type of tool get data.
Thanks!
-
:)