Share

Solid.Faces Property

The faces that belong to the solid.


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

Syntax

C#

public FaceArray Faces { get; }

Property Value

FaceArray

Remarks

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

Example

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);
}

VB

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

Reference

Was this information helpful?