Geometry Intersect not working


I try to use the geometry.Intersect() to find the intersected geometry between two geometry. It worked before if I input use geometry as input. However, I want to use element as input this time(Like the captured image below). And errors happened in the python script. In what step do I go wrong?


ducts = UnwrapElement(IN[0]) 
rooms = UnwrapElement(IN[1]) 
duct = ducts[0].Geometry[Options()]
room = rooms[0].Geometry[Options()]
result = duct.Intersect(room) #Error on this line

OUT = result

Autodesk.Revit.DB GeometryElement (List) has no Intersect method.
You cannot use objects from one API (Revit API) to another API (Dynamo API) without conversion.

an example with Dynamo API

import sys
import clr
import itertools

import Autodesk
from Autodesk.Revit.DB import *

import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

elemsA = IN[0]
elemsB = IN[1]
intersect = []	
geoSetElemsA = elemsA[0].Geometry()
geoSetElemsB = elemsB[0].Geometry()
for geoa, geob in itertools.product(geoSetElemsA, geoSetElemsB):
	if geoa.DoesIntersect(geob):

OUT = intersect

here is a useful link


thanks for your reply. Does my understanding in the grouping as below is correct?

room = rooms[0].Geometry[Options()] #Revit API
result = duct.Intersect(room) #Dynamo API

Moreover, how can I know which object is from Revit API or Dynamo API?
Is that everything from this doc is belonged to Revit API?

About the conversion you mentioned, is that UnwrapElement covert the object Dynamo to Revit and I need to covert back in order to use the Intersect() ?


No, if you want to use Intersect method (Dynamo) duct and room must be Dynamo object (Dynamo Geometry object)

You can use GetType() method

Here some link about the wrapper and geometry conversion;