Hello!
Making Mark numbers, need 01,02,03,04,05,06,07,08,09,10,11,12,13… instead of 1,2,3,4,5,6,7,8,9,10,11,12,13… what I am doing wrong?
I believe this is a known issue with the display of strings which forces the formatting of the display to what you are seeing. Should be fixed in an updated build.
Try using a String.Join to see what happens if you put a carriage return in between each of the values.
Everyone is overcomplicating this with python in my opinion. Sure the python is 1 line of code, but this can actually be solved with Dynamo nodes only
You have 2 options:
-
Try
String.FromObject
from the Crumple package. It has a built in function to remove trailing 0’s when converting numbers. -
If for some reason you don’t want to use packages, use a
List.Flatten
after theString.Split
. Also make sure to useString.Length
and then use the code block to add 1 to the total string length.
(Like the example above) -
Bonus: I actually use
List.Count
before usingString.Length
. That way you can let the list determine how many 0’s you need in front (say you need 001-100 or 0001-1000 etc)
Hope that helps.
yeah i would just try convert the numbers to integer with floors or ceiling as @sjafarali75 show…guess it should work
Never noticed it’s a way to convert numbers to integer (datatype wise). That’s awesome!
yeah many ways it can be done…Dynamo Dictionary
hi, a
conditionnal
DSCore.Object.Type(a)=="SystemInt64"?
a+"":
Math.Floor(a)+"";
to remove doubts
cordially
christian.stan
are you in revit 2023 ?
2024
As I noted before, I believe you are missing an update so Dynamo is padding the values out but only in the display.
Try joining the values into one string, or writing out to a text file to confirm.
Yeah @jacob.small guess you are right the good old issue i have try to forget
hi,
try this
OUT = [str(int(num)).zfill(2) for num in IN[0]]
cordially
christian.stan