No announcement yet.

Find matching elements in lists

  • Filter
  • Time
  • Show
Clear All
new posts

    Find matching elements in lists

    I'd think this would be something straight forward, but I'm having a lot of trouble making it work. I've got 2 lists of elements, one from a linked model and one from the local model. There are many common elements between them but there are also a few that exist on each side that aren't in the other, and since the outliers can happen anywhere, a straight comparison isn't working. I'm trying to generate a list showing just the matching elements so I can pull parameter settings from the link into the local elements. What's the best way to go about getting this compiled list?

    Hello Chris,

    Have you tried the SetDifference node?

    Attached Files

    Sol Amour

    Architectural Explorer, Digital warrior, Affectual adventurer and Curious Human Being
    Portfolio Website @ Cargo Collective


      Hi Sol,
      I had tried Set Union and == with cross product, but I don't think I tried Set difference yet. So is the idea to pull those out and use them to filter each list down to the same values? That seems like it could be a simpler way to do it. I'll give that a try and see what happens. Thanks for the suggestion.



        I think you may want SetIntersection. It will return Items which are in both list. You can see link below on the dynamo dictionary for a better explanation.

        Dynamo Dictionary

        You should take a look at SetIntersection, SetDifference, and SetUnion. They are very powerful nodes.


          Grid filters.PNG
          I was able to get the list I was looking for with 2 Set Difference nodes, but it looks like Set Intersection does the same thing in 1.. thanks for the tip. I'm still very new at this so it's a lot of guessing and googling. My next question to actually make this functional, is what's the best way to get the list of elements from this list of keys? We have a series of checkboxes on our gridlines here for visibility control (major, minor, demolished, area 1, area 2, etc) and I'm trying to automate a way to sync those checkboxes across linked models.


            what's the best way to get the list of elements from this list of keys?
            If these keys are the Names of the grids, you could simply use ElementFilter.ByName from Beaker


              Grid filters2.PNG
              I got it working. I did end up using the Set Difference node with a filter by Boolean mask. Once I got the lists of grids lined up the rest wasn't too bad.
              Thanks for all the help! I Definitely needed that push in the right direction.


              Related Topics