Get element from faces

Good day!

I am trying to get the surface areas of generic models. I need to send this area back to the corresponding element’s parameter. What would be the easy way to do that?

I am not using element.geometry or element.solid or element.faces nodes because:

  1. There are some unavoidable warnings (trim_with_edge_loops requires all curves to touch surface).
  2. I only want the areas of lateral faces. (no base or top)


what you mean lateral? can mark the samples in the images?

Maybe this clockwork node is useful? You can dig around inside and reuse the nodes…



1 Like

I considered using this, but the surfaces aren’t flat.


No, but you can filter out those which are flat? :slight_smile:

Apologies if it isn’t useful…


Hey, no worries. :slight_smile: Thanks for the suggestion though.

Manually selecting faces works absolutely fine for me, but I can’t match them with the Revit element/object.
I prefer manual selecting here because it’s not able to handle all the element’s geometry due to the warnings.

1 Like

Hmm… I would have thought you could define the filter such that it will choose the right ones…

But I guess there is always a chance that some will fall through the net…

Let us know how you get on :slight_smile:

Edit: I’m pretty curious to know what this is for, it looks cool!

1 Like

Maybe you can try this approach

The red line pierces the element AND the surface

Good approach. But there are some small faces around the edge. I have more of such objects with different sizes in the file.

An approach with a filtering of surfaces with a dot product with Z vector

import sys
import clr
from Autodesk.DesignScript.Geometry import *

#import Revit API
import Autodesk
from Autodesk.Revit.DB import *

from Autodesk.Revit.UI import *
from Autodesk.Revit.UI.Selection import *

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
uidoc = uiapp.ActiveUIDocument

import Revit

outFaces = []
TaskDialog.Show("selection", "Select Faces")
refs = uidoc.Selection.PickObjects(ObjectType.Face, "select face")
for ref in  refs:
    elem = doc.GetElement(ref)
    face = elem.GetGeometryObjectFromReference(ref)
    bbxUv = face.GetBoundingBox()
    centerUv = (bbxUv.Max + bbxUv.Min) / 2
    normal = face.ComputeNormal(centerUv)
    normal = normal.Normalize()
    if abs(normal.DotProduct(XYZ.BasisZ)) < 0.5:
        surfaceDs = face.ToProtoType()
        outFaces.append([elem, surfaceDs[0], surfaceDs[0].Area])    

OUT = outFaces