"Add shared parameter to project" several element categories (archilab)

Is it possible to adjust this module to accept several categories? @Konrad_K_Sobon

I’ve seen there is a few workarounds, but the graf I am working on is already complex enough.

If not I guess I will try to add new categories to an existent parameter.

Thanks!!

I have managed to edit Add Shared to Project to accept both one category or a lists of categories.

I have replaced:

builtInCategory = System.Enum.ToObject(BuiltInCategory, _category.Id)
cats = app.Create.NewCategorySet()
cats.Insert(doc.Settings.Categories.get_Item(builtInCategory))
if _instance:
	bind = app.Create.NewInstanceBinding(cats)
else:
	bind = app.Create.NewTypeBinding(cats)

with (it check if it is a list or not and then proceed with the edited version or the original):

if isinstance(_category,(list,)):
	cats = app.Create.NewCategorySet()
	for cat in _category:
		builtInCategory = System.Enum.ToObject(BuiltInCategory, cat.Id)
		cats.Insert(doc.Settings.Categories.get_Item(builtInCategory))
		if _instance:
			bind = app.Create.NewInstanceBinding(cats)
		else:
			bind = app.Create.NewTypeBinding(cats)
else:
	builtInCategory = System.Enum.ToObject(BuiltInCategory, _category.Id)
	cats = app.Create.NewCategorySet()
	cats.Insert(doc.Settings.Categories.get_Item(builtInCategory))
	if _instance:
		bind = app.Create.NewInstanceBinding(cats)
	else:
		bind = app.Create.NewTypeBinding(cats)