I need to place elements at the intersection between ducts/pipes and floors, and then rotate the new element accordingly, depending on the orientation of the duct/pipe.
This is no issue with horizontal pipes or ducts, but I cannot figure out how to determine the orientation of a vertical duct/pipe. I can calculate a vector from its start and endpoint (either (0,0,1) og (0,0,-1)), but I have no way of relating that to the horizontal plane.
I have had the same issue with cable trays, until I realised that they have an up-direction property that returns exactly what I needed, but as far as I can tell, neither ducts nor pipes have similar properties.
Any thoughts on how to approach this?
Thanks!
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
element = UnwrapElement(IN[0])
OUT = element.CurveNormal.ToVector()