Rename Family Types Python Script

python

#1

Any idea how to change input as a list? Now it only takes 1 item.


#2

You have to loop your in[0] in order to do it for multiple items.
Like so.

import clr
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

elements = UnwrapElement(IN[0])
newname = IN[1]

output = []
counter = 0
t1 = "Renamed element "
t2 = " to "
TransactionManager.Instance.EnsureInTransaction(doc)
for element in elements:
	org = element.Name
	new = element.Symbol.Name = newname[counter]
	result = t1+org+t2+new
	output.append(result)
	counter = counter + 1
TransactionManager.Instance.TransactionTaskDone()

#Assign your output to the OUT variable.
OUT = output

#3

Thank you! Works like a charm!