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 :
In preceding image,
trying to rotate wall to 90 Degree.
In below Image,
after rotating 90 Degree
Need to get the rotated angle of the wall.
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)
.