Grasshopper

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.

John

Views: 15727

### Replies to This Discussion

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

Hi David,

Brilliant, thank you so much.

John

Is there a significance for sorting the list in this way over using the List Item Component with a panel of numbers in the order you require? 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

Thanks

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

Attachments:

file???

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 !

How to create a list of numbers ?

Do I use a panel for that?

by monicca

by kgm

by kgm

• View All