GetSelectionIds

ICollection<ElementId> GetSelectionIds(this UIApplication uiapp)

Returns the currently selected element ids; empty if no UI document is available.

Parameters

  • uiappUIApplication

    The Revit UI application instance.

Returns: A collection of selected ElementId objects (empty if none or no UI document).

Example

foreach (var id in uiapp.GetSelectionIds())
{
TaskDialog.Show("Selected Id", id.IntegerValue.ToString());
}