Notifications
Clear all
[Closed] Decimal Place
Sep 11, 2009 4:05 pm
Is there a way to chop a string value in Maxscript or a Float value to one decimal place.
E.g a float number 1.2345 to a value of 1.2 ?
I’ve done it so far by collecting the first three characters from a string and creating a new string from that but couldn’t find a build in function or way of chopping a string.
Thanks in advance…
4 Replies
Sep 11, 2009 4:05 pm
Couple easy ways:
local num = dotNetObject "System.Double" 1.2345
local decimals = 1
local result = ((dotNetClass "System.Math").round num decimals) as float
print result
local numstring = "1.2345"
local strNum = (substring numstring 1 3)
print strNum
That dotNet method does rounding also.
Sep 11, 2009 4:05 pm
Hi hotknife,
take a look at FormattedPrint in MaxScript Reference. It provides a lot of options.
- Enrico