Use point attribute to color surface

Hello guys
In rhino i have
1 - Close curves as footprints
2 - Points inside each curves with a numeric attribute “resultats”
I would like to use the numeric value of my attribute “resultats” to coloring the surfaces create with the close curves.

I try with no results to :
1 - extract attribute value "resultats " from the points
2 - create a domain with it and use it with the gradient
3 - use the domain and apply color to close curves as surfaces

Could you help me ?forum.3dm (82.5 KB)

I believe Human has a component to get object attributes.

Thanks Adam
Yep, I already try to use it without success :frowning:

I don’t know how to access to the specific attribute “resultat”

I didn’t see that attribute, attached to the points, in the Rhino Document you uploaded. How was the data attached?

I made a sample file and assigned some test points the attribute and value manually.

Assuming that you have some user text (key/value) attached to your points, you can access them with a little python code.

this is one we use here in our shop: (inside a ghpython component.
x input set to Item access, and type hint GUID

"""O_UserText.  Read User text keys/values from object attributes
            x: reference geometry (as guids, can pass geometry param through ID param)
            udk: User Data Keys
            udv: User Data Values
            Provided by OTools ver xx.xx.xx"""

import Rhino

values = []

objs = Rhino.RhinoDoc.ActiveDoc.Objects.Find(x)
keys = objs.Attributes.GetUserStrings()

for key in keys:
    v = objs.Attributes.GetUserStrings().GetValues(key)[0]
    if v.ToString().StartsWith("%"): #RhinoCalculatedAttributes
        p = Rhino.RhinoApp.ParseTextField(v,objs,None)
    else: # standard object user text
udk = keys
udv = values

Once you have that, you can decide how you want to create your domain. (will it be a domain from the lowest to highest value in your values?)
It might be something like this.

This shows how to make a gradient from the bounds of a list of values. Then you figure out some method to relate the points to the curves, (in this example, I’ll skip over that and just make some around each referenced point). make them surfaces, then color them with the results of the gradient.

The attribute was create using UNAToolbox

I don’t understand how to access them.

An other way would be to use the points colors and use it to paint the boundary surface associate to the point… But I don’t arrive how to associate each point with each boundary surface.