Python Method Not Defined

Hi,

Apologies for the basic question…

So I noticed that faces have an intersect method…

http://www.revitapidocs.com/2018/91f650a2-bb95-650b-7c00-d431fa613753.htm

But when I try to use it, I get ‘not defined’ however the docs show it as being in image and I am bringing this is…

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

Could someone help explain?

Thanks,

Mark

P.S this is the whole script…

import clr

#Import the Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

#Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

#Import ToDSType(bool) extensions method
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

#Reference the active Document and application
doc = DocumentManager.Instance.CurrentDBDocument

walls = UnwrapElement(IN[0])

#Get the wall geometry -> Solid -> Edges
opt = Options()
opt.ComputeReferences = True
wallSolid = []

#the overloaded method get_Geometry will get the solid
for w in walls:
    wa = w.get_Geometry(opt)
    wallSolid.append(wa)
    

#get the faces of the solid as references 
wallfaces = []
intersec = []

for wS in wallSolid:
    for w in wS:
     	wallfaces.append(w.Faces)
     	for wf in wallfaces:
     	    intersec.append(intersect(wf))


#Assign your output to the OUT variable.
OUT = wallSolid, wallfaces, intersec

I might be wrong, but if it’s a method it has to be used in this way:

x.Intersect(y)

where is x is the first face and y the second face

Oh great, thanks

i was hoping to intersect all faces in a list, would you be able to suggest a way of doing that?

I guess a for loop would loop over one surface against all the others, but if i wanted to loop every surface against every other surface I’m not sure how that would be written…

Cheers,

mark

If you have only one input list, and you want to intersect everything with everything, it should be something like this:

import clr

#Import the Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

#Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

#Import ToDSType(bool) extensions method
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

#Reference the active Document and application
doc = DocumentManager.Instance.CurrentDBDocument

faces = UnwrapElement(IN[0])

list = []

for x in faces:
	for y in faces:
		if not x == y:
			inter = x.Intersect(y)
			list.append(inter)
		else:
			pass

OUT = list

2 Likes

Thanks for doing that, very good of you, I’ll sit and stare at it :slight_smile:

You are welcome! Of course it was just a fast example, it can be improved, for example with another IF sentence that filter out the null value and append to the list only the real intersection (so that we get rid of the List.Clean Dynamo node)

What I really want is to know which are intersecting and which aren’t, so it might be that i need a follow up IsIntersecting… There are very few face nodes for use with dimensioning so I’m having to up my Python.

Thanks again :slight_smile:

Mark