The Autodesk.Revit.DB.PhaseArrayIterator
class provides a way to iterate through a collection of phase objects in a Revit project.
Property | Description |
---|---|
Current |
Gets the current phase object in the collection |
IsDone |
Indicates whether the end of the collection has been reached |
PhaseArray |
Gets the PhaseArray object being iterated over |
Method | Description |
---|---|
Dispose() |
Releases the resources used by the iterator |
MoveNext() |
Moves the iterator to the next phase object in the collection |
Reset() |
Resets the iterator to the beginning of the collection |
// Create an iterator for the project's phase array
PhaseArrayIterator iterator = new PhaseArrayIterator(doc.Phases);
// Loop through the phases and print their names
while (!iterator.IsDone)
{
Phase phase = iterator.Current;
Debug.Print(phase.Name);
iterator.MoveNext();
}
// Dispose of the iterator
iterator.Dispose();
In this example, we first create an iterator for the phases in the project using the PhaseArrayIterator
class. We then loop through the phases using the MoveNext()
method and print each phase's name to the console. Finally, we dispose of the iterator using the Dispose()
method.