List creation for room elements

Hi All

Any help would be appreciated :persevere:, I just cannot seem to figure this out, (named the rooms so that it matches the number of elements i have in it for testing) So i have 4 room, each room has one more item, so im sitting with one list that has the four rooms and another that has the 10 elements broken down in sub lists, I just cant seem to be able to join them.

End goal is to export it to excel so it reads the room number and the element per row, so it would list a rooms name the same amount of times there is elements in that room

It would be easier if your list lengths matched. Then you could just add each item together.

Appreciate the help Nick

I can’t seem to that as I’m using actual rooms, or is my brain fried :sweat:

Here are the files (REVIT 2016)
script is run from rooms file

TESTING.xlsx (7.7 KB)
Rooms.rvt (1.0 MB)
Dynamo.dyn (13.0 KB)
Components.rvt (1.2 MB)

It shouldn’t make a difference. Plus, you don’t seem to have the rooms in your final list if I’m understanding correctly. Is my flattened list what you’re looking for?

If I understood your problem correctly, you could use Python simply like this:

rooms = IN[0]
elements = IN[1]
output = []
for room, element in zip(rooms, elements):
	output.append(room + " has " + str(len(element)) + " elements")
OUT = output

Hi HozzZam

This give me


I’m looking to export to excel and get the following


want to export to excel so that I get


So you could just do what I originally showed, but flatten your final list @L2.
You only need to convert the Revit elements to strings (name, family, type, etc).

Hello. You can try this python script:

1 Like

Sorry Nick, maybe I’m not following you, the number of rooms will change, its only 4 in this test file, and don’t want to manually enter that

I never did anything with the number of rooms. You can use Count if you need to get the total number of rooms.

You get your rooms and the elements inside them. Than you just need to make sure that your list lengths match so that every element has a room to go with it.

Hi tiagocorradi

getting there :grinning:



1 Like

They need to stay as sublists.


and its done

Appreciate the help

1 Like