Hello, a novice grasshopper user dabbling in math components. As said in title, I have a value that i wish to round off to the nearest Highest value present in a given List. I tried the pufferfish component but it gives the nearest floor value not the ceiling value. I am pretty sure there is an easy solution to this which I am missing. Thank you for your help.
Try the standard Round component that comes with Grasshopper. It outputs among other things the ceiling value.
Post a GH file with your inputs and expected output.
Maybe the teal colored ‘Round To Fraction’ group in this post?
hi thank you for the replies. I have linked the GH file here. The standard round component doesn’t have an input for a custom list as far as I know.
Round to nearest highest.gh (6.0 KB)
I am not sure how u are getting that error. I am using Rhino 7 and have the plugin Puuferfish installed in it if it helps.
I try to avoid threads where no GH/geometry is posted… but keep failing.
Here’s a little Python script that does the trick!
If x is included in L, then F will be equal to x!
Round to nearest highest 2.gh (4.5 KB)
Fooled again! I know better, I really do… NEVER respond to a thread without a clearly stated objective!
Follow up question:
If i want a single output value which is either the higher ceiling value if its not on list or if its on the list the same value. How do i go about making it happen?
Simply like this:
Round to nearest highest 3.gh (4.7 KB)
Thank you very much
Here’s a revised version of the script!
The previous one only works if L is presorted.
Round to nearest highest 3b.gh (4.7 KB)
That shouldn’t be an issue anymore.
Using standard GH components:
Round to nearest highest_2021May11b.gh (7.3 KB)
Looking back on my notes, I do have adding this functionality written, just never got to it. Next time!
Indeed, prolly why this question is in the Puffefish category