I am read A DRO valve and want to store it in a register i read it alright, but if i try to format it so i loose the values after the decimal point
if i don't convert it to a number i get the error can't use string number expected, so i convert it to a number i get the, error nul value. it is always when i am trying to write the value to the register..
any suggestions?
local inst = mc.mcGetInstance()
local val = scr.GetProperty("Tool1DRO", "Value")
--wx.wxMessageBox("Val = "..val)
--val = tonumber(val)
--x = string.format("%.1f"..tonumber(val))
mc.mcCntlSetLastError(inst, "val = "..val)
local Pos1reg = mc.mcRegGetHandle(inst,"gRegs0/ToolInPos1")
rc = mc.mcRegSetValueString(Pos1reg,string.format("%.0f",3))
rc = mc.mcRegSetValueString(Pos1reg,string.format(val))