src/Revit/RevitHyparTools/RevitExtensions.cs
/// <summary>
/// Analyze all of the PlanarFaces of a Revit solid and returns those that 
/// face "up" within a certain threshold.
/// </summary>
/// <param name="solid">The revit Solid</param>
/// <param name="verticalThreshold">The angle (in degrees) that represents the threshold for a face to be considered facing up.  A completely horizontal face will have an angle of 0.  A face that does not face up or down at all will have an angle of 90.</param>
Analyze all of the PlanarFaces of a Revit solid and returns those that
face "up" within a certain threshold.
Analyze all of the PlanarFaces of a Revit solid and returns those that face " up " within a certain threshold .
internal static PlanarFace[] GetMostLikelyTopFaces(this Solid solid, double verticalThreshold = 30)
        {
            var faces = new List<PlanarFace>();
            foreach (PlanarFace face in solid.Faces)
            {
                if (face.FaceNormal.DotProduct(XYZ.BasisZ) > Math.Cos(Elements.Units.DegreesToRadians(verticalThreshold)) && face.FaceNormal.DotProduct(XYZ.BasisZ) <= 1)
                {
                    faces.Add(face);
                }
            }
            return faces.ToArray();
        }
internal static PlanarFace [ ] GetMostLikelyTopFaces ( this Solid solid , double verticalThreshold = 30 ) { var faces = new List < PlanarFace > ( ) ; foreach ( PlanarFace face in solid . Faces ) { if ( face . FaceNormal . DotProduct ( XYZ . BasisZ ) > Math . Cos ( Elements . Units . DegreesToRadians ( verticalThreshold ) ) && face . FaceNormal . DotProduct ( XYZ . BasisZ ) <= 1 ) { faces . Add ( face ) ; } } return faces . ToArray ( ) ; }
Analyze all of the PlanarFaces of a Revit solid and returns those that
face "up" within a certain threshold.
Analyze all of the PlanarFaces of a Revit solid and returns those that face " up " within a certain threshold .
Solid
this
verticalThreshold
double
The angle (in degrees) that represents the threshold for a face to be considered facing up.  A completely horizontal face will have an angle of 0.  A face that does not face up or down at all will have an angle of 90.
The angle ( in degrees ) that represents the threshold for a face to be considered facing up . A completely horizontal face will have an angle of 0 . A face that does not face up or down at all will have an angle of 90 .
solid
The revit Solid
The revit Solid