Dear Trent
Please see my steps, generated with great help from the Forum members. I run a lathe with Mach4 and the name of my card is Pokeys_Lathe:
Go into the Screen Editor: Click on the X DRO on the screen, then look at the left and you will see droCurrentX highlighted slightly. Click on droCurrentX to highlight it.
Now look at the window (Properties) below this window and click on the second little box which is the Events Tab. Now click on the first line below that called "On Update Script", then click on the box with the three dots to the right, that will open a blank Lua Page.
Now copy the LUA code below for the X DRO below and paste it on that blank LUA page. Please update the serial number of your Pokeys device.
local val = select(1,...)
Xcoords = val
val = tonumber(val)
local inst = mc.mcGetInstance()
mc.mcCntlSetLastError(inst, "On update ran")
local Xcoords = string.format("X:% 10.4f", Xcoords)
local hreg = mc.mcRegGetHandle(inst, string.format("PoKeys_Lathe/LCD Line 1"))
mc.mcRegSetValueString(hreg, Xcoords.." ")
return val
Follow the same procedure for updating the Z axis DRO. Remember to update the serial number of your Pokeys device again.
local val = select(1,...)
Zcoords = val
val = tonumber(val)
local inst = mc.mcGetInstance()
mc.mcCntlSetLastError(inst, "On update ran")
local Zcoords = string.format("Z:% 10.4f", Zcoords)
local hreg = mc.mcRegGetHandle(inst, string.format("PoKeys_Lathe/LCD Line 2"))
mc.mcRegSetValueString(hreg, Zcoords.." ")
return val
Now exit Mach4 and then start it up again. Now the LCD should update each time you have the DROs updated in Mach4. I still struggle to understand what each line of code is doing.
Please let me know how its going.
Kind regards
Danie