from Autodesk.Revit.DB import *
import clr
clr.AddReference('System')
from System.Collections.Generic import List
doc = __revit__.ActiveUIDocument.Document
uidoc = __revit__.ActiveUIDocument
app = __revit__.Application
def get_in_place_elements():
"""Get In-Place Elements in Active View."""
collector = FilteredElementCollector(doc, doc.ActiveView.Id).OfClass(FamilyInstance).WhereElementIsNotElementType().ToElements()
inplace_families = [x for x in collector if x.Symbol.Family.IsInPlace]
return inplace_families
if __name__ == '__main__':
all_in_place = get_in_place_elements()
all_in_place_ids = [i.Id for i in all_in_place]
new_selection = List[ElementId](all_in_place_ids)
uidoc.Selection.SetElementIds(List[ElementId](new_selection))