algorithmic modeling for Rhino
Hello, just looking for hopefully some list management help.
I have a list of curves such that a panel reads...
{0,0,0}
0 curve
1 curve
2 curve
3 curve
4 curve
5 curve
6 curve
7 curve
8 curve
9 curve
10 curve
11 curve
12 curve
13 curve
...and I'd like to rearrange the order in which the curve are listed, to something like this:
{0,0,0}
0 curve
1 curve
8 curve
9 curve
10 curve
11 curve
2 curve
3 curve
4 curve
5 curve
12 curve
13 curve
6 curve
7 curve
I hope this makes sense.
Thank in advance for any advice,
John
Tags:
Hi John,
is there any logic to the new order? Or is it an arbitrary order?
If the latter, you can use sort to modify the list, you'll need to create a list of number that -when sorted- would result in the desired order.
0 = 0
1 = 1
2 = 6
3 = 7
4 = 8
5 = 9
6 = 12
7 = 13
8 = 2
9 = 3
10 = 4
11 = 5
12 = 10
13 = 11
Where the first number is the index and the second number is the actual sorting key. Then you sort these keys while sorting your curves in parallel using the A input of the Sort component.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Hi David,
Brilliant, thank you so much.
John
With the list item you have to provide exact integers. Sorting works with floating point numbers as well as integer lists with gaps or even duplicate values. It's just a generally more flexible method, but yes, List Item would work just as well in this case.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Hi David,
And what if I want to do the first option? Because need to loft two groups of curves by pairs but the lists are all mixed up, and what i need is them to recognize that one curve that they intersect
with (if i extrude them) in the Z axe and make a loft between them.
These are the lines and their lists.
And this happens whenever i try to loft and how they tend to connect if i graft it:
How can i re-organize the list like that?
Thanks!
Azul
i solved it! Something was wrong with that list, i guess i messed up the code cause i found an older one with the right order so i used it and I grafted the list so the loft could run.
Thank you !
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2023 Created by Scott Davidson. Powered by