Rename newly created Assembly?

How to rename an Assembly instance? The existing package nodes are not working for me.

The Python code I am trying: RenameRevitAssembly.py · GitHub

The Python code started from Tool.RenameAssembly in SteamNodes.

Maybe Type vs Instance is my problem.

Does anyone have an example of a graph that uses Tool.RenameAssembly?

Hello @truevis
insert a Transaction.End Node (to Start a new Transaction)

or use
TransactionManager.Instance.ForceCloseTransaction()

3 Likes

That worked, thank you. Why do I need that Transaction.End node there, but never anywhere else up to now?

I also had to make the Transaction.End after everything else was finished.

Hello @truevis
Renaming the assembly requires a separate transaction

1 Like

I cannot believe I spent a full day with a script to set the name of Assembly Types which code was correct but I had a warning that I did not know how to skip it, but this line of code just fixed TransactionManager.Instance.EnsureInTransaction(doc)

the warning was this:

script does not work because Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed. 
Traceback (most recent call last):
  File "<string>", line assembly_instance.AssemblyTypeName = assembly_name, in <module>
Exception: No valid type for the assembly instance.
1 Like

Does closing transaction in Python also cause double Undos in Revit’s stack like the Transaction.End Node does?

In my case I have 3 undos of Dynamo for a python code, I did not really pay attention to it if the task is done. I already wrote 2 times this code line with no clue what it does really
TransactionManager.Instance.ForceCloseTransaction()

image