Can you get the keys from a Value List?

unhandled

#1

Hi, I’d like to use both the keys and values of value list.

vlist

What is the best way to do this?


#2

copy/paste?


(qythium) #3
valuelist = ghenv.Component.Params.Input[0].Sources[0]
keys, values = zip(*[(item.Name, item.Expression) for item in valuelist.ListItems])

image
valuelist-extract.gh (6.1 KB)


#4

Fantastic, thank you!

vlist

When I viewed the output of the Value List, is was just the values, so I wasn’t sure how to get it. But programatically ripping open the input component is a great solution. Thanks!