Returns an element iterator to the elements passing the filters.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 26.4.0.0 (26.4.0.0)
Syntax
C#
public FilteredElementIterator GetElementIterator()
Return Value
FilteredElementIterator
Exceptions
| Exception | Condition |
|---|
| InvalidOperationException |
The collector does not have a filter applied. Extraction or iteration of elements is not permitted without a filter.
|
Remarks
Calling this when you have an active iterator to this same collector will result in the first iterator being
stopped by this call.
Example
C#
FilteredElementCollector collector = new FilteredElementCollector(document);
collector.OfClass(typeof(Autodesk.Revit.DB.Plumbing.Pipe));
FilteredElementIterator elemItr = collector.GetElementIterator();
elemItr.Reset();
while (elemItr.MoveNext())
{
Pipe pipe = elemItr.Current as Pipe;
if (pipe.FlowState == PipeFlowState.LaminarState)
{
TaskDialog.Show("Revit", "Model has at least one pipe with Laminar flow state.");
break;
}
}
VB
Dim collector As New FilteredElementCollector(document)
collector.OfClass(GetType(Autodesk.Revit.DB.Plumbing.Pipe))
Dim elemItr As FilteredElementIterator = collector.GetElementIterator()
elemItr.Reset()
While elemItr.MoveNext()
Dim pipe As Pipe = TryCast(elemItr.Current, Pipe)
If pipe.FlowState = PipeFlowState.LaminarState Then
TaskDialog.Show("Revit", "Model has at least one pipe with Laminar flow state.")
Exit While
End If
End While
See Also
Reference