By converting it into a string, Dynamo adds me some extra digits.
Can I remove them in Dynamo or in Revit?
By converting it into a string, Dynamo adds me some extra digits.
Can I remove them in Dynamo or in Revit?
You can use the split node to split the string by , for example. Or you can use the string remove node
How does that look like?
There’s a node in the Data-Shapes package names “Number to Rounded String”
Where is the Solution without Digits?
0 for incoming for Crumple String.rounding node at digits level
and 6 instead of 4 in the code block for the remove solution
Cordially
christian.stan
You can use the Number.ToString node from Springs or do it in a Python node in different ways(I prefer the one below):
Use some magic with regex, if 1,23545 is input or 1,323443dadwa ![]()
input = IN[0]
import re
OUT = re.sub(r',.*', '', input)
With input is 1.3565 or 1.4343dadawdwa
input = IN[0]
import re
re.sub(r'\..*', '', input)
For information, rstrip method can accept multiple characters as argument
You can also fix this by just converting the number to an integer. Math.Floor (or Ceiling) will work. This happens when the number is a double and the string includes the trailing zeroes.
Love the options everyone ![]()
I didn’t know that, but it would still make a 20.000 into a 2, wouldn’t it?
Correct, thats why i would just use python’s round() function and turn that into a string.
good catch, I didn’t consider this case, so it doesn’t work
Thank you!!!