Hi Arcade - here is a thing that will let you get or set the ortho angle in degrees:
import Rhino
def OrthoAngle(angle=None):
if angle is not None:
Rhino.ApplicationSettings.ModelAidSettings.OrthoAngle = Rhino.RhinoMath.ToRadians(angle)
return Rhino.RhinoMath.ToDegrees(Rhino.ApplicationSettings.ModelAidSettings.OrthoAngle)
If you pass it no angle, as in x = OrthoAngle() it will just give you back ‘x’ as the current angle, if you give an angle, as in OrthoAngle(45) it will set that as the ortho angle and return that as well .
You do need to import Rhino at the top of your script.
import Rhino
import scriptcontext as sc
def OrthoAngle(angle=None):
if angle is not None:
Rhino.ApplicationSettings.ModelAidSettings.OrthoAngle = Rhino.RhinoMath.ToRadians(angle)
return Rhino.RhinoMath.ToDegrees(Rhino.ApplicationSettings.ModelAidSettings.OrthoAngle)
# get Rhino's current ortho angle
crntAngle = OrthoAngle()
# store the angle
sc.sticky["ORTHO_ANGLE"] = crntAngle
"""
# do some stuff that involves changing the ortho angle
#blah-blah
"""
# now get the stored angle back from storage and restore it as Rhino's OrthoAngle:
# first check to make sure there is an angle stored
if "ORTHO_ANGLE" in sc.sticky:
angle = sc.sticky["ORTHO_ANGLE"]
# if there is one stored, then use it to restore Rhino's OrthoAngle
# using the OrthoAngle function above:
OrthoAngle(angle)
# Then clear the key/value in sticky so that you can start over on the next time through:
sc.sticky.pop("ORTHO_ANGLE")