Reading object display color in Grasshopper

How do I go about learning the object color set in rhino from grasshopper?

I have a bunch of surfaces in a 3d model that have been coded in various colors and I’d like to use this information in my grasshopper script, but how do I go about this?

A supplementary question is how to use the new Rhino filter components to select the surfaces based on these colors…

I feel both thinks must be super easy, but I just can’t figure it out…so any suggestion would be welcome

thanks

I assume you’re using Rhino 8?

object_display_color.gh (16.5 KB)

test_export.3dm (130.4 KB)

This looks super promising and I now have a list of the colors and I can choose one index/color that I want to select for, but how do I then turn around and use the selected color to select all the cubes that have the same color?

THANKS
anders

You can group by attributes using the Group Content component.

I’m pretty sure you need a script to select objects which have not been baked with a grasshopper definition…

What exactly is the goal?

I have a facade with >3000 panels in a number of categories that have been color coded to indicate material, color and tilt etc

Ideally just select all the surfaces/objects and automatically group and list by color so I can count units and area, but also manipulate them by group (ie add details or tilt etc)

Alternatively, a base functionality could be to choose one of the surfaces and ask to select all the ones with the same color…a version of the build-in rhino function to select by property

Does it make sense?

Ideally you would have a spreadsheet, *.csv or some other file containing the logic. If you just have the ‘stupid’ geometry, you can either group the way I already posted above or in a very similar way filter…

Then there is rhinoscriptsyntax and you can select geometry like so:

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino

sc.doc = Rhino.RhinoDoc.ActiveDoc

if bool==1: 
    rs.ObjectsByName(name,True)

sc.doc = ghdoc

This will select everything with the name you plug into the Grasshopper python component.

And here’s a link to the help pages:

Rhino - RhinoScriptSyntax