Get vertical face from a list of faces

Hello everyone, I just start learning Revit API a couple weeks ago so I’m still not good at it. I’ve found a code like the image below to get the vertical faces from a list of faces but I don’t understand its logic. Please help me to explain it. I’ll be very appreciated with your help. Also, can you please tell me how to know the syntax of a method when reading the Revit API docs? I still don’t understand how I can define the syntax, something like A.B.C (input something)… I just know basic Python, not C#.

The x = XYZ.BasisX is createing a vector. In this case, the X-Axis.
The normal_face = i.FaceNormal pulls the vector from the face which is perpendicular to the plane of the face.
The check = IsParrallel((x, FaceNormal) sends the X vector and face normal to the IsParraell function,
This function does a little math on the two vectors. You can look up crossproduct on the web to see what that geometric formula does.
But if the crossproduct of the two vectors has no length -well - then they are Parrell. Since x is back and forth - there is no z. The .IsZeroLength returns the value of the crossproduct of the two vectors as eitehr True or False.

Her’s a decent run down of dotproduct and crossproduct.


Let’s take something simple on the methods…

To start with - look at the Visual Basic examples. They will be the closes to Python.
So, for the View.HideElement() you first need to have a view object. Not an Id of the view but the element itself. Then the method HideElement() wants one parameter - a list of element Id’s. Not the elements, but just the Id’s. And it wants an ICollection, not a python list. So, you will need the System.Collections.Generic ICollection to be imported with

from System.Collections.Generic

and cast a list as a list of element Ids with

myIds = List[ElementId]()
Once you have built your list of myIds, you pass it to the method.



@aaronrumple thanks a lot for your help.

you can check the Z component of the normal face, if it is equal to 0 (or very very close to 0), it is a vertical face


Just a way with nodes for what Cyril say :wink:


@c.poupin @sovitek yes, It’s a better way. Thank you guys a lot.

1 Like