Jump to content
Sign in to follow this  
reinforcedcc

Round the value in the font node

Recommended Posts

This is the foundation for the house, at this stage calculate the volume.
Transmitted to the text. There it is necessary to delete unnecessary figures.

fund.hip

01.png

Share this post


Link to post
Share on other sites
Posted (edited)

Check this thread, there may be useful info for you want to do :

 

Edited by StepbyStepVFX
  • Like 1

Share this post


Link to post
Share on other sites

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

fund1.hip

03.png

Share this post


Link to post
Share on other sites
Posted (edited)

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

Fund_decimals.jpg

fund_decimals.hipnc

Edited by Noobini
  • Like 1

Share this post


Link to post
Share on other sites
# Multiline version

V concrete - `{
    d = int(ch("decimals"));
    v = detail("../volume", "volume", 0);
    
    string whole = ftoa( int(v) );
    string fract = ftoa( rint(v % int(v) * pow(10,d)) );
    
    return whole + "." + fract;
}`  m3 

fund_decimals1.hipnc

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  

×