Select all Untagged Doors in ActiveView

Here is a simple Snippet to get All Doors and DoorTags in the ActiveView. It will also check which doors are not tagged, and display their ElementIds.

Code Snippet

# -*- coding: utf-8 -*-
from Autodesk.Revit.DB import *

#📦Variables
active_view = doc.ActiveView
doc = __revit__.ActiveUIDocument.Document

#👉 Collect Doors and Tags in View
all_doors = FilteredElementCollector(doc, active_view.Id).OfCategory(BuiltInCategory.OST_Doors).WhereElementIsNotElementType()
all_tags = FilteredElementCollector(doc, active_view.Id).OfCategory(BuiltInCategory.OST_DoorTags).WhereElementIsNotElementType()

#🔎 Check Tagged Doors
tagged_door_ids = [tag.GetTaggedLocalElements()[0].Id for tag in all_tags]
untagged_doors  = [door.Id for door in all_doors if door.Id not in tagged_door_ids]

#👀 Preview Results
print('Doors in View   : {}'.format(len(all_doors)))
print('DoorTags in View: {}'.format(len(all_tags)))
print('Tagged Doors    : {}'.format(len(tagged_door_ids)))
print('Untagged Doors  : {}'.format(len(untagged_doors)))

#🪄 Select Untagged Doors in View
from System.Collections.Generic import List
uidoc.Selection.SetElementIds(List[ElementId](untagged_doors))

⌨️ Happy Coding!
Erik Frits