How To Reload All Revit Links

I try to Load Revit Links in model at once instead of reload them individually ,
and here-under my trial but not working
Any Ideas ???

– The Python Code :slight_smile:

import clr

import sys
pyt_path = r’C:\Program Files (x86)\IronPython 2.7\Lib’
sys.path.append(pyt_path)
import os
import ntpath

clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

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

rlTypes =
fPaths =
names =

rvtLinkTypes = FilteredElementCollector(doc).OfClass(RevitLinkType)

if rvtLinkTypes:
for rlt in rvtLinkTypes:
rlTypes.append(rlt)
efr = rlt.GetExternalFileReference()
fPath = ModelPathUtils.ConvertModelPathToUserVisiblePath(efr.GetPath())
fPaths.append(fPath)
names.append(ntpath.basename(fPath))

OUT = rlTypes, fPaths, names

1 Like

what are the errors that you are getting?

Also, please post any code using the Preformatted Text option </>.

Have you tried the Reload() method? :slight_smile:

http://www.revitapidocs.com/2018.1/86830eb9-5ddb-c342-fddd-6963e5c03564.htm

Hi,

There are several nodes to reload all links or only selected links.

1 Like

I Try it but unfortunately it doesn’t work

Ok I will thanks a lot

Hey @abdallahzakaria,

This is how you could do it:

import clr

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

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

doc = DocumentManager.Instance.CurrentDBDocument

rvtLinkTypes = FilteredElementCollector(doc).OfClass(RevitLinkType).ToElements()

bool = IN[0]

reloaded = []

if bool == True:
	
	for rlt in rvtLinkTypes:
		reloaded.append(rlt.Reload())
		
	OUT = reloaded
	
else:
	OUT = 'Set bool to True'

Use the Boolean toggle to ‘reset’ the python node if you need to rerun the graph multiple times without closing the session.

image

But as @Alban_de_Chasteigner, if you dont mind using costum packages, you might aswell do that. They are probably also more reliable then my snippet :slight_smile:

Good luck.

Thanks A lot dear I appreciate your reply

Thanks A lot Alban_de_Chasteigner
It works like a charm