<span lang=“EN-US”>I have a Revit project with a simple roof element with two sloped planes (see picture). I’m trying to get the slope value of the roof element so I can use this to perform some calculations, but I ran into some (probably small) issues. </span>

<span lang=“EN-US”>The slope value in this case is 42 degrees. The Element.GetParameterValueByName node however reports a value of 51.584. This probably is a conversion of some sort, but I just can’t figure out where this value comes from, I was hoping someone could explain this to me. </span>

<span lang=“EN-US”>Second question, the LunchBox Get Parameter Value node does report the correct value, however this nodes outputs this in a string (including the degree sign, the small circle) how can I convert this into a float? </span>

For readability purposes hopefully this time without the span tags…

I have a Revit project with a simple roof element with two sloped planes (see picture). I’m trying to get the slope value of the roof element so I can use this to perform some calculations, but I ran into some (probably small) issues.

The slope value in this case is 42 degrees. The Element.GetParameterValueByName node however reports a value of 51.584. This probably is a conversion of some sort, but I just can’t figure out where this value comes from, I was hoping someone could explain this to me.

Second question, the LunchBox Get Parameter Value node does report the correct value, however this nodes outputs this in a string (including the degree sign, the small circle) how can I convert this into a float?

It looks like the String.RemoveAfterGivenCharacter node will do the trick! However I can’t find this node in my library, is it part of a package?

To rephrase my first question, the Element.GetParameterValueByName node outputs a slope value of 51.584 instead of 42 degrees, but why? When I change the slope of the roof element in Revit manualy the node always outputs a different value. It seems like the value somehow gets converted, I’m trying to figure out what this conversion is.

I noticed that for some reason when you’re trying to get the slope parameter value of a roof element you don’t get the correct value. When you manualy set the slope value to a certain value (lets say 45 degrees) the Element.GetParameterValueByName will give you a different value (in this case 57.296 instead of 45). The 45 degree value indeed gets converted a long the way, this is what’s going on:

The 45 degree slope value is stored inside of Revit as an incline value (don’t know if this is the correct English word) which is “the relation between the horizontal and vertical components of the corresponding vector” as Jeremy Tammik puts it. To calculate this value you have to use Math.Tan(45) which equals 1. This value then is interpreted as if it is a radian, so its gets converted from radian to degrees like this: degrees = (radian/pi)*180 which then gives you the value of 57.296.

So for the other way around, when you want to use Dynamo to set the slope value of the roof element you should use something like this.

I have tried to reverse engineer the above to obtain the roof slope in degrees of any selected roof element.

However it is throwing out some inconsistencies (unless I’m missing something obvious).

The slope being reported in Dynamo does not translate correctly back to degrees. The attached screenshot is from a 45 degree sloped roof (as defined in Revit Slope parameter).

Can anyone shed some light on why this is happening, or on my stupidity?

Thanks for the response and confirming it isn’t just me.

It is quite strange behaviour, I can’t imagine where the discrepancy within Revit’s conversion is happening.

Agree that rounding is the best solution that can be used at this time - I’m only extracting for Gutter and RWP size calculation so I have a hefty tolerance within the Building Regs ranges.

As a side note: The rounding solution prompted me to think that the issue could be related to project units in revit and some form of rounding occurring when the slope input of degrees is converted to a slope. Tried increasing the decimals in project units. No joy. Baffled.

It doesn’t seem to be an issue within dynamo code. All the equations stack up when I use a calculator (took me back to my GCSE’s all those years ago). I can only assume that is an issue with the slope being reported by Revit.