Solid.Faces Property

SolidFaces Property

The faces that belong to the solid.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public FaceArray Faces { get; }
Public ReadOnly Property Faces As FaceArray
	Get
public:
property FaceArray^ Faces {
	FaceArray^ get ();
}
member Faces : FaceArray with get

Property Value

FaceArray
Remarks
A face may be degenerate. This can be determined with the Face property IsTwoSided.
Example
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);
}
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

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

See Also