Sort a list of curves

unhandled

(Coker-0ne) #1

Hello guys!

I have a number of contour lines and I want to make two different lists from curves. The selection I want to be with step 2 which means 1st list I want to consist of 1,3,5,7… curve and 2st list of 2,4,6,8…
For achieving this I thought to use 2 series components with step 2 and different start curve. My problem is that the curves are not sorted in the list and I would like to be sorted by the height from the 0 (Z-axis distance). Another problem I have is that for a specific distance on the Z axis, for example, 5m maybe there are more than one curves that must be at the same index on the list in order to work correctly the series. Is there another way to do that? If not how can achieve this sort of curves?

sort_of_list.gh (3.1 MB)

Thank you


(Coker-0ne) #2

I also made this but I dont know what I am doing wrong…

sort_of_list1.gh (3.1 MB)


(Amir Habibi) #3

Yellow Coker-0ne !!
All you need is sort list component to give it a key like (sorted Z values of end points) , and get your curves sorted . Sorted list by Z value.gh (3.1 MB)


(Coker-0ne) #4

Thank you Amir!

But there isn’t uniformity on the selected curves.For example there are selected curves that have one unselected between them and other that have 2 or 3. How can I fix that? I think its because there are more than one curves for a specific z value which must defined as one work as I would like to.


(Amir Habibi) #5

In case you are mentioning what you see => For example you got 2 or 3 curve in same height . So they are listed one after another .


(Coker-0ne) #6

Yeah this is that cause me the problem. Index 6, 7 have the same Z value so I want to be selected both as if they were one curve. Is there any way to do that?

Thank you!!


(Amir Habibi) #7

You can add the even-height curves into different tree branches (In order to do so 1st find the curves with similar heights , then for the main list store the similar ones into branches ) but as far as Iv’e searched there’s not much tool in grasshopper to do that easily . You could reference your 71 polyline into grasshopper (which is boring enough to death) , or write down a piece of code for it .


(Coker-0ne) #8

Thank you very much Amir. I didn’t expected that grasshopper hasn’t an easier way to do this… I suppose that I have to learn C#…


#9

Hi,
when I understand you right, no need of c# here:
easiest would be using assign paths by human-tree frog


But you can also do it by creating sets and using the member index or renaming the paths.
Need to go to work, later if I have time Ill post the native component solution


(Coker-0ne) #10

Thank you very much Baris!

Have a nice day at work!


#11

I just tried and got different outputs, I still dont understand why.
sort_of_list.gh (9.2 MB)


(Coker-0ne) #12

Do you mean this? The different values between first and second 2 solutions?


#13

Yes.


(Coker-0ne) #14

To tell the truth I don’t know too. But thank you very much for the working two. :slight_smile: