Get wall face areas in Python

I am trying to get the area of wall faces inside Python script.
The input for Python node are all walls instances selected by Dynamo nodes.
In Python script I retrieve geometry (solids) of each wall instance.
Then I get faces of each solid.
What I want to do is get the area of each face of each wall.
However, I keep getting an error: ‘Face’ object has no attribute ‘Area’.
Revit API states that the Face class has an “Area” property, so I don’t know what I’m doing wrong here.
I would appreciate any help a lot.

import clr

from Autodesk.DesignScript.Geometry import *

import Revit


import Autodesk
from Autodesk.Revit.DB import *

from Revit.Elements import *

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
import sys

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
adoc = doc.ActiveView

wallsWrapped = IN[0]

OUT = []
wallsGeometry = []
wallFaces = []
wallFacesAreas = []

for w in wallsWrapped:

for i in wallsGeometry:
    wallFaces = i.Faces
    for singleFace in wallFaces:

OUT = wallFaces, wallFacesAreas

Hi, I am not sure the way you extract geometry is correct…

Maybe something like this would work: (just keep in mind the units)

import clr

#The inputs to this node will be stored as a list in the IN variables.
walls = UnwrapElement(IN[0])

from Autodesk.Revit.DB import *

options = Options()
#options.ComputeReferences = True
#options.IncludeNonVisibleObjects = True

faces = []
faceAreas = []

#get side references
for w in walls:
  geoElement = w.get_Geometry(options)
  for obj in geoElement:
    if isinstance(obj,Solid):
      for f in obj.Faces:

#Assign your output to the OUT variable.
OUT = faces, faceAreas

1 Like

I think you’re actually using the methods inherited from Autodesk.DesignScript.Geometry instead of Autodesk.Revit.DB

Thanks for a quick reply! Indeed it works fine now.

My way of extracting geometry gave me the list of faces so I assumed that this would be correct geometry.

Now I know it doesn’t work like this.
Thank you a lot.

1 Like