Sorting sub-lists while maintaing list structure

Hi All,

Is it possible to sort sub-lists without affecting the previous sorting of the list structure?

In the example below I have collected the floor finish elements and extracted the room name, room number (populated using RIE.Point.SpaceAndRoom Node) floor finish area, floor finish description, specification clause and floor finish colour. Some rooms have a single floor finish while some have multiple floor finishes.

After creating a list of the collected data and using List.Transpose I have each floor element with 6 values, I have then grouped and sorted the list by room number to give a list of rooms at level 3 and the floor finishes for the given room at level 2 which is the list format I would like to maintain.

What I would like to do now is sort the list at level 2 (floor finishes per room) by the floor area for the rooms with multiple floor finishes to give the primary (largest) floor finish at index 0 at level 1, secondary floor finish at index 1 at level 1 etc… All of my attempts thus far are rearranging the original list structure. Is this possible?

Any help would be much appreciated!
Dave R

Hi,

I think sorting the areas of the finishes before grouping by rooms might do the trick

home.dyn (19.1 KB)

Another way by sorting after grouping by room : (might correspond a bit more to what you asked)

home2.dyn (18.9 KB)

1 Like

Mellouze,

Thanks very much for your quick reply, your second suggestion done the trick perfectly. I wasn’t aware that you could use the ‘get item at index’ node in such a way as to sort the list by its given value.

I may be out of my depth for my next list management issue and might need to start a new thread but here goes… I would like to combine the list of floor finish elements which are grouped by room number @L3 and finish instances @L2 with a separate list of rooms elements by the matching room number to be able to set parameter values in the room category.

Having a look through some other posts on the forum, I believe I either need to use list combine or list create to collect the data together, then list map with a function in some form to format the list by the room number. I’m not too familiar with using list map to access sub-list so if anyone can point me to a similar post or in the right direction it would be much appreciated.

Match%20and%20combine%20floor%20elements%20with%20room%20elements|638x499

Thanks

Dave R

Hi Dave :slight_smile:

Could you please provide a sample of your inputs and the expected output (even written by hand, the best you could do is to write it down manually on Dynamo) ? That will be easier to understand what you want at the end.

Hi Mellouze,

Thanks for your help on this. The ultimate goal is to create room data sheet in excel by populating various worksheets in a single excel file and use macros to read the separate worksheets (room, door, window, furniture and plumbing fixture data) and create a room data sheet per room. However, during this process I would also like to populate instance text parameters in the room category within Revit to create a room finishes schedule.

I’m currently at the point where I have got dynamo collecting the modelled floor finish elements directly from the model with their associated parameter data (we usually manually input this into the room text parameters to create the finishes schedule), but I now would like to use this data to populate the text parameters in the room category. I therefore think I need to combine the list to create a list of rooms with a sub-list of the floor elements for that room. I think I can then set the room parameter using the collected data from the floor elements.

Its quite a tricky one to explain as I’m trying to do multiple things in a single graph and the graph is getting quite big to be able to condense into an image to post on here. Attached is my work in progress graph which might make the above a bit clearer and a snapshot of the room parameters I’m trying to fill out.

Dynamo_RoomDataSheets.dyn (66.9 KB)

Apologies, think that was an oder file. This is the latest version…

lDynamo_RoomDataSheets.dyn (171.2 KB)