Reload linked files, how?

2019-02-15_11h57_49

Hello,

I just want to reload my links. with this script! Where is the solution?
Can i do here a “for” loop?
Right now i have no errors… but no effect! :slight_smile:
I am glad about any help

KR

Andreas

Hi @Draxl_Andreas,

Your script is to repath the links.
If you want to reload them you can do like this :

import clr
# Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager

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

doc = DocumentManager.Instance.CurrentDBDocument

linkInstances = FilteredElementCollector(doc).OfClass(Autodesk.Revit.DB.RevitLinkInstance)

for link in linkInstances:
	linkType = doc.GetElement(link.GetTypeId())
	linkType.Reload()

OUT=linkInstances
1 Like

… I tried it pidirectional - i just changed “Reload” to “Unload” but it didn`t work
For unloading the links, need i a different script?

KR

Andreas

Replace
linkType.Reload()
with :
linkType.Unload(None)

You maybe need a TransactionManager.Instance.ForceCloseTransaction()
if you reload and then unload.

1 Like