A face may be split into regions by the Split Face command. The Face.HasRegions property will report if the face contains regions created with the Split Face command, while the Face.GetRegions() method will return a list of faces, one for the main face of the object hosting the Split Face (such as wall of floor) and one face for each Split Face region.
The FaceSplitter class represents an element that splits a face. The FaceSplitter.SplitElementId property provides the id of the element whose face is split by this element. The FaceSplitter class can be used to filter and find these faces by type as shown below.
Code Region: Find face splitting elements |
Autodesk.Revit.DB.Options opt = app.Create.NewGeometryOptions(); opt.ComputeReferences = true; opt.IncludeNonVisibleObjects = true; FilteredElementCollector collector = new FilteredElementCollector(doc); ICollection<FaceSplitter> splitElements = collector.OfClass(typeof(FaceSplitter)).Cast<FaceSplitter>().ToList(); foreach(FaceSplitter faceSplitter in splitElements) { Element splitElement = doc.GetElement(faceSplitter.SplitElementId); Autodesk.Revit.DB.GeometryElement geomElem = faceSplitter.get_Geometry(opt); foreach (GeometryObject geomObj in geomElem) { Line line = geomObj as Line; if (line != null) { XYZ end1 = line.GetEndPoint(0); XYZ end2 = line.GetEndPoint(1); double length = line.ApproximateLength; } } } |