Filter list by multiple items

Hey all,

This is the logic i’ve come up with for filtering a list by another list.
I’m fairly new at Dynamo and looking to see if there is a simpler solution?

Idea is to collect all family types from the Revit filter the list by selected objects.
I’m not sure if using list.cycle is a smart solution on large projects as the original list may be quite large.

Cheers,
Josh

Figure a way using List.Map

A colleague showed me a way using Indices

I’m interested to see if anyone has another solution?

Have a look at List.ContainsItem …

cheers. Works the same as the list.map method

Isnt it just either GorupByKey or SortByKey you are looking for?

@JB86 Not really.

  • For one, it’ll use up less nodes. A lot less nodes. Compare the below graph to any of the graphs in this thread and it should be obvious. You were asking for a simpler solution, right? Well, this is it. :wink:
  • Secondly it is not limited to strings. In your initial post you said, you were going to filter family types. List.ContainsItem works directly with Revit elements.

6 Likes

@Andreas_Dieckmann Thanks heaps mate!

I see now what I did wrong. I had the contains item node connected the other way around…confusing node

Wow @Andreas_Dieckmann, thats an efficient solution… much better than my statement in a code block :slight_smile:

1 Like