Making a Category names, BuiltInCategory and category Object dictinary

I would like to share a simple dict that has helped me alot during my work.
It allows for easy access to all categories, names and its BUIC enums from 1 place.

I hope others will find this as useful as I did.

#get category objects
cats=doc.Settings.Categories
#get their names
catNames=[i.Name for i in cats]
#convert Names to BultInCategories
buicCats=[BuiltInCategory(i.Id.IntegerValue) for i in cats]

#create a list
sublist=[buicCats,cats]
#transpose it
transSublist=[list(i) for i in zip (*sublist)]
#zip it
zipObj=zip(catNames,transSublist)
#create a dict withe the format { catName, [ built in name, cat object]}
catDict=dict(zipObj)

The output looks like this.
2021-12-01 12_25_13-Dynamo

6 Likes