Get all categories of a parameter

Hello everyone, I am trying to collect all the categories of a parameter but I am a little bit blocked.

I already did this:

  • Select all element in active view
  • Check if the parameter exist for each element
  • Get the categories from those elements
    I then get a list of categories.

But this is not the complete list of the categories. Indeed, if a category is not used, it will not be in the list.

How can I do to have the whole list ?

Thanks a lot for your help !

Is this what you want to achieve? Group parameters under family category?

Thank you for your help, but this is not what I am looking for.

I want to get all the categories on which a parameter is applied. But, by using “Select Model Elements”, the categories which are not used in Revit will not be listed.

For exemple, I created a parameter “Test” and I applied it to the categories Walls, Doors and Windows. If I have not any window in my project, the dynamo will only give me Walls and Doors.

Any idea how I can get all the categories, even the ones that are not used ?

I am not sure what you mean here. But if you haven’t selected an element, it won’t appear in the list that you want to filter in dynamo. Is the below workflow you want to achieve?

1 Like

Sorry for not being clear and thanks again for your replies. I should have explained what I want to do.

I have a project with a list of parameter and I need to check if all the parameters are affected to the right list of categories. In the project, all the categories are not used.
To take the same example, I need to check if the parameter “Test” is affected to the categories Walls, Doors and Windows. But I dont have any window in my project.

The solution of @rexfrancojesse check if the parameter exist on Model Elements. But if I do not avec any window in my model, how can I check that the parameter is affected to the category windows ?

Hi,

You don’t need Dynamo for that.
In Revit, go to manage/project parameters, select the parameters to investigate, click modify.

Marcel

@Zaara-786 if you don’t have window at your model at all, then why bother checking the parameter?

@rexfrancojesse

If you have linked models with their own categories set to the same parameters and you don’t match the categories in the master model, you get strange results when applying a filter with overrides.
This applies to unused categories aswell, the list of categories must match.

Marcel

@Marcel_Rijsmus I know I can do it in Revit but I have to do that for like 100 parameters, so I think it will be better with Dynamo…
@rexfrancojesse I need to control a Revit file and check that all the parameter are affected to the right categories.

In fact I want to get this list for each parameter:

Hello,

I would like the same : to get all active categories of project parameters ?
We can get all parameters of a categories, we would like the oposite.

Can We do it ?

Could you start new thread. This topic title doesn’t match with your query.

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.
image
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
3 Likes

Document.ProjectParameters in Clockwork.

3 Likes

Hello,

Thank you for your answer.
Document.ProjectParameters works very well. Thank you very much for that.

I would like to complete this post because it is the same subject but I can create an other topic if necessary.

With Document.Projectparameters, this node get active categories of each parameter. I would like to complete the python script (but I’m very bad whith python code) :

  • to get a list of inactive categories of each parameter
  • to get the all categories in a list NOT depends on parameter (I think I will be an other script).

Could you help me for coding this in python (or if a node exists…)

Thank you in advance.

Up,

Does anybody knows how to get list of all categories inside a parameters, not depends on parameter ?

What do you mean by “inactive categories of each parameter”?
You want all the categories in a project? Bakery has a few nodes with that info.

@Nick_Boyts No, I want all categories that we can checked in project parameters within a list.

The node Document.projectParameters gives me all checked categories for each project parameters, I can’t modify the python script to have inactive categories.

Ah. I’m not sure how you would get that, but I think it’s just Model and Analytical Categories with some system categories (MEP Systems, Views, and Sheets.) You could easily build your own list with the help of CreateProjectParameterForAllCategories.

@clement.cazi

https://forum.dynamobim.com/t/get-all-elements-in-model-categories/9447