Set Assembly Code file

Create a Python Script with the following Code:
With a filepath as input, (referring to the location of the .txt file) this should do the work

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*

clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

filepath = UnwrapElement(IN[0])

p = ModelPathUtils.ConvertUserVisiblePathToModelPath(filepath)
s = ExternalResourceReference.CreateLocalResource(doc, ExternalResourceTypes.BuiltInExternalResourceTypes.AssemblyCodeTable, p, PathType.Absolute);

TransactionManager.Instance.EnsureInTransaction(doc)

AssemblyCodeTable.GetAssemblyCodeTable(doc).LoadFrom(s, KeyBasedTreeEntriesLoadResults());

TransactionManager.Instance.ForceCloseTransaction()

OUT = s.GetReferenceInformation()
6 Likes