With the Revit API, we can directly access the exterior face of a given wall.
Previously, we would have had to get the geometry of a wall, which would be returned as solid and then use that to get access to each of the Faces from the Solid object. Then with each face, we would have had to calculate the normal and use that to find out if the face was aligned to a specific horizontal axis that we were looking out for.
Or alternatively used approach of using materials and finding out the layers of the wall, and use that layer order to extract the exterior or interior wall material and with the exterior wall layer material, compare with the face material of the wall.
All these longer (and error prone) workflows can now be simply avoided just by using the HostObjectUtils helper class’s GetSideFaces() method. This method returns the major side faces of the host object, with the ability to define which side we are interested in accessing – the exterior or the interior side.
// Select the wall
Wall pickedWall = ele as Wall;
// Get the side faces
IList<Reference> sideFaces =
HostObjectUtils.GetSideFaces(pickedWall,
ShellLayerType.Exterior);
// access the side face
Face face =
uiDoc.Document.GetElement(sideFaces[0])
.GetGeometryObjectFromReference(sideFaces[0]) as Face;
Amazing isn’t it, how the new APIs that the Development team constantly provides, make our tasks so much easier.