Search for doortypes with API

Hi,
I`m trying to collect all doortypes in a revit document with the code below which was provided by archi lab. How can I adapt this code to only return the doortypes in the document an not the instances?
Help is appreciated! :slightly_smiling_face:
Wouter Hilhorst

Version:0.9 StartHTML:00000097 EndHTML:00004306 StartFragment:00000199 EndFragment:00004268 # Copyright© 2017, Konrad K Sobon

@arch_laboratory, http://archi-lab.net

import clr
clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

Import RevitAPI

clr.AddReference(“RevitAPI”)
from Autodesk.Revit.DB import *

import System
from System import Array
from System.Collections.Generic import *

import sys
pyt_path = r’C:\Program Files (x86)\IronPython 2.7\Lib’
sys.path.append(pyt_path)
TypeName=

try:
errorReport = None

#cat_list = [BuiltInCategory.OST_Rooms, BuiltInCategory.OST_Walls, BuiltInCategory.OST_Windows, BuiltInCategory.OST_Doors]
cat_list = [BuiltInCategory.OST_Doors]
typed_list = ListBuiltInCategory
filter = ElementMulticategoryFilter(typed_list)
output = FilteredElementCollector(doc).WherePasses(filter).ToElements()

except:

if error occurs anywhere in the process catch it

import traceback
errorReport = traceback.format_exc()

Assign your output to the OUT variable

if None == errorReport:
#TypeName.append(str(ViewType.get_Parameter(BuiltInParameter.SYMBOL_NAME_PARAM).AsString()))
OUT = output[0]
else:
OUT = errorReport

Hi @wouter.hilhorst,

One possible way to collect door types:

import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

category = UnwrapElement(IN[0])

doortype = FilteredElementCollector(doc).OfCategoryId(category.Id).WhereElementIsElementType().ToElements()

OUT= doortype

doortype

2 Likes

Thanks!