Format number

Good morning,
I’m creating a routine in Dynamo where it slices the solid into layers, takes these layers, and changes the color and layer, placing them on layers where their base and top elevations are specified. However, these elevations are coming with too many decimal places. Can someone help me simplify this?

Math.Round should do the trick. :smiley:

1 Like

Still has many decimal places, fewer than before but still present. I’d like to round it to 2 decimal places.

Hi
Use String.Remove node

1 Like

hello


cordially
christian.stan

1 Like

thx

1 Like

be careful though, if you had a number like this in your data 10000,1250000
here is another possible solution


Python Script:

import sys
OUT = ["%.2f"%i for i in IN[0]]

Sincerely
christian.stan

1 Like

Or you can use the Arkance Systems Node Library, that contains a node to convert a numeric value to a string with a given number of decimals.

2 Likes