After looking into this a little bit I’ve been able to get the CategorySet for a given parameter, however I haven’t figured out how to iterate through the list to return the category names. You can however check to see if a category is contained within the set.
You can see here I checked to see if three categories were applied to a specific project shared parameter. If you know the categories that should have the parameter applied you can check to confirm them.
Here is the python code:
import clr
clr.AddReference('System')
from System.Collections.Generic import *
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
param = UnwrapElement(IN[0])
cats = UnwrapElement(IN[1])
bool = []
paramdef = param.GetDefinition()
bindings = doc.ParameterBindings
#bindings.Contains(paramdef)
item = bindings.Item[paramdef]
catset = item.Categories
for cat in cats:
if catset.Contains(cat):
bool.append(True)
else:
bool.append(False)
#Assign your output to the OUT variable.
OUT = bool