Python - grab element by specific Keynote

Hej All,

I’m trying to collect some element that have a specific Keynote (list of Keynotes)

but my python script return only False value. I know it should retuen some of dem True.

can anyone help my out?

I think you should only iterate through the list of pipes.

for e in pipeElems:
	param = e.LokupParameter('Keynote')
	if param in keynote:
		boolValue.append(True)
	else:
		boolValue.append(False)

OUT = boolValue

The way you’re doing it the code tests each pipe with only one value from the list keynote : first pipeelement with 522101, second pipeelement with 52201 and so on.

Hej Mostafa,

It’s still only returns False,

@Nicolaj_Bach_Pederse

Oh yeah that’s because keynote is a built in parameter.
try this :

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

doc = DocumentManager.Instance.CurrentDBDocument
elems = UnwrapElement(IN[0])
keynote = IN[1]
boolValue = []
for e in elems:
	etype = doc.GetElement(e.GetTypeId())
	param = etype.get_Parameter(BuiltInParameter.KEYNOTE_PARAM).AsString()
	if param in keynote:
		boolValue.append(True)
	else:
		boolValue.append(False)

OUT = boolValue 

Here the keynote list is an input instead of a list typed inside the python script

@Mostafa_El_Ayoubi,

That’s working. Thanks a lot.
Now i get that idea how to grab the Keynote parameter.