Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: Wallerawang on February 24, 2022, 04:31:28 AM
-
Hello
I have modified my wx4 screen set to include a DRO to set the spindle range. Is there a way to make this DRO persistent so when I start Mach4 it remembers what gear I left it in?
Thanks
Steve
-
I usually will do something like set a register then make the register permanent.
Then have the dro read the register.
-
Thanks Bill,
I set up the register Okay but now the DRO no longer actually changes the spindle range in Mach 4. When I removed the register from the DRO properties it went back to working correctly. I will make a DYMO label to remind me to set the DRO each time.
Steve
-
Probably need to do some other code to make the register set the spindle range.
-
It's been a long time since I did this, but here's what I find in the screenset and mine works like I think you want.
Screen Unload Script, my entire thing:
function Mach_Screen_Unload_Script()
inst = mc.mcGetInstance()
local IsOpen = mc.mcProfileGetString(inst, 'TOffParams', 'ToffDialog', '0') -- Get the Value from the profile ini.
if (IsOpen == '1') then --The TouchOff dialog is open and we need to close it
Tframe:Close()
Tframe:Destroy()
end
--Saves Spindle Range to profile on screen unload
--local inst = mc.mcGetInstance() -- not needed if already declared
local val = mc.mcSpindleGetCurrentRange(inst)
mc.mcProfileWriteInt(inst, 'SpindleDefaultRange','Range',val)
end
Screen Load Script, at the end
ButtonEnable()
--Screen Load Script to set Range saved in screen unload script
--Screen Load Script
--local inst = mc.mcGetInstance() -- not needed if already declared
local val = mc.mcProfileGetInt(inst, 'SpindleDefaultRange','Range',0)
mc.mcSpindleSetRange(inst, val)
-
Thanks Tom - I'll give it a go.
Steve
-
Hi Tom
I just wanted to let you know that worked like a charm. Very happy with the DRO now remembering what it was at shut down.
Steve
-
Very cool, glad it worked!