Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how do i get rotation of wall using revit api?

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
arvind.maurya37
4932 Views, 5 Replies

how do i get rotation of wall using revit api?

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.

 

 

 

Tags (2)
5 REPLIES 5
Message 2 of 6
so-chong
in reply to: arvind.maurya37

Hi,

 

The Revit API Developers Guide has some examples (Code Region 10-6)

Maybe this is helpful to you.

 

http://help.autodesk.com/view/RVT/2019/ENU/?guid=Revit_API_Revit_API_Developers_Guide_Basic_Interact...

 

Hope this helps.

Message 3 of 6
arvind.maurya37
in reply to: so-chong

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.
wall given for rotation 90 degreewall given for rotation 90 degree

 

 

 

 

 

 

 

 

 

 

 

 

2) i need to get the rotation value like ( in this case it is 90 degree).wall after rotating 90 degreewall after rotating 90 degree

 

 

 

 

 

 

 

 

 

 

 

 

needed the rotated value. via api .

 

Message 4 of 6

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

  



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 6
Anonymous
in reply to: jeremytammik

Hi @jeremytammik , 

 

If I want to get the rotation for a structural column element, do I need to use the "LocationPoint.Rotation" approach?

 

Regards

Message 6 of 6
jeremytammik
in reply to: Anonymous

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

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report