SetSelection

void SetSelection(this UIApplication uiapp, IEnumerable<ElementId> ids)

Replaces the current UI selection with the provided element ids. No-op if no UI document is available.

Parameters

  • uiappUIApplication

    The Revit UI application instance.

  • idsIEnumerable<ElementId>

    The element ids to set as the new selection.

Returns: Void.

Example

var walls = uiapp.GetActiveDocument()
?.GetAllElementsOfClass<Wall>()
.Take(2)
.Select(w => w.Id);
if (walls != null)
{
uiapp.SetSelection(walls);
}