Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: GerdS on February 05, 2017, 01:58:35 PM

Title: Read out User defined fields from Tool table
Post by: GerdS on February 05, 2017, 01:58:35 PM
Hello, is there an easy way to read out User defined fields from the Tool table.
I already played with mcToolGetData and the UsrField.... values from the tool table.
The API documented types from "mcToolGetData", have the same name like in the tooltable.tls. For example:FieldType1=MTOOL_MILL_HEIGHT:Float(-1,4)
Tryed to use my defined name, but no luck.

Thanks
Gerd
Title: Re: Read out User defined fields from Tool table
Post by: GerdS on February 10, 2017, 08:28:01 AM
For everybody who did not know, here is the solution.

mcToolGetDataExDbl()
mcToolGetDataExInt()
mcToolGetDataExStr()

local dblVal, rc = mc.mcToolGetDataExDbl(number mInst, number toolnum, string fieldName)
local strlVal, rc = mc.mcToolGetDataExStr(number mInst, number toolnum, string fieldName)

You can find this and many more undocumented functions it in the autocomplete list in the LUA Editor.

Thanks to Brett from the Tech support staff for his help.

An example i did is attached.