Does pyRevit or any of it’s extensions have advanced filtering where it goes into more detail. like a hierarchy tree like this? If not, I believe that would be a nice addition to pyRevit’s arsenal.
1 Like
it is in your hands
that you can make by default…
if you want a tree, or a one to one UI, than you have to dive into WPF
time_start = time.time()
print(doc.Title)
items = FilteredElementCollector(doc, doc.ActiveView.Id).WhereElementIsNotElementType().ToElements()
print('\n There are {} Elements'.format(len(items)))
# Prepare dict with an empty List as default value
from collections import defaultdict
dict_elements = defaultdict(list)
for i in items:
try:
cat_name = i.Category.Name
str_built_cat = str(i.Category.Name)
dict_elements[str_built_cat].append(i)
except:
print('Element ({}) does not have BuiltInCategory!'.format(i.Id))
# You might get 1-2 elements without Category!
# Show Results
print('\n List number of element in each category')
for k,v in dict_elements.items():
dist = 30 - len(k) # Calculate ammount of dashes to print nicely
print('{}:{} {} Elements'.format(k, '-'*dist, len(v)))
time_end = time.time()
duration = time_end - time_start
print("\n The code took {} seconds to run.".format(duration))
# END
1 Like