'Wall' object has no attribute 'Faces'

Hello. I am new to using revit api in python. One of the points I do not understand is that the walls I list with Filtered Element Collector do not have Faces attribute. But the walls I listed from Dynamo have the Faces attribute. Both wall_element_lists have the same IDs. Can you help me?

# Load the Python Standard and DesignScript Libraries
import math
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference('ProtoGeometry')
import Autodesk.DesignScript.Geometry as DSG

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

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

# Place your code below this line
all_wall_element_list = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsNotElementType().ToElements()
wall_element_list = []
for wall_element in all_wall_element_list:
    if getattr(wall_element, "CurtainGrid", None) == None:
        wall_element_list.append(wall_element)

faces_list = [wall.Faces for wall in wall_element_list]

# Assign your output to the OUT variable.
OUT = faces_list

The “Faces” attribute is associated to the Dynamo object, not the Revit one.

The content gathered with a filtered element collector is pulled as a Revit element, while the content gathered by a AllElementsOfCategory node is a Dynamo reference to a Revit Element. The former is direct access to the full Revit API, while the later is just what Dynamo has a wrapper for - be they indirect Revit API calls or Dynamo specific API calls. Element.Faces is a Dynamo specific one, and as such is not available on the native Revit API.

Look into the getting the geometry in the native Revit API if you want to use the filtered element collector, as shown here: Geometry Property

Note that you’ll have to extract the surfaces from the solid once attained.

1 Like

Thank you for the explanation. I only know the way to access the surfaces from the dynamo reference. Is there a way to wrap it to access the dynamo reference? Or is there a way to access all surfaces from the Revit reference? Sorry I’m trying to read the API but it seems a bit strange for me at the moment.

I found a way “ToDSType(element)”.

Yes, that will work. Generally speaking g though you’re better off staying in the Revit API once you go there. You’re adding a new dependency and it’s a slow conversion. While it might not feel that way yet - trust me on this one the bouncing back and forth between libraries is a killer.

What have you tried in the Revit API context?

1 Like

Thank you for explanation. I am using Filtered Element Collector, Room Boundary Segments, element parameter works. I have to use ProtoType() because I can’t do simple geometry operations like 3D Boolean operations, Element surfaces and Curve extrude.

1 Like

Sure can - there is an entire class called BooleanOperationUtilities to help with this. BooleanOperationsUtils Class

These are extracted from the solid in both the Dynamo node and the Revit API, Dynamo just hides a step. This is the Revit API call. Faces Property

Also doable: CreateExtrusionGeometry Method (IList(CurveLoop), XYZ, Double)

Or maybe you want this: CreateLoftGeometry Method

Hard to see without seeing your code.

2 Likes

these are great guides, thank you :slight_smile:

1 Like