You can get the selected objects from the current active document using the UIDocument.Selection.Elements property. The selected objects are in an ElementSet in Revit. From this Element set, all selected Elements are retrieved. The Selection object can also be used to change the current selection programmatically.