Convert length parameter to number value

Yes, there is another topic that started off with this question. However they side-stepped the issue.

I would like to create a simple system to convert a Length parameter to its decimal-feet value number.
i.e [Height: 25’ - 0"] becomes [25.0]

This specific scenario: I have a set of RCP trees. I am trying to generate lollipop tree models at these places for a rendering thing. I have managed to get the height of these RCP Trees. However it outputs at “25’ - 0”. I want the Trunk Height to match the existing tree and the canopy ball to be 2/3 of the height. Where it all falls apart is the math part. Dynamo can’t do math on a length type parameters. It returns null each time. My initial thought for a work around was “Just take the first two digits and then string-to-number them.” Problem is some of the trees are only 6’ so that won’t work, and work-arounds are bad. I want a way to just convert 25’ - 0" to 25.0. I feel like there has to be a simple way to do this.

Yes I know Height for Trunk Height is spelled Hight. That’s a house keeping issue for another time.

Revit.Revit RCP Tree to Lollipop Partial Code.dyn (417.9 KB)

Tree Sandbox.rvt (888 KB)

1 Like

Share an rvt with the families in question.

Updated the post with a sandbox model.

Thanks. Hard to recreate the issue without this.

Posted a copy of that part of the script. It’s a little different than the picture, but effectively the same code.

Found the Solution. The Node “Parameter.Value” Will return the parameter as the correct value.
Gotta love those 1 node solutions.

You probably should just be using GetParameterValueByName in the first place, instead of ParameterByName.

1 Like

Agreed - this will be much faster and direct. No need for finding the parameter, just get the value directly. :slight_smile: