How can I get the gumball center in RhinoCommon? I just want to put a point there.
It is most likely the centroid of the bounding box of your geometry (or set of geometries).
Boundingbox (and its centroid) will change regarding the CPlane … the same as with the gumball.
import Rhino
import scriptcontext
def ExtractGumballOrigin():
go = Rhino.Input.Custom.GetObject()
go.SetCommandPrompt("Select object")
go.Get()
if go.CommandResult()!= Rhino.Commands.Result.Success:
return go.CommandResult()
rhobj = go.Object(0).Object()
success, frame = rhobj.TryGetGumballFrame()
if not success:
return Rhino.Commands.Result.Failure
scriptcontext.doc.Objects.AddPoint(frame.Plane.Origin)
return Rhino.Commands.Result.Success
if __name__ == "__main__":
ExtractGumballOrigin()
Hi @phcreates,
There is this:
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_RhinoDoc_GetGumballPlane.htm
– Dale
That fails in all cases I’ve tried.
Thanks, but I’m still fairly clueless in RhinoCommon and so I have no idea where to go from there. I see these help files but they don’t help me at all because I don’t understand the format. Sometimes I can muddle through when I find examples that are similar enough, but mostly I’m just lost.
I guess, but how can I select control points?
… what are you trying to do?
I’m literally trying to put a point where the center of the gumball is, in any normal case. Gumball position is affected by control points, surfaces - nearly anything - and I find that I want to just have a point there when I’m building things sometimes. But I’m going to hold off on this for now - I just thought it might be simple.
it only works when the gumball is not in its default position: