Class rhino3dm.ObjectAttributes.ObjectColor

image

What format should the color be in Python to match System.Drawing.Color type?
Is it just (R, G, B, A) tuple or list or it has to be of a particular type? Pillow?

Tuple or list with values 0-255 I believe.

edit: 4-element tuple with values 0-255.

1 Like

Thanks, that didn’t cause an error but the color is not set I assume it’s the ColorSource, now trying to figure out that one.

You need to set ObjectAttributes.ColorSource ObjectAttributes — rhino3dm 8.4.0 documentation

Yes, but these “ON::color_from_layer” don’t look very Python-y I assume they are coming from C++

	enum object_color_source
  {
    color_from_layer    = 0, // use color assigned to layer
    color_from_object   = 1, // use color assigned to object
    color_from_material = 2, // use diffuse render material color
    color_from_parent   = 3  // for objects with parents (like objects in instance references, use parent linetype)
                             // if no parent, treat as color_from_layer
  };

Use the numerical values.

oh, that’s more clearer thanks

This worked:

image

Apparently, I have to create another object for the ObjectColorSource

Update:

# or this :)
attribs.ColorSource = rhino3dm.ObjectColorSource(1)
attribs.ObjectColor = (125, 12, 125, 50) #System.Drawing.Color