Push Room Numbers to Elements in Rooms

I am trying to get the Room Number from a list of Rooms into the Comments (or another text parameter) of a sub-list of elements.

I used the “Family.InRoom” node (thanks Peter Kompolschek) that works great, but I need the element instance (not the family type) to access the Comments parameter, which is why i used “Elements in Room”.

Element.SetParameterByName will work for a flat list, but how can I efficiently push this information into the elements in a sub-list? The elements in red need to have “G-025” and the blue need “F-005”. A push in the right direction would be great as the funnelling of information in through Dynamo would help me in all other projects.

I’ve attached the test file and dynamo script.

 

Room numbers to Comments-2014revit

Looks like this might work with List.Combine.

If not: repeat the room names as many times as necessary (using List.Count and List.OfRepeatedItem and some List.Map magic) and flatten all three lists before feeding them into Element.SetParameterByName.

Is this what you need?

I used a python script to create the same list sublist structure

first in is the list (with sublists) of families(output from “element in room” node which doesnt work for me), second in is the number value of the rooms

python node

python node

 

 

 

 

 

 

 

 

 

 

 

 

Thanks for such a quick responce Andreas Dieckmann & Martin Bijsterbosch,

I was talking with Peter Kompolschek and he pointed me in the right direction with the List.OfRepeatedItems, combine and count nodes, like you suggested Andreas. I think what you did Martin with Python was the same result but in two combined lists. I’ll open the Python node and look under the hood and try to figure it out (I’m learning python(slowly))

Attached (image) is the solution I found to be simplest for this situation, although not the most robust! Red outlines my use of the new nodes. I knew I’d no more the 150 elements in each room so i just repeated the room number by 150 for each sub-list and then transposed to keep them in the same order as the room elements index list. Green outlines what I required in the lists to transfer the numbers to the corresponding index of the elements.

I’ll have a look at the more complicated but probably more useful use of Combine, list.ofrepeat and count nodes when I catch my breath!

May this forum live long and prosper!

Thanks again all.

Number to comment in list 2

Hi Did you manage to get it working ?

i’am trying to do the same, but don’t seem to have eny luck to get it work yet.

Hi Kasper,

Below is your luck. Understand the workflow how it works!!

Good Luck!

Untitled

1 Like