Loaded Assembly Code File and Load another file

Loaded Assembly Code File and Load another file

c_hanschen
Advocate Advocate
325 Views
1 Reply
Message 1 of 2

Loaded Assembly Code File and Load another file

c_hanschen
Advocate
Advocate

Hello,

 

There is a nice post for reading All Assembly Codes, Key and Description:

https://forums.autodesk.com/t5/revit-api-forum/how-to-get-all-assembly-codes-and-descriptions/m-p/10...

 

This gives the basic information for accessing the AssemblyCodeTable.

With the help of RevitLookup I found a way to read the FileName of the loaded Assembly Code File:

 

Dim MyAssemblyCodeTable As AssemblyCodeTable = AssemblyCodeTable.GetAssemblyCodeTable(MyDoc)
Dim MyExternalResourceReference As ExternalResourceReference = MyAssemblyCodeTable.GetExternalResourceReference(ExternalResourceTypes.BuiltInExternalResourceTypes.AssemblyCodeTable)
Dim FilePath As String = MyExternalResourceReference.InSessionPath

 

This works for me!

 

But how can I change the Assembly Code File with the Revit API? In case I want to load another file?

 

Thanks in Advance,

 

Chris Hanschen

LKSVDD architecten

The Netherlands

 

 

 

0 Likes
Accepted solutions (1)
326 Views
1 Reply
Reply (1)
Message 2 of 2

c_hanschen
Advocate
Advocate
Accepted solution

I searched the internet for over an hour to find a solution, searched the Revit Api Forum also of course, but did not found a solution. So I posted this question here!

 

I thought, I will give it one more internet search and found the solution, I will share it here for you all 🙂

 

Dim p As ModelPath = ModelPathUtils.ConvertUserVisiblePathToModelPath("C:\tabel1.txt")
Dim s = ExternalResourceReference.CreateLocalResource(MyDoc, ExternalResourceTypes.BuiltInExternalResourceTypes.AssemblyCodeTable, p, PathType.Absolute)
Dim MyKeyBasedTreeEntriesLoadResults As New KeyBasedTreeEntriesLoadResult
MyAssemblyCodeTable.LoadFrom(s, MyKeyBasedTreeEntriesLoadResults)

 

Good luck with this in case you need it 🙂

 

Chris

 

0 Likes