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()?
Solved! Go to Solution.
Solved by michael.cox. Go to Solution.
Example picture of what angle information i'm trying to retrieve from a duct run that's vertical.
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.