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.
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.
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
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!