Python - Group Type Names

Is there a way to get the name of the group types in Python? You can only set the name using GroupType.Name and can’t access it. I’ve tried listing all the parameters using GroupType.Parameters, but it has neither a Family Name nor Type Name.

Is there a way that I am missing that I can access this?

I am trying to use it to compare the group type in a project to group that I am copying from another project. I would like to delete the group type in the target document if it has the same name as the group type I am copying. Maybe there is another way to do that? The group currently doesn’t have any instances, so that’s why I am looking to compare group types.

In Dynamo I am able to use the Family.Name node to get the name of the group types, but I can seem to replicate this in Python. Any ideas?

Thank you!

@Dan_Boghean Since you’re able to get the name of the Python output GroupTypes in Dynamo, you are able to get the GroupType names in Python by first turning them into Dynamo elements :slight_smile:

3 Likes

Thank you for that. It seems like that works in Dynamo just as expected.

Any ideas on how to get the GroupType.Name to work in Revit Python Shell? I can’t convert it to Dynamo Elements and I get an error saying Name is not an attribute of GroupType when I try to access it.

@Dan_Boghean Sorry, I have very little experience with Revit Python Shell and have mainly just used Python within Dynamo so far… it seems from the API docs though, that the “Name” property can only be set and not retrieved within the Revit API, and that is why it becomes “retrievable” as a Dynamo object within the Dynamo environment. Maybe an incorrect assumption on my part :thinking:

1 Like

No worries. I was finally able to figure it out.

Seems like Revit Python Shell is treating GroupType as a ElementType (inherited from Element), in which Name is only able to be set, and not retrieved. Dynamo must be accessing GroupType as an Element, thus exposing the Name property.

You can access the Name property of a GroupType in Revit Python Shell by using Element.Name.GetValue(GroupType).

Thank you!

3 Likes

Here are some additional infos:
https://forums.autodesk.com/t5/revit-api-forum/group-type-name/td-p/7500446