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: 

Rotation from a LocationCurve

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
michael.cox
1130 Views, 2 Replies

Rotation from a LocationCurve

I am currently putting together a builderswork utility based on intersections of architectural walls and floors and have ran into issues with services intersecting with floors on a vertical (Z Axis) due to not being able to get the rotation of the service.

 

Been looking through sources online for a solution and unable to find one, so looking for some help from some people who can assist and hopefully a solution.

 

Currently I know that getting the rotation from a FamilyInstance can be obtained by casting the (FamilyInstance.Location as LocationPoint).Rotation

 

How would I obtain the rotation from an Element that can only be cast into a LocationCurve? (like duct, pipe, conduit, etc)

 

Would it be through the Transform class somehow by using XYZ.BasisZ.AngleTo()?

2 REPLIES 2
Message 2 of 3
michael.cox
in reply to: michael.cox

Example picture of what angle information i'm trying to retrieve from a duct run that's vertical.

 

verticle angle example.png

Message 3 of 3
michael.cox
in reply to: michael.cox

After a lot playing around and continued research I came up with a solution to getting the angle from above by using the MEPCurve -> ConnectionManager -> Connectors -> CoordinateSystem and performing Asin to return the Radians in a minus or positive value, allowing the builderswork GenericModel family to be placed and rotated by the radians.

 

public double GetAngleFromMEPCurve(MEPCurve curve)
{
     foreach (Connector c in curve.ConnectorManager.Connectors)
     {
          return Math.Asin(c.CoordinateSystem.BasisY.X);
     }
     return 0;
}

If anyone can think of a better solution to it over the next 24 hours i'd love to hear from them, after that I will accept this as the correct answer and mark as the solution.

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community