Grasshopper

algorithmic modeling for Rhino

Simple question. I just want to get the 15 greatest values from a list of 28 elements... some of them have the same value though (see image attached)

THX

Views: 1462

Attachments:

Replies to This Discussion

Not using sort list since i want to keep the order of the values obtained

so you want the 15 biggest numbers, but not in largest to smallest order within themselves? Do you want duplicates or no? Can you post your file with the list?

Ok, you can focus on the part that is selected as a group. I want to fit a set of numbers within certain domains that can host them.

Originally I had a list of domains. I sorted them and I picked the 15 gratest values. Then I wanted to give this list the original order so I sorted it back, but I realized that in some cases the domains I obtained where higher than the orginal ones, caz I dismissed the lower ones. So I thought I might consider the whole original list of domains, without sorting it, and pick the 15 highest values (not to modify their indexes). Maybe there is a better way to do that.

THX

Attachments:

Basically, I need to identify the indexes of the 15 highest values within the list

Go it!!! JPG attached

Attachments:

Create a duplicate of your list, sort it, reverse, use List Item and select the first 15 values. Next, pick the final item in that list, its a value you can evaluate against to do this:

 

Now, create a function component and use an if statement: If(a >= x, a, null), where a is your original unsorted list and x is the final value selected from your sorted list. You'll now select the first 15 highest values, however it's going to select more than 15 values if you have duplicate values. You could remove all duplicates prior to this method to solve the problem. If you need them, than you'll need to think about how to resolve this issue 

 

Finally, remove all the nulls if necessary. This should do what you need.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service