Hello Guest it is April 27, 2024, 04:44:34 AM

Author Topic: Persistent Spindle Range DRO  (Read 895 times)

0 Members and 1 Guest are viewing this topic.

Persistent Spindle Range DRO
« 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

Offline Bill_O

*
  •  563 563
    • View Profile
Re: Persistent Spindle Range DRO
« Reply #1 on: February 24, 2022, 09:14:00 AM »
I usually will do something like set a register then make the register permanent.
Then have the dro read the register.
Re: Persistent Spindle Range DRO
« Reply #2 on: February 25, 2022, 03:56:27 PM »
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

Offline Bill_O

*
  •  563 563
    • View Profile
Re: Persistent Spindle Range DRO
« Reply #3 on: February 25, 2022, 04:02:48 PM »
Probably need to do some other code to make the register set the spindle range.

Offline thosj

*
  •  532 532
    • View Profile
Re: Persistent Spindle Range DRO
« Reply #4 on: March 03, 2022, 12:17:08 PM »
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)
--
Tom
Re: Persistent Spindle Range DRO
« Reply #5 on: March 03, 2022, 01:30:16 PM »
Thanks Tom - I'll give it a go.
Steve
Re: Persistent Spindle Range DRO
« Reply #6 on: March 08, 2022, 07:19:13 PM »
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

Offline thosj

*
  •  532 532
    • View Profile
Re: Persistent Spindle Range DRO
« Reply #7 on: March 09, 2022, 09:48:51 AM »
Very cool, glad it worked!
--
Tom