Join walls in intersecting / touching

One option for the logic you are proposing (may be not the best, but it works) is that for each iteration over the list of solids, save the elements (or their index on the list in this case) that have been already tested, so on the next iteration they can be avoided.

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

inputList = IN[0]
inputListLen = len(inputList)
indexesProcessed = []
outputList = []

def TestFunction( index1, index2, intersect):
	return "Item " + str(index1) + " intersects Item " + str(index2) + ": " + str(intersect)
	

for i in range(inputListLen):
	item = inputList[i]
	
	for j in range(inputListLen):
		if i != j and not(j in indexesProcessed):
			testItem = inputList[j]
			intersect = Geometry.DoesIntersect(item, testItem)
			
			text = TestFunction( i, j, intersect)
			outputList.append(text)
			
	indexesProcessed.append(i)
			
OUT = outputList

The TestFunction() is just to do some action with the two elements. This could be replaced with the API joining method @Thomas_Mahon mentions above (you would need to input as well the Revit elements into the python script thought).
testIntersectionSolids.dyn (5.1 KB)

1 Like