Hi All
How do I select element type and select family? I want to select all family types in annotation symbols. I am trying to rename ones with a fixed prefix but I am struggling to get the families selected.
Hi All
How do I select element type and select family? I want to select all family types in annotation symbols. I am trying to rename ones with a fixed prefix but I am struggling to get the families selected.
Do you want to rename the families, or the family types?
Hi thanks for the reply.
The families. I have custom families that have a prefix and I would like to rename this prefix.
So for example in Annotation Symbols I have several tags set up;
XYZ_Tag_2.5mm
XYZ_Tag_3.5mm
XYZ_Tag_5mm
I want to rename these as
ABC_Tag_2.5mm
ABC_Tag_3.5mm
ABC_Tag_5mm
Are those the tag names, or the family names though? Family names are the first + under annotation symbols, types are under those.
Screenshot one in the project browser if things aren’t clear.
Family Names

@jacob.small just FYI for clarity and this is under annotation symbols.
You’re renaming the families. Utilize Element.Classes for the selection; you’ll then want to step back to check the category of the class and limit it to only annotation categories. This is easy enough with Python (one line) but there are likely packages for it as well.
### this line goes after the standard imports in your boiler plate ###
elems = UnwrapElement(IN[0])
elems = [i for i in elems if i.FamilyCategory.CategoryType == CategoryType.Annotation]
OUT = elems
From there you should be able to filter by way of List.FilterByBoolMask to ensure you only have families starting with the desired prefix. Lastly you’ll need to use a method to set the family name. This is again available in a few custom packages, but you an also try a simple Python implementation as follows:
### these go after the standard imports in your boiler plate ###
#########################################
###### Global variables and inputs ######
#########################################
### documents and standard variables ###
doc = DocumentManager.Instance.CurrentDBDocument #the current Revit document
### imports and unwrapping ###
elems = UnwrapElement(IN[0]) #import the elements from IN[0] of the Dynamo environment and convert the Dynamo references to native Revit elements
if not elems.__class__ == [].__class__ : elems = [elems] #ensure that elems is a list, not an individual object, so that we can always prepare for a loop
names = IN[1] #import the names from IN[1] of the Dynamo environment
if not names.__class__ == [].__class__ : names = [names]
#########################################
############ Code goes here #############
#########################################
TransactionManager.Instance.EnsureInTransaction(doc) #start transaction
[i.set_Name(j) for i,j in zip(elems,names)] #set the name of the element (i) to the associated name (j) provided in the elements and names list
TransactionManager.Instance.TransactionTaskDone() #end transaction
#########################################
##### Return the results to Dynamo ######
#########################################
OUT = elems #return the elements to the Dynamo environment
Thanks for your help.
At the moment with my basic knowledge it’s way over my head. I shall look more into Python though and how to use it. For now I shall rename manually as it’s quicker for now!
Thanks again.