Get doors by number(s), how?

Hello,

i stuck mentaly here … :slight_smile:

["O2520-T01","O2530-T01","O2503-T01","O2505-T01","O2800-T01","O2542-T01","O2540-T01","O2540-T01","O2545-T01","O2547-T01",;

i want to get this doors in my current view, how ?

i need just to create a bool and filter them out.

KR

Andreas

Instead of a set difference, List.Contains where the list is the numbers you are after, and the item is the parameter value of each door (make sure you have the item set to @L1 as it will otherwise look for a list of parameter values in your list). From there you should have a flat list of boolean values which can be used as a mask in a FilterByBoolMask node.

2 Likes

@jacob.small ,

is there also a listlength to take in mind ?


KR
Andreas

Hi @Draxl_Andreas

How about pythonic way?

import clr

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

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

doc = DocumentManager.Instance.CurrentDBDocument

toList = lambda x : x if hasattr(x, '__iter__') else [x] 

names = toList(IN[0])

# Filter Doors in Active View and by Mark Value
filter_doors = [x for x in FilteredElementCollector(doc,doc.ActiveView.Id).OfCategory(BuiltInCategory.OST_Doors)
.WhereElementIsNotElementType().ToElements() 
if x.get_Parameter(BuiltInParameter.ALL_MODEL_MARK).AsString() in names]


OUT = filter_doors
2 Likes

Inputs are backwards; the hard coded acceptable values are the list input. They should not have list levels enabled, or be set to @L2. The item input is the the parameter values (not sure you need the x+"" code block). They should be @L1. Lacing should work on Auto (as you are using an @L1 one of the inputs is a single item, so Auto will kick over to longest), but if not longest will work if not.

3 Likes