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)
I also made this but I dont know what I am doing wrong…
sort_of_list1.gh (3.1 MB)
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)
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.
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 .
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?
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 .
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#…
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
Thank you very much Baris!
Have a nice day at work!
I just tried and got different outputs, I still dont understand why.
sort_of_list.gh (9.2 MB)
Do you mean this? The different values between first and second 2 solutions?
To tell the truth I don’t know too. But thank you very much for the working two.
Hello, I am looking for a way to sort curves based on two data, lengths, and heights. For instance, my sorting list should start with the curves which have the lowest Z value, and then inside of these curves, I want to sort them from the longest to shortest lengths.
Is there any way to this this without writing a code?
Yes! Since no recursion is requiered, this can be done easily in vanilla GH.
Doing that kind of stuff(manipulating datatrees) I personally prefer do it via code, since it’s easier to read/understand for me.
You might want to flatten the output looking at your image(why would you want to have them in this order ?)
File:sortGeo.gh (11.4 KB)