Python scale a sphere non-uniformly

I am not able to scale a sphere uniformly within python rhinocommon codes.
In green the sphere and in red the box to which I wanted the sphere to be scaled.

Do you might know what I am doing wrong?
Thank you for your response. :slight_smile:

20190207 problrem uniform scale a sphere 00.gh (15.8 KB)

It’s simpler to just set its Radius property, ala:

mySphere.Radius = 42

Edit: Oh, non-uniformly you mean, in which case, yes a transform is needed.

I am sorry, what do you mean?

I want the sphere be deformed like an oval/egg. I do not know if that is possible in grasshopper python rhinocommon.

I can gumball it in Rhino, but not make it with python.

It seems one must cast the Sphere to a NurbsSurface in order for the non-uniform scaling to work as expected (doesn’t work with casting to Brep either):

190207_ScaleSphereNonUniform_00.gh (5.8 KB)

I feel like this method should probably return False when called on a type it doesn’t work with (i.e. it doesn’t non-uniformly scale it), but I may be missing something here :man_shrugging:

2 Likes