Looking for a .py script that can toggle True/False in an advance option

Perhaps someone knows of a script that can toggle True/False in an advance option?
I love the rotate ParallelView options… But if only there was a way to toggle it off and on that could be assigned to a button.
Obviously it is not very useful if one has to go and toggle it in advance option [or the 3Dconnx options] while working

I tried to adapt a script from @Jarek … from this Toggling advanced options via script?. but… being on Mac here, I’m looking for a Python version that will also work on R8 [I’m guessing the path to the advance option is not the same as in R7 at least on Mac…?]

thanks a lot
akash

thanks a lot
Akash

adapting the given approach to the searched parameter - this might work ?

import Rhino
settings = Rhino.PlugIns.PlugIn.GetPluginSettings(Rhino.RhinoApp.CurrentRhinoId, False)
s = settings.GetChild("Options").GetChild("SpaceBall")
currentValue = settings.GetChild("Options").GetChild("SpaceBall").GetBool("RotateParallelView")
newValue = not currentValue
# write current
Rhino.RhinoApp.WriteLine(str(settings.GetChild("Options").GetChild("SpaceBall").GetBool("RotateParallelView")))
s.SetBool("RotateParallelView",newValue)
# write new
Rhino.RhinoApp.WriteLine(str(settings.GetChild("Options").GetChild("SpaceBall").GetBool("RotateParallelView")))

kind regards -tom

1 Like

Thanks you @Tom_P
Your adaptation works great.

Very Happy

Akash

Hi @Tom_P
and everyone who wishes to help with this.

Trying to add the next function to the toggle script. But I don’t really have any idea how to call a command from rhino…?
For it to fully work, it needs to have the False Boolean calling the command '_plan to reset the view port.
Kindly see is you wish, the last 2 rows I added, they do nothing to help the script… but it is clear what is the intention.



import Rhino
settings = Rhino.PlugIns.PlugIn.GetPluginSettings(Rhino.RhinoApp.CurrentRhinoId, False)
s = settings.GetChild("Options").GetChild("SpaceBall")
currentValue = settings.GetChild("Options").GetChild("SpaceBall").GetBool("RotateParallelView")
newValue = not currentValue
# write current
Rhino.RhinoApp.WriteLine(str(settings.GetChild("Options").GetChild("SpaceBall").GetBool("RotateParallelView")))
s.SetBool("RotateParallelView",newValue)
# write new
Rhino.RhinoApp.WriteLine(str(settings.GetChild("Options").GetChild("SpaceBall").GetBool("RotateParallelView")))
# reset view [how to call the rhino command '_plan]
if False ("'_Plan") 

thanks a lot
akash

what are meaning with this “next” function ?

above is a script
“_plan” is a rhinocommand

import rhinoscriptsyntax as rs
rs.Command("_Plan")

??

2 Likes

Great
thanks a lot