Hi there! I am trying to batch rename Fabrication Model Assemblies. The way that i am doing it now is to select the assemblies then use Ideate to export an excel sheet for me to acquire the element ID’s. and from that excel i write the New Name for the assembly. I am not knowledgeable in Dynamo so i apologize. The part where I am stuck is getting the element ID of the assembly i want to change the name. it always show null. thats why when i feed it to the code nothing happens. I am asking Chatgpt on what nodes to use so please bear with me. I am using this process because there are a +100 aseemblies that i have to rename uniquely and i think this is the best way. I will attach the excel and dynamo script that i made. Thank you for oyur help!
Hello @JPU Welcome
maybe something here for rename assemblys
import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
doc = DocumentManager.Instance.CurrentDBDocument
# Ensure inputs are lists
elements = IN[0] if isinstance(IN[0], list) else [IN[0]]
new_names = IN[1] if isinstance(IN[1], list) else [IN[1]]
unwrapped = [UnwrapElement(i) for i in elements]
TransactionManager.Instance.EnsureInTransaction(doc)
results = []
updated_names = []
for item, name in zip(unwrapped, new_names):
item.AssemblyTypeName = name
results.append(item)
updated_names.append(item.AssemblyTypeName)
TransactionManager.Instance.TransactionTaskDone()
OUT = updated_names, results
PS if you have issue with excel sheet import you will need share that sheet
Not sure if a Python solution is the best way to go about it when
.
Especially when it can be done with nodes
.
I see a trend on the forum. I have the feeling OP’s Python is also done
by ChatGPT, but i might be wrong
.
There is no need for Excel to rename the Assemblies.
It can be done with just Dynamo.
yeah sure we can get value, but not sure we can set name OOTB…havent tried ahaha
sure we can do it with set name from clockwork as well.
great
Hello there! Thank u for taking the time to reply. I was thinking about the excel because this is like +100 assemblies with unique names. If i do this i have to manually click the assembly then retype the name one by one., im thinking of like extracting their ID then automatically changing their unique names
Hello! I appreciate the response. but I’m trying to batch rename multiple assemblies with unique names. If i understand the workflow correctly , i have to manually select each assembly then input the new name ![]()
Hi @JPU …no not really i think should work for list as well, you already have the new name from excel so give them that, if it is what your mean
My guess is OP thinks they need to select hundreds of assemblies manually hence they’re exporting assembly data to excel and using the ID to get elements to rename them. if that’s correct then OP you can just get all the assemblies directly :
also I see that you’re using string to node to convert “9” to 9. You can just use code block or number slider to generate a number. I’d suggest you go through the primer to grasp the fundamentals before you jump straight into Python. One of co-workers has started with primer and it does an excellent job at teaching concepts step by step.
hello there! I appreciate you taking the time to comment. I cannot select all assemblies in the models because there is a lot of assemblies hence what i did is i selected the similar assemblies then obtained their ID so that they will be the only one change. to put this into perspective as seen form the image A B C D E has their own unique names
If you can get their IDs you should be able
to find / filter them in Dynamo too
.
I kindly suggest you having a look at the Dynamo Primer.







