Joel Spahn raised a pertinent question on sorting face loop edges that was kindly picked up and answered by Scott Conover and Angel Velez from the Revit development team:
Question: It would be nice to know exactly what the following methods do:
- SortCurveLoops: sorts a set of curve loops such that outer and inner loops are separated.
- Remarks: Outer loops are separated and inner loops are grouped according to their outer loop. Loops are assumed to be non-intersecting, and there will be no nesting of inner loops, i.e., an inner loop of an inner loop is another outer loop.
- Returns: The sorted collection of loops.
- loops, the curve loops.
- ValidateCurveLoops: performs validity checks on a list of curve loops to ensure that they are all co-planar, closed, and properly oriented.
- Returns the curve loops properly oriented, if possible. If not, the return contains no loops.
- curveLoops, the loops to check
- extrDirVec, the normal vector.
In ValidateCurveLoops, the 'extrDirVec' normal vector defines what the 'proper orientation' means, by ensuring that the loops are counter-clockwise relative to this direction vector.
Both methods are perfectly usable outside of any IFC context.
In the long term, there is no reason why they should not move into the regular Revit API.
Thank you, Joel, for raising this very valid question, and to Scott and Angel for their answers.
As I mentioned in the recent discussion sorting face loop edges, the RoomEditorApp provides a sample code snippet exercising SortCurveLoops.