A set that contains element objects.
Namespace:
Autodesk.Revit.DB
Assembly:
RevitAPI
(in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Syntax
Examples
Copy
C#
ICollection<ElementId> selectedIds = uidoc.Selection.GetElementIds();
string info = "Selected elements:\n";
foreach (ElementId id in selectedIds)
{
Element elem = document.GetElement(id);
info += elem.Name + "\n";
}
TaskDialog.Show("Revit",info);
Copy
VB.NET
Dim selectedIds As ICollection(Of ElementId) = uidoc.Selection.GetElementIds()
Dim info As String = "Selected elements:" & vbLf
For Each id As ElementId In selectedIds
Dim elem As Element = document.GetElement(id)
info += elem.Name + vbLf
Next
TaskDialog.Show("Revit", info)