Jump to content
Sign in to follow this  

Round the value in the font node

Recommended Posts

thanks, it helped a lot, now everything works for me

concrete - `{
    float val = detail("../volume", "volume", 0);
    string whole = ftoa(int(val));
    string fract = ftoa(frac(val));
    fract = substr(fract, 2, 1);
    return whole + "." + fract;
}`  m3



Share this post

Link to post
Share on other sites

here's mine, non-coder method...you can adjust decimals on the fly (which I think you can with your scripted method too)

Example float 123.45678

01) int(123.45678) = 123

02) 123.45678%123 = 0.45678

03) 0.45678 * pow(10,n) gets n decimals to become 'integer' part (rint is to round the integer)

04) answer is part01.part03



Edited by Noobini
  • Like 1

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this