hello dynos,
I want the numbers shown as in Revit.
Dynamo does hide ceros and not representing the numbers as shown.
How can i deal with that?
KR
Andreas
hello dynos,
I want the numbers shown as in Revit.
Dynamo does hide ceros and not representing the numbers as shown.
How can i deal with that?
KR
Andreas
Math.Round(number, 3);
I’m lost… which number isn’t displaying as you want, and where are you looking to display it?
it has 3 digits! 0.000 becomes 0
Final aim is to convert them to strings an at it to the name
thats the units in Revit… Dynamo is doing it own stuff
String.FromObject after the three digit rounding should do the trick. You can then either add zeros via pad left, or take the Substring to stop at 3 digits last the decimal as needed.
how to deal with +/- values i think i have to do some clever sorting if “-” do it in a other way
I would recommend getting the index of the “.”, and counting 3 digits after that.
This may help:
str;
indx = String.IndexOf(str,”.”);
frmtdStr = String.SubString(str, 0, indx+3);
Untested as I am not at my computer. If you’re still stuck when I get to it in ~30 minutes I’ll post a confirmed fix.
That sounds good… minwhile i continue
Python would probably be quicker at this point. You can round and then set the number of trailing zeros with this method.
nums = IN[0]
out = []
for num in nums:
n = '{:.3f}'.format(round(num,2))
out.append(n)
OUT = out
That would be almost the solution, but for any reson dynamo writes 3- insteat of -3,
i think multiply strings is not the way
You’re multiplying by a negative so you’re getting the strings backwards. You would just get the first x
substrings instead, starting at index 0.
I sense a speed race!