Grasshopper

algorithmic modeling for Rhino

how to create a new list by using another list as filter?

suppose I have the following 3 lists A, B and C.

I want to create a new list D. For each item in this list, I'll use List A as filter to grab data from either list B or C: If an item in list A is "AC", then we will grab a value from list B and put it in list D, if an item in list A is "NC", then grab a value from List C and put it in list D. So, the results will be like the following.

May I ask how to do this list operation in GH?

Thanks!

Views: 1084

Replies to This Discussion

Hello,

this could be a way

best

alex

Another one.

+1

Dear Alex and Hyungsoon, thank you very much for your advice!

Yes, I also figured out to use the expression component to do this as shown below.

One thing to remind is that if the data in List A is Boolean (true or false) values, the expression shall be stated as if (x=True, y, z), rather than if (x="True", y, z), i.e. don't use the double quotation marks for Boolean values for the evaluation.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service