Slope is Slope, Not Radians

I am still in Thailand, flying home tonight.
Still, I had time to go through some email today, and picked up lots of interesting tidbits.
Let me start with this one:

Question: When I use the sample code from the Revit API help file RevitAPI.chm to create a NewFootPrintRoof, the slope is set to 0.5 radians.
This results in a slope of 26.57 degrees for the newly created roof.
This value is incorrect, however, since 0.5 radian equals about 28.65 degrees.

Using the Revit Lookup tool, I can see that the value has indeed been set to 26.57, which is also what we get to see in the UI, and the internal value in radians is 0.5.
What is wrong here, and where does this inconsistency come from?

Answer: The value is not in radians.
It is really a ‘slope’, i.e. the relation between the horizontal and vertical components of the corresponding vector, e.g. 0.5 means half a foot = 6” / 12 up per foot sideways”, 0.75 means three quarters of a foot = 9” / 12”, etc., and

atan (0.5) ≈ 26.57°

Thanks to Saikat and Scott for raising and clarifying this issue!

In other words, and from another case, if you set a parameter of type slope to a value of 1, the value returned by AsValueString will be 45 degrees (and not 57.217 = 180 / π, for instance).

This definition of slope is mentioned in the description of the FootPrintRoof.SlopeAngle property.


Comments

2 responses to “Slope is Slope, Not Radians”

  1. ABuckingham Avatar
    ABuckingham

    As a minor correction, slopes are unitless, which is to say that using feet, meters or parsecs for your project will all provide identical results. It’s easy to see that 6″/12″ = 0.5 = 152.4mm/304.8mm. This is really nice because you do not have to account for differing units in the calculation.

  2. Dhiraj Avatar
    Dhiraj

    Hi Jeremy,
    Can u tell me how to identify pipe is drawn in “Slope Up” or “Slope Down”?
    Thank You Sir.

Leave a Reply to ABuckinghamCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading