Join walls in intersecting / touching

Hi guys,

So I’d like to join certain walls IF they are next to eachother (touching / intersecting).

  1. Select wall type
  2. Get all those walls (list)
  3. Get geometry of 'm.
  4. Does intersect?
  5. true: join.

Between step 3 and 4 my routine jams. I can’t get a list to cross check itsself.
I mean compare two of the same lists will result in only-true-result (obviously because it’s checking his own value).

But I need to check the lists items 1 with 2, 1 with 3, 1 with 4 … 2 with 3, 2 with 4 … 3 with 4 etc. you get the picture.

How do I achive this?

There’s a method in the API to get joining elements if you know a bit of Python. If not it’s probably exposed in a Custom Node …maybe Steam Nodes?

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
from Autodesk.DesignScript.Geometry import *
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)
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