Load AssemblyCodeTable / KeyNoteTable

Hello forum members,

I try to load the Assembly Code Table into my Revit Project before i can assign the Assembly Codes per family type. But with the LoadFrom for the table I failed. Dynamo give the error:
“TypeError: expected KeyBasedTreeEntryTable, got type”

Can someone help me out. Thanx in advance!


http://www.revitapidocs.com/2017/51da265d-a879-61dd-3b59-b919bf2645f4.htm

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

path = IN[0]

TransactionManager.Instance.EnsureInTransaction(doc)
table = KeyBasedTreeEntryTable.LoadFrom(AssemblyCodeTable, path, loadResults)
TransactionManager.Instance.ForceCloseTransaction()

OUT = table

With the following code you are able to load the AssemblyCodeTable from another path.
You can also use the script for KeynoteTable: simply change “AssemblyCodeTable” to “KeynoteTable” in the script.

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

// locate your .txt file with the File Path node
filepath = 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
1 Like