Grasshopper

algorithmic modeling for Rhino

Hi,

can somone tell me how to reduce the decimal places of the values in a list?

I have a list of xyz-values up to 6 numbers after the floatingpoint and would like to reduce that (like i do in the settings of the number-slider).

 

Does anyone know?

Thanks, Christopher

 

 

Views: 23496

Replies to This Discussion

you need to pass the points through an Fx component where the function is:
format("{0:0.0##},{1:0.0##},{2:0.0##}", x.x, x.y, x.z)

where {0} is the place holder for the first variable x.x
0.0## is the desired number format at least 1dp but 3 if significant

Hi,

could you send me this gh-file so i could take a look and find out how it works ?

(sorry, your explanation looks difficult to me - i was never good in math)...

If you cannot open the file all you need to do is to paste this:

format("{0:0.0##},{1:0.0##},{2:0.0##}", x.x, x.y, x.z)

 

into the expression field of the F input of an Fx component.

Attachments:

GREAT :-)))

 

Thank you...

Hi Christoph,

 

you can use an expression to round to a fixed number of decimals (see attached). 

I should probably add a component specifically for this though.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

hmmm... couldn't open the attached file.

You'll need 0.8.0050 or newer to open that file.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

what if I want to transform 2.8 into 2m not 3

Thank you for the qiuck response. I hope i'll manage that...

 

1. Math > Script > F2

2. Panel > Round (number, decimals)

3. Rename x to number and y to decimals

 

 

Looks good, but this would not work with string values from a panel (runtime error: function Round is undefined for parameters: String  double).

 

send your file and I´ll give it a try.

Best, Peter

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service