How to get angle between duct and coordinate system

How to get angle between duct and coordinate system

raysonchan0305
Community Visitor Community Visitor
323 Views
1 Reply
Message 1 of 2

How to get angle between duct and coordinate system

raysonchan0305
Community Visitor
Community Visitor

Hi everyone, I am trying to write a Python script to place family according to Duct element including the rotation of the duct. But I am not success to get the angle between the duct and the coordinate system.
Can anyone advise me how can I place family which align the duct element?

 

pb1.PNG

0 Likes
324 Views
1 Reply
Reply (1)
Message 2 of 2

ridaabderrahmane
Enthusiast
Enthusiast

 var curve = (duct.Location as LocationCurve).Curve;

var direction = (curve as Line).Direction;

var angle = direction.AngleTo(XYZ.BasisX)); // the angle between the duct and the X axis.

 You can rotate ur family instance with this angle around The Z axis.

 

 

0 Likes