CylindricalFace vs. PlanarFace attributes / properties

Hi,
Writing in Python with pyRevit as a base.
When modelling a 3D curved wall element, some of the faces are ‘flat’ while some are ‘curved’.
I am filtering the walls by:

wallFilter = ElementClassFilter(Wall)
refIntersector = ReferenceIntersector(wallFilter, FindReferenceTarget.Element, view3D)

And this contains all the walls, which I then go on to find the references of.

I’m trying to differentiate somehow between the CylindricalFace and PlanarFace, which both exist inside curved walls in the FaceArray.

CylindricalFace has the property “Axis”, while PlanarFace has “FaceNormal”. This is a distinct difference. I want to somehow do:

if face.HasFaceNormal:
   do stuff...

but there doesn’t seem to be such a method or something similar I can use.

It would be less ideal, but if I can exclude curved walls from my filter it would make my functionality work as long as there are no curved walls in the file… Is there perhaps a way to solve this problem in the ElementClassFilter and exclude curved walls there?

Of course that making the differentiation while including all wall geometries would be the best solution.

Thank you

you could try:

if hasattr(face, "HasFaceNormal"):
    #do stuff...

which under the hood does reflection to see if such a property or method exists in the object

1 Like

I would be more explicit so its clearer what the intent of the code is:

if type(face) == CylinricalFace:
    #Do stuff to CylinricalFace
else:
    #Do stuff to PlanarFace
1 Like

Thank you both. Both solutions are nice.