Group Type Name

Group Type Name

Anonymous
Not applicable
4,307 Views
5 Replies
Message 1 of 6

Group Type Name

Anonymous
Not applicable

Is there a way to get the name of the group types? 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?

0 Likes
Accepted solutions (1)
4,308 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

I forgot to add that the group currently doesn't have any instances, so that's why I am looking to compare group types.

0 Likes
Message 3 of 6

FAIR59
Advisor
Advisor

a Grouptype is an Revit.DB.Element, so you can simply find the value of the property  grouptype.Name

0 Likes
Message 4 of 6

Anonymous
Not applicable

That was my thought too, but it isn't working for me. Perhaps it is because I am using Revit Python Shell?

 

According to the Revit API Documents: 

 

GroupType.Name:

public override string Name { set; }

There is not get option, only set. 

 

Not sure why it's behaving this way... Could it just be a Python issue?

0 Likes
Message 5 of 6

FAIR59
Advisor
Advisor
Accepted solution

Indeed for elementtype the Name is restricted to a Set method.

In a test macro, I was able to get all the names for grouptypes using grouptype.Name.

 

Can you downcast the grouptype to Element?  string name = (grouptype as Element).Name;

 

or use a helperfunction:

 

string ElementName(Element elem)
{
return elem.Name;
}
0 Likes
Message 6 of 6

Anonymous
Not applicable

Ahh, that must be it! So, the problem is with Python...

 

I finally found something here: https://groups.google.com/forum/#!topic/revitpythonshell/uaxB1FLXG80

 

Element.Name.GetValue(GroupType) worked for anyone who stumbles on this and is working in Python