# Getting all parameter types, group types and categories

**URL:** <https://forum.dynamobim.com/t/getting-all-parameter-types-group-types-and-categories/95606>\
**Category:** Revit\
**Tags:** python, dynamo\
**Created:** [November 17, 2023, 10:53am UTC](https://forum.dynamobim.com/t/getting-all-parameter-types-group-types-and-categories/95606 "2023-11-17T10:53:33Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![sai-lok.ly](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sai-lok.ly](https://forum.dynamobim.com/u/sai-lok.ly)\
**Post date:** [November 17, 2023, 10:53am UTC](https://forum.dynamobim.com/t/getting-all-parameter-types-group-types-and-categories/95606/1 "2023-11-17T10:53:33Z")

</div>

Hello,

I’m trying to get a script working where I’d need a list of all the parameter types, group types and categories. I know that a node exists for each of these indivudually. However, I don’t want to use a drop down menu, but a full list of all the different parameter options. I’ve tried making a custom node with a giant list which I connected to a couple of hundred nodes for each different category etc. This makes my script very slow and not very useable.

Is it possible to make a python script (I gave it a try to no avail as I’m not great at it) or is there a node somwhere which gives me this list?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Mike.Buttery](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@Mike.Buttery](https://forum.dynamobim.com/u/Mike.Buttery)\
**Post date:** [November 17, 2023, 11:16am UTC](https://forum.dynamobim.com/t/getting-all-parameter-types-group-types-and-categories/95606/2 "2023-11-17T11:16:40Z")

</div>

What have you tried so far? It helps if you show what you have tried  
What is your use case, why do you need every type?  
Look into a FilteredElementCollector for Group Class and ParameterElement Class  
For BuiltInCategories and BuiltInParameters you could get all values with `System.Enum.GetValues(<builtin>)` and retrieve using `System.Enum.GetObject(<builtin>, value)`

---

<div class="post-metadata">

**Author:** ![sai-lok.ly](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sai-lok.ly](https://forum.dynamobim.com/u/sai-lok.ly)\
**Post date:** [November 17, 2023, 12:18pm UTC](https://forum.dynamobim.com/t/getting-all-parameter-types-group-types-and-categories/95606/3 "2023-11-17T12:18:46Z")

</div>

I tried making a script with Python, but I didn’t get anywhere. I gave up on that, because I didn’t seem to be getting any results due to the error which I was getting and couldn’t resolve.

Right now I have made custom nodes which are displayed below:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/5/f5b511f18068e20e8f86be8cdd673a84e3233e39.png)

These custom nodes work, but they’re too slow. So I want to make a script which does the same in Python, but doesn’t make my script take 10 minutes to run each time.

---

<div class="post-metadata">

**Author:** ![Mike.Buttery](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@Mike.Buttery](https://forum.dynamobim.com/u/Mike.Buttery)\
**Post date:** [November 18, 2023, 1:16am UTC](https://forum.dynamobim.com/t/getting-all-parameter-types-group-types-and-categories/95606/4 "2023-11-18T01:16:26Z")

</div>

You’re going to need a few different strategies to get all items from Revit classes depending what they are.

 ![get_all_2023-11-18_08-01-26](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/7/17082e110ee6a36241b1d6d504c2d27efe136fc4.png)

**Classes with attributes (_ForgeTypeId_)**  
These hold various types of information in default properties like _SpecTypeId.Weight_ or _UnitTypeId.Celsius_ which refer to ForgeTypeId values. Python has a handy built in function called [`vars()`](https://docs.python.org/3/library/functions.html#vars) that can extract the available attributes and you will have to filter for .NET methods and python attributes which usually have an underscore in their name and a few standard python functions of the class such as _string_, _int_, _boolean_, etc. We can then use the [`eval()`](https://docs.python.org/3/library/functions.html#eval) function to turn a string representation into an object and _voilà_ instant everything!

> **Code**
>
> ```python
> import clr
> 
> clr.AddReference("RevitAPI")
> from Autodesk.Revit.DB import SpecTypeId
> 
> properties = sorted(
> [
> v
> for v in vars(SpecTypeId)
> if "_" not in v and v not in ["Boolean", "Int", "Reference", "String"]
> ]
> )
> 
> def props(p):
> obj = eval("SpecTypeId." + p)
> return p, obj.TypeId, obj
> 
> OUT = map(props, properties)
> 
> ```

**Built In Enumerations (_System.Enum_)**  
Revit has lots of enumerations which are collections of attributes that refer to an integer, this can be specific to a class, usually returning 0, 1, 2 etc. or returning a Revit internal _ElementId_ integer which are negative. The two most used Enums are _BuiltInParameter_ and _BuiltInCategory_ and when we use Enums such as _BuiltInParameter.VIEWPORT\_SHEET\_NAME_ or _BuiltInCategory.OST\_Walls_ these **are** integers. This is very handy because we can use these to get for example a class of a Parameter or Category, `doc.GetElement(<integer>)` or filter using the _ParameterFilterRuleFactory_ or other filters as part of a _FilteredElementCollector_ with conversion by using `ElementId(<integer>)`.

> **Code**
>
> ```python
> import clr
> 
> from System import Enum
> 
> clr.AddReference("RevitAPI")
> from Autodesk.Revit.DB import BuiltInParameter
> 
> OUT = sorted(zip(Enum.GetNames(BuiltInParameter), Enum.GetValues(BuiltInParameter)))
> 
> ```

**Revit Classes (_Autodesk.Revit_)**  
Finally we get to gathering Revit classes using the _FilteredElementCollector_. I will not go into too much details as there is plenty of information online such as [Dynamo Forum](https://forum.dynamobim.com/search?q=FilteredElementCollector), [Dynamo Python Primer](https://dynamopythonprimer.gitbook.io/dynamo-python-primer/4-revit-specific-topics/fetching-revit-elements) and if you really want to get into the nitty gritty check out Jeremy Tammik’s blog [Retrieving Elements Using `FilteredElementCollector`](https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.9). Jeremey’s code is usually in C# however you can convert to python using online tools which should get you 80% of the way there.

> **Code**
>
> ```python
> import clr
> 
> clr.AddReference("RevitServices")
> from RevitServices.Persistence import DocumentManager
> 
> clr.AddReference("RevitAPI")
> from Autodesk.Revit.DB import FilteredElementCollector, Group
> 
> doc = DocumentManager.Instance.CurrentDBDocument
> 
> groups = FilteredElementCollector(doc).OfClass(Group).ToElements()
> 
> def grp_info(g):
> view = doc.GetElement(g.OwnerViewId).Title
> return g.Name, view, g
> 
> OUT = map(grp_info, groups)
> 
> ```

Note: If what you are using has a unique name it is quite simple to turn the information into a dictionary so you can retrieve info with a string as key. (You can also do this with _System.Enum.GetValue()_)  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/2/a27956fd4cedb9c923cd849c26c8fb01f4746e92.png)

> **Code**
>
> ```python
> import clr
> 
> from System import Enum
> 
> clr.AddReference("RevitAPI")
> from Autodesk.Revit.DB import BuiltInCategory, ElementId
> 
> bic_dict = dict(zip(Enum.GetNames(BuiltInCategory), Enum.GetValues(BuiltInCategory)))
> 
> elemid = ElementId(bic_dict[IN[0]])
> 
> OUT = elemid, type(elemid), bic_dict
> 
> ```

---

<div class="post-metadata">

**Author:** ![sai-lok.ly](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sai-lok.ly](https://forum.dynamobim.com/u/sai-lok.ly)\
**Post date:** [November 20, 2023, 8:35am UTC](https://forum.dynamobim.com/t/getting-all-parameter-types-group-types-and-categories/95606/5 "2023-11-20T08:35:29Z")

</div>

Hello,

Thank you very much for the extensive reply. I was able to use it up to a certain point. However, I think that I should’ve uploaded a picture with my question, because I’m looking for a list which gives me all of the encircled types and groups in the parameter properties:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/b/5b3a719ac14f582a1fbd159a617c55d6e66f93e3.png)

Is it possible to get these, or not? I already have a script which gives me the categories

import clr  
clr.AddReference(‘RevitAPI’)  
from Autodesk.Revit.DB import\*  
clr.AddReference(‘RevitServices’)  
from RevitServices.Persistence import DocumentManager  
doc = DocumentManager.Instance.CurrentDBDocument  
cat = doc.Settings.Categories  
OUT = cat , [x.Name for x in cat]

---

<div class="post-metadata">

**Author:** ![sai-lok.ly](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sai-lok.ly](https://forum.dynamobim.com/u/sai-lok.ly)\
**Post date:** [November 20, 2023, 8:36am UTC](https://forum.dynamobim.com/t/getting-all-parameter-types-group-types-and-categories/95606/6 "2023-11-20T08:36:11Z")

</div>

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/9/996083eba870bd903eed8602f715dba6f398f8ae.png)

---

<div class="post-metadata">

**Author:** ![NIRMAL](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nirmal/32/150135_2.png) [@NIRMAL](https://forum.dynamobim.com/u/NIRMAL)\
**Post date:** [November 20, 2023, 11:16am UTC](https://forum.dynamobim.com/t/getting-all-parameter-types-group-types-and-categories/95606/7 "2023-11-20T11:16:41Z")

</div>

> [@sai-lok.ly](#):
>
> Is it possible to get these, or not?

Yes It is possible to get these enumeration using Revit API.  
check the snap for your reference.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/b/abab944cfd914544256ddc8e9599a6b187bb8fa3.png)

```auto
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import BuiltInParameterGroup

# Get all ParameterGroups
all_groups = [group for group in dir(BuiltInParameterGroup) if isinstance(getattr(BuiltInParameterGroup, group), BuiltInParameterGroup)]
OUT = []
for group in all_groups:
    OUT.append(group)

```

---

<div class="post-metadata">

**Author:** ![Mike.Buttery](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@Mike.Buttery](https://forum.dynamobim.com/u/Mike.Buttery)\
**Post date:** [November 20, 2023, 1:29pm UTC](https://forum.dynamobim.com/t/getting-all-parameter-types-group-types-and-categories/95606/8 "2023-11-20T13:29:18Z")

</div>

You can look at it as old school (Enums) vs new school (ForgeTypeId), but firstly lets get to those drop downs - _Type of Parameter_ is a SpecTypeId, _Group parameter under_ is a BuiltInParameterGroup. Old school is a bit hacky, new school has LabelUtils, ParameterUtils and UnitUtils. Revit is moving to ForgeTypeId for a lot of properties so now is probably a good time to lean in. Too much code to drop here - see the attached dyn file

 ![get_all_2023-11-20_09-16-35](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/4/54be61c38f383c9464374765ebe8581e91f9075e.png)  
[Get\_All\_Info\_R24.dyn](https://forum.dynamobim.com/uploads/short-url/h9nDW4m23ecKthgK7sbS0sMnYLm.dyn) (12.0 KB)

---

<div class="post-metadata">

**Author:** ![sai-lok.ly](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sai-lok.ly](https://forum.dynamobim.com/u/sai-lok.ly)\
**Post date:** [November 21, 2023, 1:18pm UTC](https://forum.dynamobim.com/t/getting-all-parameter-types-group-types-and-categories/95606/9 "2023-11-21T13:18:53Z")

</div>

I’m sorry, but apparently this script doesn’t work for Revit2023 anymore. I tried it in 2022 where it worked fine, but gives out an error in 2023

---

<div class="post-metadata">

**Author:** ![Mike.Buttery](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@Mike.Buttery](https://forum.dynamobim.com/u/Mike.Buttery)\
**Post date:** [November 21, 2023, 1:25pm UTC](https://forum.dynamobim.com/t/getting-all-parameter-types-group-types-and-categories/95606/10 "2023-11-21T13:25:08Z")

</div>

ParameterType Enums has been removed from 2023 \>

> [ObsoleteAttribute(“This enumeration is deprecated in Revit 2022 and may be removed in a future version of Revit. Please use the `ForgeTypeId` class instead. Use properties of the `SpecTypeId` class and its nested classes to replace uses of specific values of this enumeration.”)]  
> public enum ParameterType

---

<div class="post-metadata">

**Author:** ![NIRMAL](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nirmal/32/150135_2.png) [@NIRMAL](https://forum.dynamobim.com/u/NIRMAL)\
**Post date:** [November 22, 2023, 5:17am UTC](https://forum.dynamobim.com/t/getting-all-parameter-types-group-types-and-categories/95606/11 "2023-11-22T05:17:54Z")

</div>

Yes, I was working in Revit 2021 so that can happen.

---

<div class="post-metadata">

**Author:** ![ISECnico](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/isecnico/32/198892_2.png) [@ISECnico](https://forum.dynamobim.com/u/ISECnico)\
**Post date:** [December 5, 2024, 4:03am UTC](https://forum.dynamobim.com/t/getting-all-parameter-types-group-types-and-categories/95606/12 "2024-12-05T04:03:12Z")

</div>

In Revit 2024, I found that the “new school” method (ForgeTypeId) was missing about 10 spec types, including Fill Pattern, Image, Integer, Load Classification, Material, Multiline Text, Number of Poles, Text, URL and Yes/No.  
I changed **UnitUtils** for **SpecUtils** and modified the _Specs (ForgeTypeId)_ script:

```auto
import clr

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import SpecUtils, LabelUtils

def label(ftid):
    return LabelUtils.GetLabelForSpec(ftid), ftid.TypeId, ftid

OUT = sorted(map(label, SpecUtils.GetAllSpecs()))

```

I referenced this post by @GavinNicholls : [Replace Family Parameters with shared parameters - #15 by GavinCrump](https://forum.dynamobim.com/t/replace-family-parameters-with-shared-parameters/93914/15)
