Get Opposite Columns Surfaces

Hello all!
I’m trying to get the opposite surfaces of columns that are intersected by a beam. I got stuck in how to filter the surfaces that i want, as you can see in the image below:

Update. I’ve managed to make some progress but it’s not the right answer. Some columns don’t have the right surfaces.

can you please post the DYN here or at least the Python code? It will be helpful for those that can help if they had these things

Sure! And I uploaded the rvt file as well!
Test 1.rvt (1.3 MB)
Home11 - Copy6.dyn (132.6 KB)

Hello
a solution with Python

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *


clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)


def findOpposite(lstFaces, curveBeamOffset):
	for idxA, faceA in enumerate(lstFaces):
		if faceA.Intersect(curveBeamOffset) == SetComparisonResult.Overlap:
			normalA = faceA.FaceNormal
			for idxB, faceB in enumerate(lstFaces):
				normalB = faceB.FaceNormal
				if idxA != idxB :
					if normalA.IsAlmostEqualTo(normalB) or normalA.IsAlmostEqualTo(normalB.Negate()):
						return faceB
				
	

lstBeam = UnwrapElement(IN[0])
lstColum = UnwrapElement(IN[1])

lstOpositeFaces = []

opt = Options()
for beam in lstBeam:
	curveBeam = beam.Location.Curve
	curveBeamOffset = Line.CreateBound(curveBeam.GetEndPoint(0) + XYZ(0,0,-1), curveBeam.GetEndPoint(1) + XYZ(0,0,-1))
	for col in lstColum:
		geometryLst = col.get_Geometry(opt)
		for geo in  geometryLst:
			if isinstance(geo, Solid):
				oppositeFace = findOpposite(geo.Faces, curveBeamOffset)
				if oppositeFace is not None:
					lstOpositeFaces.extend(oppositeFace.ToProtoType()) 
				
				

OUT = lstOpositeFaces
4 Likes

Thank you so much. This really solved my problem!

2 Likes