The FaceSplitter class is a utility class in the Autodesk.Revit.DB namespace of the Revit API. It is used to split a face of a solid or a mesh into multiple smaller faces at a specified splitting curve.
The FaceSplitter class has the following properties:
InputFace: The face to be split.SplitCurves: The curves used to split the InputFace.SplitFaces: The resulting faces after the splitting operation is performed.The FaceSplitter class has only one method:
SplitFace() : Splits the InputFace into smaller faces at the specified SplitCurves. The resulting SplitFaces are stored in the SplitFaces property.// Get a solid element from the Revit document
Solid solid = ...;
// Get the face of the solid to be split
Face face = solid.Faces.get_Item(0);
// Create a curve to be used for splitting the face
Curve curve = Line.CreateBound(new XYZ(0, 0, 0), new XYZ(10, 10, 0));
// Use the FaceSplitter class to split the face
FaceSplitter splitter = new FaceSplitter(face, new CurveArray() { curve });
splitter.SplitFace();
// Get the resulting split faces
foreach(Face splitFace in splitter.SplitFaces)
{
// Do something with the split faces
}
In the example above, a solid element is retrieved from the Revit document and its first face is retrieved. A straight line curve is created along which the face is to be split. The FaceSplitter class is then used to split the face at the specified curve. Finally, the resulting split faces are retrieved from the SplitFaces property of the FaceSplitter object and processed as needed.
InputFace property must be a planar face.SplitCurves property can be a collection of one or more curves. If multiple curves are provided, the InputFace will be split into multiple faces along each curve.SplitFace method modifies the SplitFaces property of the FaceSplitter object in place.SplitFaces property may contain more faces than the number of curves provided in the SplitCurves property since the original face may be split into multiple segments along a single curve.Face object represents a planar face of a solid or a mesh in Revit.Solid object represents a 3D, bounded geometry in Revit.