Grasshopper

algorithmic modeling for Rhino

# round off numbers?

Hi

I have 2 q's so ive split the posts

how do you round off number such as those in tags?

measurements are in millimeters 0000.00000000000 for a meter

ideally id control it to display the meters (just in the tag)

thanks!

Views: 35416

Attachments:

### Replies to This Discussion

Hi Chris,

if you want to round to whole numbers, just reroute your numbers through an Integer parameter. If you want to round to a specific number of decimal places, then you'll need to use an Expression. Either insert an Expression component or add an Expression to any number parameter.

If your number parameter is called "Num", then the expression should be: Round(Num, 3) in order to round to 3 decimal places.

--
David Rutten
david@mcneel.com
Oh fantastic, thats exactly it!

thanks
Hi,
I need to round off to 5 (15, 20, 25, etc.). I have many results and I fixed Min and Max value and the parameter Integer at the end, but I need also numbers running in step of 5. Which expression I need to use?

thanks

Divide by 5 pass through an Integer Param and then Multiply by 5

Thanks a lot!

I thought this might make a useful GH_User component so here is. It includes Floor and Ceiling functionality like the existing Rounding component.

Just drag the file on to the canvas and GH will do the rest.

Attachments:

Has this got a newer version?

Dude I still want to understand this magic. Cause I use it everyday, but I don't get the maths behind it.

CAn you help me out?

Cheers

Eduardo

What version are you using?

Dave

How do you get grasshopper to ROUNDUP or ROUNDDOWN.... this works in other software such as Revit but I can't seem to find the correct code (or maybe it doesn't exist)

thanks

t

There is a Round component in the Maths Tab > Utility Panel which has three outputs

N = normal, 4.3 --> 4 & 4.6 --> 5

F = Floor, 4.3 --> 4 & 4.6 --> 4

C = Ceiling, 4.3 --> 5 & 4.6 --> 5

Thanks a lot =D