Sort and group based on 3 parameters

anyone a smart idea? I’ve a list of elements that needs to be sorted based on 2 parameters and then grouped based on a third.

  1. sort based on ‘Diameter 1’
  2. sort based on ‘Diameter 2’, but the first sorting function is still to remain and is prior 1
  3. group the same items (based on the description) in order to give them the same ID number

Processing: 2021-11-17_21-51-23.pdf…
Processing: 2021-11-17_21-51-23.pdf…

Hello @merlijn.vanleeuwen ,

Welcome to Dynamo Community,
I think you need to go in reverse order while executing in dynamo,
like group the item first then sort each group based on dia 2 and then over ride the previous sort with new sort based on dia 1 and flattern the list
In this way you gets an out based on sort dia 1 and then sort dia 2 (priority given to first) then group the item based on description.

I did small exercise to your explanation, sort based on comments and marks then group based on data.
you can further modify the script based on you out format.

sort group_Revit19.rvt (1.4 MB)
sort group.dyn (46.0 KB)