Faces Property


The faces that belong to the solid.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 17.0.0.0 (17.0.1090.0)

Syntax

C#
public FaceArray Faces { get; }
Visual Basic
Public ReadOnly Property Faces As FaceArray
	Get
Visual C++
public:
property FaceArray^ Faces {
	FaceArray^ get ();
}

Remarks

A face may be degenerate. This can be determined with the Face property IsTwoSided.

Examples

Copy C#
private void GetFacesAndEdges(Wall wall)
{
    String faceInfo = "";

    Autodesk.Revit.DB.Options opt = new Options();
    Autodesk.Revit.DB.GeometryElement geomElem = wall.get_Geometry(opt);
    foreach (GeometryObject geomObj in geomElem)
    {
        Solid geomSolid = geomObj as Solid;
        if (null != geomSolid)
        {
            int faces = 0;
            double totalArea = 0;
            foreach (Face geomFace in geomSolid.Faces)
            {
                faces++;
                faceInfo += "Face " + faces + " area: " + geomFace.Area.ToString() + "\n";
                totalArea += geomFace.Area;
            }
            faceInfo += "Number of faces: " + faces + "\n";
            faceInfo += "Total area: " + totalArea.ToString() + "\n";
            foreach (Edge geomEdge in geomSolid.Edges)
            {
                // get wall's geometry edges
            }
        }
    }

    TaskDialog.Show("Revit",faceInfo);
}
Copy VB.NET
Private Sub GetFacesAndEdges(wall As Wall)
    Dim faceInfo As [String] = ""

    Dim opt As Autodesk.Revit.DB.Options = New Options()
    Dim geomElem As Autodesk.Revit.DB.GeometryElement = wall.Geometry(opt)
    For Each geomObj As GeometryObject In geomElem
        Dim geomSolid As Solid = TryCast(geomObj, Solid)
        If geomSolid IsNot Nothing Then
            Dim faces As Integer = 0
            Dim totalArea As Double = 0
            For Each geomFace As Face In geomSolid.Faces
                faces += 1
                faceInfo += "Face " + faces + " area: " + geomFace.Area.ToString() + vbLf
                totalArea += geomFace.Area
            Next
            faceInfo += "Number of faces: " + faces + vbLf
            faceInfo += "Total area: " + totalArea.ToString() + vbLf
            ' get wall's geometry edges
            For Each geomEdge As Edge In geomSolid.Edges
            Next
        End If
    Next

    TaskDialog.Show("Revit", faceInfo)
End Sub

See Also

ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →