TreeIterator() is a special enumerator function that creates an iterator object suitable for use in For Each statements.
In the following example, the For Each...Next statement uses TreeIterator(Me) to walk the model tree (from the current part) to count the number of parts in the tree.
Rule partCount As Integer partCount = 0 For Each prt In TreeIterator(Me) partCount = partCount + 1 Next prt End Rule