Jump to content

# 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

##### Share on other sites

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

Edited by StepbyStepVFX
##### 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

##### 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
##### 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

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×

• Leaderboard
• #### Support

×
• Create New...