Point color

Hello,
I want to read the RGB value of a point. I used Rhino.ObjectColor function which returns a number usually the R value. How do I get G and B value of a point?

If you’re using python, ObjectColor returns a ‘color’ object and you can get the R,G,B using color.R, color.G, color.B…

With VB Rhinoscript, It returns a single number that represents the color, to get R,G,B you need to use Rhino.ColorRedValue (color), Rhino.ColorGreenValue, Rhino.Color.BlueValue… never understood why it doesn’t just return an array.

@Helvetosaur beat me to it! If you are in the rhino python editor, it might be something like this:

import rhinoscriptsyntax as rs
import Rhino as rc

pickPt = rs.GetObject("Pick a point")
ptObj = rc.RhinoDoc.ActiveDoc.Objects.FindId(pickPt)
ptColorObj = ptObj.Attributes.ObjectColor
print ptColorObj
print "Alpha Value = ", ptColorObj.A
print "R Value = ", ptColorObj.R
print "G Value = ", ptColorObj.G
print "B Value = ", ptColorObj.B

print dir(ptObj.Attributes)

I am using rhino script. I used this, but it does not show the actual color of the point.
pt = Rhino.GetObject(“Select the point to get the RGB value”)
R = Rhino.ColorRedValue(pt)
G = Rhino.ColorGreenValue(pt)
B = Rhino.ColorBlueValue(pt)
Rhino.Print “R=” & R & “G=” & G & “B=” & B

You need to use ObjectColor first on the point object…

Thanks. It worked.