The Autodesk.Revit.DB.ProjectLocationSetIterator
class represents an iterator for the set collection of project locations in a Revit document.
Property | Description |
---|---|
Current |
Gets the current project location in the set. |
IsDone |
Gets whether the iterator has reached the end of the set. |
Method | Description |
---|---|
Dispose() |
Releases all resources used by the iterator. |
MoveNext() |
Advances the iterator to the next project location in the set. |
// Get the set of project locations in the document
ProjectLocationSet projectLocationSet = doc.ProjectLocations;
// Initialize an iterator for the project location set
ProjectLocationSetIterator iterator = projectLocationSet.ForwardIterator();
// Iterate through the set and print the name of each project location
while (!iterator.IsDone)
{
ProjectLocation projectLocation = iterator.Current;
Debug.Print(projectLocation.Name);
iterator.MoveNext();
}
The ProjectLocationSetIterator
provides a way to iterate through the set of project locations in a document in a forward direction. To iterate through the set in a reverse direction, use the ReverseIterator
method of the ProjectLocationSet
.
Note that the ProjectLocationSet
property of the Document
class returns a read-only collection of project locations that cannot be modified directly. To add or remove project locations in a document, use the document's ProjectLocations
property instead.