# Join walls in intersecting / touching

**URL:** <https://forum.dynamobim.com/t/join-walls-in-intersecting-touching/12622>\
**Category:** Revit\
**Created:** [June 21, 2017, 9:54am UTC](https://forum.dynamobim.com/t/join-walls-in-intersecting-touching/12622 "2017-06-21T09:54:26Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![alvpickmans](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alvpickmans/32/41236_2.png) [@alvpickmans](https://forum.dynamobim.com/u/alvpickmans)\
**Post date:** [June 21, 2017, 12:28pm UTC](https://forum.dynamobim.com/t/join-walls-in-intersecting-touching/12622/3 "2017-06-21T12:28:07Z")

</div>

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](https://forum.dynamobim.com/uploads/short-url/5Su7Cy3YOKGG89B1Kf737QWKU11.dyn) (5.1 KB)

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/7/d7a9f37dad56ce0637c0e8fe7fbfdf5269c0b72f.png)

---

_[View the full topic](https://forum.dynamobim.com/t/join-walls-in-intersecting-touching/12622)._
