Asynchronous sort/group function

Hi

I have a bunch of rooms and a bunch of doors where the data structure matches. I am grouping the room by ID. I want to be able to asynchronous sort/group the doors so that the data structure matches. How can I do this?

 

Sync

Solved. I discovered Clockwork’s list.sortListOfLists and List.GroupListsByKey nodes which did the trick.

 

http://dynamobim.com/forums/topic/sort-list-by-index-or-keylist/

 

Sync fix

I spoke too soon! I am trying to sort doors within a room. I have some nested lists. One for parameter at point. Another for rooms. And another for doors. I need to sort the parameters at a point, while asynchronously sorting the door and room lists.

If I use list.create and the list.sort function, it sorts the nested lists differently - by ID for the rooms and doors, and by value for the parameters at a point. This isn’t helpful.

I tried Clockwork’s List.SortListOfLists but becuase it is a nested list, it doesn’t have the desired outcome.

If I use sortIndexByValue and the List.GetItemAtIndex, rather than matching values (as the data structure is identical) it does a cross product and I end up with too many values.

There must be an easy way to solve this but I’m stuck. Any thoughts?

 

ListOfLists

Hi Paul,

A question:

Do you want to sort the parameter at point list and let the room and door list follow the same order, like this?
schedule

 

or do you want to sort the parameter at point in one order and the room and doorlist seperatly?

FlattenSortAndChop

Record the lengths of your sublists, then flatten. Next, sort by parameter first, then by room. Lastly chop up the flat lists into nested lists again. All custom nodes are from package Clockwork.

Hi Martin - you table is correct. I wanted to sort all lists together.

Andreas - I tried your method but couldn’t get it to work (refer below). It is almost working but its not predictable. Some of the final lists are sorted, some are not. What did you use as input for rooms? Where they actual rooms or room names? I’m wondering if this is the cause of the problem?

In the end I wrote a custom python node that sorts sub lists. I will publish it to the BVN package. Along with the full renumber doors by rooms node.

 

Sublist sort

Paul, I used a string for the rooms. Sorting by Revit elements will indeed not work - use name or ID for sorting.