In regular world space, I rotated a Plane using the Gumball to match a planar area of a Top and Side view photo, then saved a CPlane from it. Where can I see its Euler angles?
In Alias, I would select the object, the plane in this case, and read its X, Y, and Z rotations in the Information Window. The What command sadly does not yield such information about an object (position, rotation, scaling, etc.).
#! python 3
import Rhino
import scriptcontext as sc
view = sc.doc.Views.ActiveView
if view:
plane = view.ActiveViewport.ConstructionPlane()
# Rotation-only: world axes -> cplane axes
rotation = Rhino.Geometry.Transform.Rotation(
Rhino.Geometry.Vector3d.XAxis,
Rhino.Geometry.Vector3d.YAxis,
Rhino.Geometry.Vector3d.ZAxis,
plane.XAxis, plane.YAxis, plane.ZAxis)
rc, yaw, pitch, roll = rotation.GetYawPitchRoll()
if rc:
print("X: {0:.3f} Y: {1:.3f} Z: {2:.3f}".format(
Rhino.RhinoMath.ToDegrees(roll), # about X
Rhino.RhinoMath.ToDegrees(pitch), # about Y
Rhino.RhinoMath.ToDegrees(yaw))) # about Z
else:
print("Construction plane frame is not a rotation.")