How to extract the Z vector from the gumball object using RhinoCommon?

Hi,
I want to extract the Z vector from the gumball associated to a given object. I’m trying to do it using Python but I’m not familiar with RhinoCommon which seems to offer this possibility.

I manage to do this to start :

import rhinoscriptsyntax as rs
import Rhino

geo = Rhino.Input.Custom.GetObject()
geo.SetCommandPrompt("Select object")
geo.Get()
rhobj = geo.Object(0).Object()
frame = rhobj.TryGetGumballFrame()
print(frame)

I understand it will give me the GumballFrame only if its position has been set manually before. But how I can get the vectors defining its plane from that ?

import Rhino as rh
import scriptcontext as sc

go = rh.Input.Custom.GetObject()
go.SetCommandPrompt("Select object")
go.Get()
rhobj = go.Object(0).Object()
success, frame = rhobj.TryGetGumballFrame()
if success:
    print(frame.Plane.ZAxis)
1 Like