Reorder list/items with a rule

Hi all,
I select bunch of lines from revit and they came with a mixed up numbering.
I was wondering if i could reorder this lines (based on proximity maybe) , starting from left to right or vice versa.

item 78 and 91 are in the same place?

yes, a duplicate line in same place. i will delete it .thing is when i use " reorder" node, it give only 1 point not the full list.

first thing that comes to mind is to give the reorder node the full list
replace 79 in the code block by 0…91

Never tried it myself tho

Marcel

Try List.Sort

In this case, if you’re using proximity for sorting, using Geometry.DistanceTo could be useful.
Hope it helps!

2 Likes

Geometry.DistanceTo or the X (or Y) value of a point on the line should work. The important part is that you use List.SortByKey to sort the curves by some value.

What selection method did you use? Selection by Spline is a good option for something like this if it’s a ‘one off’ and is useful for other stuff too (IE: renumbering elements). Draw a spline as a model line in your project and you’re up and running in an instant.

Thank you that graph worked like a charm. may i have a second question about listing? i also need to organize my list (lets say 90 items in it) like this : (0,1,2,3) , (1,2,3,4 ) , ( 2,3,4,5 ) and so on. i tried “chop” node but result is (0123) , (4567) …

Welcome to the wonderful world of levels!
I think the first two nodes recreate what you mentioned. Try messing around with the levels option on your List.Chop node. As you can see in the image below, changing the level of the chop affects which list, or list of lists is getting chopped by the given amount.

The bottom example with no predetermined level will default to the most exterior (@L3 here) and will chop that list.
The top example jumps in to (@L2) and chops each list at that level.
Levels

For myself, once I got a good grasp levels it opened up a whole new world of possibilities for creative and functional scripts.

Good luck!

Dana thank you for your help. i tried a bit with chop but solved it with slice
image

1 Like