Create a Toggle for MouseOverHighlight setting

Hi all,

It’s been a while since I’ve scripted, and I’m thinking maybe this has to be done using RhinoCommon (?) which I’m not versed in.

Would anyone be kind enough to furnish a simple script that I could use to create an Alias? And then I could also learn using the script. :slightly_smiling_face:

Thanks in advance!

– Alan

I’m not quite sure what you’re referring to. Do you need a script that detects when you mouse over a highlighted object, one that highlights objects when mousing over them, one that toggles highlighting on or off for another script, or something else entirely?

Thanks,
~CH

Thanks for the reply, @Cole_Howell1 I’d like a simple script to Toggle the setting On/Off.

Thoughts?

Hi @Alan_Farkas, try below script within _EditPythonScript to toggle that setting:

#! python 2
import Rhino
import System

def ToggleMouseOverHighlight():
    # toggles boolean value stored in Options > Advanced
    # Rhino.Options.General.MouseOverHighlight
    
    try:
        rh_id = Rhino.RhinoApp.CurrentRhinoId
        settings = Rhino.PlugIns.PlugIn.GetPluginSettings(rh_id, False)
        s = settings.GetChild("Options").GetChild("General")
        b = s.GetBool("MouseOverHighlight")
        s.SetBool("MouseOverHighlight", not b)
        print "MouseOverHighlight={}".format(not b)
        
    except Exception as ex:
        print ex

ToggleMouseOverHighlight()

Save the script to your preferred location and create an alias for it eg. using below macro:

! _-RunPythonScript “C:\MyFolderPath\MyScriptName.py”

_

c.

Thanks as always, @clement Will give it a whirl and confirm here.