User::G2M::g2m_format_numbers

By jack-lee - Nov 9, 2020

COMPOUNDS

Description

This compound converts numbers to strings, with decimal, round, padding, and prefix/suffix. It's basically similar to this Python code: inputNumber = 12.035 outputString = "%0.2f" % inputNumber #result: "12.04" Unfortunately, it is not that simple in Bifrost. so I made this compound. I hope that Bifrost will handle these things easily in the future. more examples: 0 => "0.00" 15.5 => "15.50" -0.3876 => "-0.39" compound ports: numbers: input numbers has_decimal: decide how many decimal places to keep. 0: do not keep decimals; 1: keep one decimal place; 2: keep two decimal places. and so on. default is 2. is_round: whether to round. default is True. prefix: some string before the number. default is "" (empty string). suffix: some string after the number, such as " %", this is the default value. more info: https://forums.autodesk.com/t5/bifrost-forum/the-new-version-of-my-format-numbers-compound-support-multiple/td-p/9853454

TAGS
PRODUCT VERSIONS
Bifrost 2.1.0.0
0 Comments
To post a comment please login or register