Reorder a list

Hi all.

how do you reorder(sort) a list according to some value in an another list?

I’m trying to get roomnumber to count according to x/y axis.

Initial Room Order

20160515-1a

Run definition

File: RenumberRooms.dyn

20160515-1c

Room order after running above definition

20160515-1b

1 Like

Hi Vikram,

I’m trying to understand your graph

What makes the numbering go across then down (as opposed to down then across) ? I would have said sorting by Y (reversed) would go down first

thanks

Andrew

Hi Andrew,

Can control the sorting by both X and Y (or vice versa). Just got lazy :slight_smile:

In the above example, to have better control, the sorted list can be sorted again (the bounding boxes will also have to be sorted in parallel)

Hi Vikram.

I have try that and it works when i got 1 list.

But when I got lists in a list(it this called sublist?) I can not get it work.

Se picture. My list(problem) is the list with green number inside.

 

Assuming that the list and key have similar sub-list structures, instead of using the List.SortByKey node, in a code block type List.SortByKey(lst<1><2>,key<1><2>); and feed in the list and key.

You might also find my post in this discussion helpful.

Hi Vikram

Have been trying to adapt this for numbering foundations elements from left to right. It appears to be numbering right to left instead. Is there something I am doing wrong?

thank you Vikram, your routine helped a lot

Hi!
I’m having the same problem. Did you fix it?