Collecting GroupTypeId Members in Dynamo

Collecting GroupTypeId Members in Dynamo

palo9878
Explorer Explorer
845 Views
6 Replies
Message 1 of 7

Collecting GroupTypeId Members in Dynamo

palo9878
Explorer
Explorer

Hello,

 

I am working with Dynamo, and I have a specific task that I need assistance with. I would like to access and list all the members of the GroupTypeId class in Revit using Dynamo and Python scripting. 

 

My main goal is to automatically convert strings that are the members (group type id members) into Autodesk elements so I can work with them in Dynamo and generate an automated process.

 

I've attempted to access these properties directly, but it seems that they might not be readily available in Dynamo's Python environment.

 

Is there a way to achieve this? Any guidance or code snippets would be greatly appreciated.

 

Thank you in advance for your help!

0 Likes
Accepted solutions (1)
846 Views
6 Replies
Replies (6)
Message 2 of 7

Yien_Chao
Advisor
Advisor

hi

 

groupTypeId does exist in the API, buy only since 2022 version.

 

i don't understant what you are trying to achieve, but if share your code i might take a look.

0 Likes
Message 3 of 7

palo9878
Explorer
Explorer

Hi,

 

Thank you for your reply. 

 

I am working with the Revit API 2023. Previously, I worked with BuiltInParameter groups, which I could easily access. My ultimate goal is to create new shared parameters in the Revit model. I want to be able to enter the GroupTypeId members of my parameters as strings and then generate code that automatically converts these strings into Autodesk.Revit.DB.GroupTypeId members, allowing me to create an automated process. I have successfully created this code manually to add new parameters, but I am currently unable to automate it since I cannot access the members directly:

 

for d, g, i in zip(definitions, groups, isInstance): try: new = doc.FamilyManager.AddParameter(d, GroupTypeId.Structural, i) outcome.append(new) except: outcome.append("Parameter not added.")

 

Hope this helps and thank you for your help! 

0 Likes
Message 4 of 7

Yien_Chao
Advisor
Advisor

so to make it clear, you want to set your groupTypeId with different ids?

 

i might be wrong, but i think it's a read only parameter.

0 Likes
Message 5 of 7

palo9878
Explorer
Explorer

GroupTypeId has different members, such as structural and mechanical. I want to import these members as strings from an Excel file into Dynamo. In Dynamo, I want to add these members as shared parameters in the Revit model (which I have already done), but I also want to create an automated process where my code can access these members directly. However, in my code, I am manually writing them down: 

 

for d, g, i in zip(definitions, groups, isInstance): try: new = doc.FamilyManager.AddParameter(d, GroupTypeId.Structural, i) outcome.append(new) except: outcome.append("Parameter not added.")

 

Thank you! 

 

0 Likes
Message 6 of 7

Yien_Chao
Advisor
Advisor

please share your entire code.

0 Likes
Message 7 of 7

Chuong.Ho
Advocate
Advocate
Accepted solution

I seen the topic was here for long time, let's me share all the thing relate to. In Dynamo you can do with script like this  : 

 

 

import clr

# Import Revit API
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import GroupTypeId, ForgeTypeId

# Import Reflection
from System import Type
from System.Reflection import PropertyInfo

# Get the .NET type of GroupTypeId
group_type_id_type = clr.GetClrType(GroupTypeId)

# Get all properties
properties_info = group_type_id_type.GetProperties()

# Dictionary: ForgeTypeId -> property name
built_in_parameter_names = {}

for prop in properties_info:
    if isinstance(prop, PropertyInfo):
        value = prop.GetValue(None)  # static property → None
        if isinstance(value, ForgeTypeId):
            built_in_parameter_names[prop.Name] = value

# Output to Dynamo
OUT = built_in_parameter_names

The code will be return a dictionary of collection GroupTypeId 

ChuongHo_0-1755493489321.png

 

Chuong Ho

EESignature

0 Likes