Geometry.intersect source code

Hello,
I’m looking for a python code that would do the same as geometry.intersect.
In my case, I would like to intersect two lists of solids with the same number of elements.
I just need to compare the element A (0) with B (0), then A (1) with B (1) … etc

Hello, please send what you found so far on this topic…

You can check out this node from Bakery: https://dynamonodes.com/2016/07/13/revit-element-clash-detection-v1/

Hello,
I tried to change the Clash Detection V1 node, but I have only empty single list.

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

#The inputs to this node will be stored as a list in the IN variable.
#dataEnteringNode = IN

clashElementsAdirty=IN[0]
clashElementsBdirty=IN[1]

# Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
clashElementsA = []
clashElementsB = []
clashGeomA = []
FailuresA = []
clashGeomB = []
FailuresB = []
clashFoundA = []
clashFoundB = []
clashSolids = []
clashPoints = []

#clashGeomA=IN[0]
#clashGeomB=IN[1]

for a in clashElementsAdirty:
	try:
#		clashGeomA.append(a.Geometry()[0])
		clashGeomA.append(a)
		clashElementsA.append(a)
	except:
		FailuresA.append(a)
for b in clashElementsBdirty:
	try:
#		clashGeomB.append(b.Geometry()[0])
		clashGeomB.append(b)
		clashElementsB.append(b)
	except:
		FailuresB.append(b)

counterA = range(len(clashElementsA))
counterB = range(len(clashElementsB))

for i in counterA:
	tempGeomA = clashGeomA[i]
		if clashGeomA[i].DoesIntersect(clashGeomB[i]) == True:
			clashFoundA.append(clashElementsA[i])
			clashFoundB.append(clashElementsB[i])
			tempSolid = clashGeomA[i].Intersect(clashGeomB[i])
			clashSolids.append(tempSolid[0])
			clashPoints.append(tempSolid[0].Centroid())

# End Transaction
TransactionManager.Instance.TransactionTaskDone()

OUT = clashFoundA, clashFoundB, clashSolids, clashPoints, FailuresA, FailuresB

This node seems to work pretty well actually:

Hi
Yes, but the problem is that it will process all combinations of 2 lists.
For a list of 100 items this represents 10,000 combinations.
But in my case I have 2 lists or each item of a list already corresponds to the second list.
It is necessary to compare A (0) with B (0), then A (1) with B (1).

Actually, it doesn’t seem to process all combinations in my case…

If, looking at the original code of the Clash Detection V1 node, there are 2 nested loops.

Ok I think I have found it.
Shift to the left of “If”