Grasshopper

algorithmic modeling for Rhino

# How to select the surface with the highest area from a list?

Pregunta%20foro.JPG

Hello, complete newb here.

I'm having a little trouble with this definition.

I need to select the surface with the highest area from a list of 12 surfaces, I can manually input the value into a list item (in this case 7) but I need a way to evaluate the list, select the item with the higher area and return the number 7.

The problem is that if I sort the list and reverse it I could use the 0 value, but that's not the position of the surface in the original list.

Sorry if this is a stupid question but I can't figure it out.

Views: 4835

Attachments:

### Replies to This Discussion

1. Compute and negate all areas (so the largest area becomes the smallest area).
2. Sort all areas.
3. Sort all surfaces synchronously.
4. Get item 0 out of the list of sorted surfaces.

If you don't negate your areas, then you need to select the last item out of the list, which can be accomplished by using index=-1 and wrap=true

--

David Rutten

david@mcneel.com

Tirol, Austria

Hello David, you rock!.

Sadly I can't make it work.

I can't sort my surfaces to be in synchrony with my area list, If there's a way to sort a surface list by using the areas as index I can't figure it out.

Maybe I'll just input the value manually every time.

Thank you!.

--

David Rutten

david@mcneel.com

Tirol, Austria

Attachments:

Thank you David! you are the greatest!, It worked like a charm!

Just googled up this post of yours. Amazed how useful this is. Thank you!

Ok, awesomely simple . . . Thank you once again!

Cheers!

Very useful and simple. Seven years later, this response is still relevant for people who are learning. Thank you!

by June Lee

• View All