Grasshopper

algorithmic modeling for Rhino

what is the easiest way to filter and output the largest of a list of numbers in a panel?

Views: 4182

Replies to This Discussion

u can for example sort the list ("sort list" component - it orders the items in the list from the smallest to the largest) and then pick the last item through the "list item" component
thanks!
i will test immediately
works fine with one exeption:
the numbers are sorted in ascending order, but as i need to select the largest item (at index0) i need descending order.
how can i manage this?
thanks again for your help
you need three components, sort list component, then reverse list component, and then your index number will be 0 when you use select component.

i dont have GH on this pc so I can't check it, but look in the function component, there might be a Max option, but I am not sure now.
perfect, thanks!
theunis is right u can reverse the list and then choose the first item, but u can also just plug a "list lenght" component (it returns the number of items in the list) and then write in the expression editor tab the expression "i-1", as u can see in the picture
Attachments:
also nice.
thanks!
Sounds like you've got it, but here's an alternate method.

nice method!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service