Grasshopper

algorithmic modeling for Rhino

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: 35705

Attachments:

Replies to This Discussion

thanks also from my side :)

Hi Chris,

You can do this easily by making a function that formats doubles

Private Sub RunScript(ByVal x As Double, ByRef A As Object, ByRef B As Object)
' You can do it by chopping the numbers off like below
A = Format(x, "#.0")

' or by rounding the numbers like below..
B = Math.Round(x, 3, MidpointRounding.AwayFromZero)

End Sub
thanks Eric excellent

Maybe I ask basic but how do I find what is parameter name?

this function does not work as can not recognize Num...Panel does not work as well...


Hi Michal, all expressions now use x as variable, so Round(x,3) is what you want.

Hi all

Does anyone knows how to get the decimals rounded by, say, 0.05?

for these sort of situations:

101.54 to 101.55

10.98   to 11.00

It's the same answer as outlined above.

Number to round --> (A)Division

0.05 --> (B)Division

#where 0.05 is the amount to round to

Division --> Round

Round(N) --> (A)Multiplication

0.05 --> (B)Multiplication

Multiplication --> Results

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service