Comparing two lists and finding the common entries

Hi everyone,

I have the list of room numbers (list b) with values, that is taken from the Excel file. I want to compare this list with the list of room extracted from the Revit model (list a). After then I am trying to change the color of the rooms using ‘list b’ color. Can anyone please let me know how it can be done?

1.dyn (10.7 KB)

would something like this work? I do not see a built in parameter for color so you might have to change whatever you want the parameter to be.

import clr
from Autodesk.Revit.DB import *
import Autodesk

import RevitServices
input_1 = IN[0]
input_2 = IN[1]
rooms = IN[2]
title_1 = []
col = []
roomset = []
for dex1 in input_1:
for dex2 in input_2:
    if dex2[0] in title_1:
        for i in rooms:
            if str(i.Number) == dex2[0]:
OUT = col,roomset
1 Like

c= [i for i in list A if i in list B]

you can use this line of code to get common values in list A & list B

1 Like

Just check the room number and use a mask. Your numbers will need to be sorted though.


IMO the best way to do this is by using Dictionaries (Springs package):

I have yet to try out the Dynamo 2.0 dictionary functionality but the above should work in any case.