Checking two lists and Writing it to the right Element (rooms)

Hi,
Hope this come out right. :slight_smile: …
I have an Excel list that I have 2 values Name and Number that I am comparing with rooms parameter Name. Then I go through the list an check if the Name is compared with the Revit Name list if so then it should write the name to the rooms Number.

But my problem is when I have found out which rooms are listed in the Excel list, how i write it to the element with the same room name. Or how do I filter out the same elements as I did with the list, where I found out the names compering.

Here is the Python script that I am trying to make.

list1 = IN[0] #Takes inn Excel list values
list2 = IN[1] #Roon Names Value from Revit
elemList = IN[2] #Rooms Elements

mylist = [[],[]]

elements = []

for i in IN[2]:
	elements.append(UnwrapElement(i))

elementIds = []

for i in elements:
	elementIds.append(i)

for i in range(len(list1[2])):
	if list1[2][i] in list2:
   		mylist[0].append(list1[2][i])
   		mylist[1].append(list1[4][i])


	

#Assign your output to the OUT variable.
OUT = mylist, elementIds

Hope that there is some understanding of this. Quite new at Dynamo and Python :smile: Hope you can help :slight_smile:

Regards
Kristjan

So you have a list of room names in Excel that you want to search for in your model and return the room elements matching those names?

I did it with spaces in my example but it’s the same thing.

1 Like

Thank you so much for replying :smiley:

This is way simpler then I thought of it.
I will give it a try.