Rhino.Python Get Key and Value

Hello to all,

I am a beginner about Rhino Scripting so my issue is.

I´d to get keys and values to variable.

I used rs.getusertext but it took only keys to the variable.

You can see at above the SS. it took only key side, i need to get also values. Has anyone idea about that?

Thanks.

Hi @Teachy ,

rs.GetUserText func returns a list of key, attached to that rhino object. So you have to again iterate through each one of those keys to get its value:

import rhinoscriptsyntax as rs

nesneler = rs.AllObjects()


text = {}

for nesne in nesneler:
    keys = rs.GetUserText(nesne)
    
    key_values = []
    for key in keys:
        value = rs.GetUserText(nesne, key)
        key_values.append([key, value])

    text[nesne] = key_values


for user_text in text.values():
    print(user_text)
1 Like

thanks

1 Like