Rotation from a LocationCurve

Rotation from a LocationCurve

Anonymous
Not applicable
1,497 Views
2 Replies
Message 1 of 3

Rotation from a LocationCurve

Anonymous
Not applicable

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()?

0 Likes
Accepted solutions (1)
1,498 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

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

 

verticle angle example.png

0 Likes
Message 3 of 3

Anonymous
Not applicable
Accepted solution

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.