I’ve been doing some work with the Revit API through the Python node to schedule some parameter values, and in this case steel tonnage. I’ve opted to use Python instead of vanilla Dynamo since I need to be able to get a parameter value regardless of whether it’s an instance or type parameter (as well as some other reasons). I am working mostly with models which I didn’t author myself, so simple solutions such as adding my own parameter won’t work. The particular problem I’m having is being able to calculate tonnage given a beam’s length and weight (in lb/ft). Most steel members have their weight as a type parameter called “W”, which is a number, however one particular family instead uses a “Nominal Weight” parameter, expressed in lbf/ft.
To get the parameter’s value, I am using the following method:
I understand that the AsDouble() method gets the parameter’s value as a double in its default unit of measure, which is to say that if I am working with a model that has meters as its default unit of measure for length, the AsDouble() method would still return the length in feet.
The nominal weight for this HSS tube is 10.7 lbf/ft, which is what shows up using only Dynamo, but Python instead returns a value of 156.1547614. Does anyone know a good method to get a value which matches what is being displayed in the type properties? A workaround might be to use the AsString() method, split the result by a space character and cast the first value as a float, but this might not be reliable for other parameters.