A simple Python question

This should be obvious, but my brain isn’t what it used to be.

I’m working on a script where it will just change the colour of two spheres (along with a bunch of other stuff which is already working). I want the larger of the two to be a certain colour, and the smaller to be another colour. The sizes are not consistent, but one will always be larger than the other, if there are two spheres present.

Any suggestions?



Hi Dan,
Are your spheres surfaces?
Simply in Rhinoscriptsyntax you can get the radius as shown below, then use rs.ObjectColor() to change the colours.

import rhinoscriptsyntax as rs
surface = rs.GetObject("Select a surface", rs.filter.surface)
if surface:
    result = rs.SurfaceSphere(surface)
    if result:
        print("The sphere radius is: " + str(result[1]))

Hi Graham,

I guess I was looking for something more complicated, but you really can’t beat simplicity.

I’m all set now.



1 Like

Great. You can always come back and unpick it in Rhinocommon later if it’s important