Search code examples
c#revit-apirevit

How do i get rotation of wall using revit api?


If an Element is family instance then:

(FamilyInstance.Location as LocationPoint).Rotation;

I can easily get a rotation easily for family instance.

If I try for wall

Curve curve = ((Wall).Location as LocationCurve).Curve;

Or anything like that.

For example :

  1. In preceding image, trying to rotate wall to 90 Degree. normal wall

  2. In below Image, after rotating 90 Degree wall after rotation

Need to get the rotated angle of the wall.


Solution

  • If your wall curve is a straight line, you can just grab the angle from the line: let V be the vector from the wall curve start to end point, and determine its angle to the X axis: angle = V.AngleTo(XYZ.BasisX).