Grasshopper

algorithmic modeling for Rhino

Hi

I'm looking for the lightest/quickest way to see if just one item in a list is true.

as it is for now, im using the "average" component, to see if my average is above 0 as seen below:

I'm just thinking if this can be done easier using script. This is currently 1% of my data, so the calculation time is important. I've tried with mass addition instead of average, but MA is slowerl.

Best, Mathias

Views: 3801

Attachments:

Replies to This Discussion

What if you sort the list and get the last item?

Or

(I am not sure if any of these are faster that you current solutions)

Hi Sridevi
Thanks for your answer. I used to use sort and item 0, but that one is even slower. Then I tried the mass addition and average. I will try the dispatch tomorrow, cheers!

just FYI:

Tried dispatch and cull, all of them are slower than the average function.

Processing times with my list:

Average: 10s

Mass addition: 20s

cull: 20s

dispatch: 2min

Maybe a VB script can do it better.

Ah too bad. I tried the following lines in C# script components, but they take much longer

x.Max() which returns the maximum value in a list x

x.Contains(true) which checks whether a list x contains the value "true".

But it is possible that the script components are slower since they have to build the code first, as opposed to custom components for Grasshopper which are build in Visual Studio first.

In the meanwhile, I tried out the FSim (Find Similar Member in a set) component to look for "true" on a lot of sublists, that seems to be the fastest for "my" test case.

Btw, you should move this post from Sample and example files to General Discussion, then you might get more responses.

This is my take on it:

Join all three numbers as text and then convert them to a number you will either get 0, 10, 11, 100, 101, 110 or 111.

Only if the result is Zero then none of the results are true.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service