Hello
another way to find intersection on a Wall Face with Intersect Method (Curve, IntersectionResultArray)
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Plumbing import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
lnkInstWall = UnwrapElement(IN[0])
lnkInstPipe = UnwrapElement(IN[1])
docWall = lnkInstWall.GetLinkDocument()
docPipe = lnkInstPipe.GetLinkDocument()
lstWall = FilteredElementCollector(docWall).OfClass(Wall)
lstPipe = FilteredElementCollector(docPipe).OfClass(Pipe)
lstIntersect = []
for pipe in lstPipe:
curvPip = pipe.Location.Curve
for wall in lstWall:
linkrefface = HostObjectUtils.GetSideFaces(wall, ShellLayerType.Interior)
intFace = wall.GetGeometryObjectFromReference(linkrefface[0])
interArRef = clr.Reference[IntersectionResultArray]()
if intFace.Intersect(curvPip, interArRef) == SetComparisonResult.Overlap:
pointIntersect = interArRef.Value[0].XYZPoint
lstIntersect.append([pipe, pointIntersect.ToPoint() ])
OUT = lstIntersect
Note: if you want the middle Point Intersection get the second face with HostObjectUtils.GetSideFaces(wall, ShellLayerType.Exterior) then calculate the middle Point with the 2 IntersectionResult