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!
Thank you
Youâre welcome!
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?
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.
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