String numbers to Numbers with Dynamo


Question of concept of numbers in Revit.

I am a bit curious what happens with the numbers when you get them initially in string format and you convert them into a number, because for small numbers, they appear displayed as 2*E^-10 for example and if I introduce this number into a Revit parameter which is a number it is displayed in same way, so not sure if that number is a number or just a text, not sure if I could sort a schedule as ascendent or descendent with those small numbers.

All of Revit parameter have “Type of Parameter” option so it can’t confusing…
If the Type of the Parameter is ‘Text’, the value can’t be ‘Number’, and vice versa.

1 Like

I know that for sure, but even being a number parameter, not sure if how the numbers displayed are an issue when you read in screen a number ending in E-12 for example. I am expecting that for example a number displayed as E-12 is lower than 1 in a schedule, so if I export to Excel for example I cannot sort by number I think, I would have to export a number like 0,000000000000001 instead of 1E-12.

In resume, by default all is a string, but if I want a number in Revit, the input needs to be a number, although it is displayed as scientific number when converted into a number, but if I want the number in a schedule not inside Revit, I think I have to make it work with full decimal numbers displayed instead, but maybe I am wrong, it is just a perception of behaviours with numbers

Excel should sort the number without issue, as it too should know it’s a number. That said this is a general Revit question in regulars to how your units are displayed. Check the project units settings and if that doesn’t work you may get better answers over on a Revit forum.

1 Like

My ideal is use some code python scripts, multiply it to a large number and sort it, like this, or give it and convert again.

from decimal import Decimal
import math
lst = IN[0]
nums = []
for i in range(len(lst)):
#example if you want convert 
value = float('9.81E7')
OUT = sorted(nums, key=float),value