How do i get rotation of wall using revit api?
if a Element is family instance then
(FamilyInstance.Location as LocationPoint).Rotation;
i can easily get a the rotation easily.
if i try for wall
Curve curve = ((Wall).Location as LocationCurve).Curve;
or any thing like that.
Solved! Go to Solution.
Solved by jeremytammik. Go to Solution.
Hi,
The Revit API Developers Guide has some examples (Code Region 10-6)
Maybe this is helpful to you.
Hope this helps.
Hii,
thanks for the reply.
(Code Region 10-6)
bool LocationRotate(Autodesk.Revit.ApplicationServices.Application application, Autodesk.Revit.DB.Element element) { bool rotated = false; // Rotate the element via its location curve. LocationCurve curve = element.Location as LocationCurve; if (null != curve) { Curve line = curve.Curve; XYZ aa = line.GetEndPoint(0); XYZ cc = new XYZ(aa.X, aa.Y, aa.Z + 10); Line axis = Line.CreateBound(aa, cc); rotated = curve.Rotate(axis, Math.PI / 2.0); } return rotated; }
above code will rotate the wall with some given angle and return true or false.
i want something like
1) drawn a wall and rotated the wall with 90 Degree.
2) i need to get the rotation value like ( in this case it is 90 degree).
needed the rotated value. via api .
I just answered your identical question on StackOverflow:
https://stackoverflow.com/questions/52302648/how-do-i-get-rotation-of-wall-using-revit-api
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 );
Cheers,
Jeremy
Hi @jeremytammik ,
If I want to get the rotation for a structural column element, do I need to use the "LocationPoint.Rotation" approach?
Regards
I believe there are two different type of columns: vertical and tilted.
https://thebuildingcoder.typepad.com/blog/2009/06/creating-a-slanted-column.html
I believe the vertical ones use the location point approach, and the tilted to location line.
https://thebuildingcoder.typepad.com/blog/2011/03/slanted-column-cross-section-rotation.html
Please let us know how you end up solving this.
Thank you!
Cheers,
Jeremy
Can't find what you're looking for? Ask the community or share your knowledge.