GetSelectedElements

IEnumerable<Element> GetSelectedElements(this UIApplication uiapp)

Returns the currently selected elements; empty if none or no UI document is available.

Parameters

  • uiappUIApplication

    The Revit UI application instance.

Returns: An enumerable of selected Element objects (empty if none).

Example

foreach (var element in uiapp.GetSelectedElements())
{
TaskDialog.Show("Selected Element", element.Name);
}