Reload All Images?

Hoping that maybe this is possible using dynamo + python (or any combo really). I have a project where there is roughly 10 or so images imported into the Revit file as background information for an as-built condition. Occasionally there is a need to reload these images (ie. someone modifies the image to be better read, brightness/contrast etc). It’s a a bit cumbersome to reload each of these 10 images manually one at a time.

I found this thread;

Where there was a reload portion but that reload portion specified a specific file path and reloaded 1 file. Is is possible to specify a specific folder and have Dynamo/Python reload all images at that folder?


Hello Chris!
I added some loops to the code in the thread you linked to. Looks like it’s working, but you have to click on a couple of images before the changes are reflected in Revit. I tried to add doc.Regenerate() to the end, but it had no effect.

    #Modification of code from
    import clr
    from Autodesk.Revit.DB import *

    import Revit

    import RevitServices
    from RevitServices.Persistence import DocumentManager
    from RevitServices.Transactions import TransactionManager

    doc = DocumentManager.Instance.CurrentDBDocument

    #Converting input from Dynamo to Revit
    filePaths = IN[0]

    #Isolating filenames
    fileNames = []
    for path in filePaths:
    	tempName = path.split('\\')

    #Selecting images
    imgs = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_RasterImages).WhereElementIsElementType().ToElements()

    reloadedFiles = []

    #Reload images in a transaction

    for fileName in fileNames:
    	for i in imgs:
    		imageName = i.ToDSType(True).Name
    		if  imageName == fileName:


    OUT = reloadedFiles

Wow!! thanks works like a charm and helps me looking at the code to understand what I was missing in my own failed attempts.

Thanks again!

Well it was working well until I used a network location (enabled worksets) and then it went to crap lol. (central file is on a network (P Drive)and my local is on my local drive (D Drive))It looks like it is singling out just 1 jpg and i cannot tell why?. I am guessing it is with the split string but since I am a python novice it is got me lost.

Thanks in advance for the help

the node “Directory.Contents” of which package is .??