Choose numbers out of a list

Dear reader,

I have a question about picking numbers out of a list. In the picture you can see that i have 2 input components, 1 goes in to Y and the otherone in z. The question is: when you choose 1 in the value. I want that the component picks the input form Y (11) and when the value is 2 or higher it has to pick the input in Z (15.5 and 18.6). I have wrote a easy python script;
if x == 1:
a=y
else:
a=z
when the value is 2 everything is going well, but when the value is 1, except of using 11, it is using 11 two times. when I delete the input z it is working, but with the z input it is not working.

I have tried a lot of things but i can nog figure it out.

does someone know how te fix this? it is also oke to use normal components

Best regards,

Ruben Schmitz

Hi.
Is that a custom python/VB/c# script?

You didn’t attach your code or your .gh file, so i’m just guessing by your description and picture.

If you are loading inputs as single objects, because you have 2 objects in z input, your whole script will run twice! And that’s why you see twice your output.

You need to set input as List!
See this:

1 Like

1 Like

Hi Riccardo,

Thank you very much, This was indeed the problem!

It is working right know!