Skip to content

Instantly share code, notes, and snippets.

@gtalarico
Last active September 30, 2016 13:45
Show Gist options
  • Save gtalarico/c92e6f4c7d938f953aa95e5fd5569cb4 to your computer and use it in GitHub Desktop.
Save gtalarico/c92e6f4c7d938f953aa95e5fd5569cb4 to your computer and use it in GitHub Desktop.
RevitAPI::Code Snippets::Select All Doors
"""
SelectDoors
Selects All Door Instances
TESTED REVIT API: 2015 | 2016
Gui Talarico
"""
from Autodesk.Revit.UI import TaskDialog
from Autodesk.Revit.DB import FilteredElementCollector
from Autodesk.Revit.DB import BuiltInCategory, ElementId
from System.Collections.Generic import List
# Required for collection
uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document
collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Doors)
doors = collector.ToElements()
# SELECT MIRRORED DOORS | 2015 + 2016 API
selection = uidoc.Selection
collection = List[ElementId]([door.Id for door in doors])
selection.SetElementIds(collection)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment