Adding digits question

Hi, I am using this script to renumber my rebars, my question is, Is there a way that dynamo can get the numbers 1 – 9 to show two digits, so for instance 01, 02, 03 etc… ?

Renumbering.dyn (11.8 KB)

Here is one way:



Hi Einar, once again thank you for your input. I amended my script to how you advised but now the python code is giving me an error:

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 20, in
Exception: The best overloaded method match for ‘Revit.Elements.InternalUtilities.ElementUtils.SetParameterValue(Autodesk.Revit.DB.Parameter, double)’ has some invalid arguments

any ideas how to fix the python code ?

Renumbering.dyn (14.4 KB)

It’s all about data types. Your parameter is set to be a decimal number (double) and to get the padding you need to convert it to string. The solution is to change the parameters data type to text.

Apologies, I’m a beginner with Dynamo. The Revit parameter is an integer type, can I not change the data type in dynamo?

Not if you need the leading zeros unfortunately…