I have problem with pick objects(linked elements). My "allow Element" filter works for elements in revit model but if i use the same ISelectionFilter for linked elements i can't pick enything. My code:
##imports
doc = revit.doc
uidoc = revit.uidoc
###Thanks to Cyril Waechter https://pythoncvc.net/?p=116 custom ISelectionFilter
class CustomISelectionFilter(ISelectionFilter):
def __init__(self, nom_categorie):
self.nom_categorie = nom_categorie
def AllowElement(self, e):
if e.Category.Name == self.nom_categorie:
return True
else:
return False
def AllowReference(self, ref, point):
return true
###
# Pick model elements
try:
with forms.WarningBar(title="Pick elements in model"):
wall_collector = uidoc.Selection.PickObjects(ObjectType.Element, CustomISelectionFilter("Walls"))
except:
print("No elements")
# Pick linked elements
try:
with forms.WarningBar(title="Pick elements in linked model"):
wall_collector_link = uidoc.Selection.PickObjects(ObjectType.LinkedElement, CustomISelectionFilter("Walls"))
except:
print("No linked elements")
## Print Ids