ObjectColor method in Python


#1

I’m trying to understand how to work with what is returned by the ObjectColor method in Python. Here is a typical example:

Color [A=255, R=191, G=63, B=63]

At first glance this seems like a list, but I don’t believe it is. When I test for the object type, it returns the type as “color”. I can’t find any useful information on how to work with the type “color”.

All I’m trying to do is extract one of the values from the return, for example the R value only and print that.

How would I do that?

Thanks,

Dan


(Giulio Piacentino) #2

Hi Dan

the type is System.Drawing.Color:
http://msdn.microsoft.com/en-us/library/system.drawing.color.aspx

You can use color.R, color.G, color.B, color.A to get the corresponding properties.
Alternatively you can also use any of the other additional methods that the Color data structure provides.

Thanks

Giulio

Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com


#3

Hi Giulio,

Thanks for that link. It was very helpful.

Dan