Load / reload images into Revit project


Who can help me out?

I am trying to get a modified script from @Konrad_K_Sobon working in my project so I can help someone on the Autodesk Community Forum with his case.
What I want to do is loading and reloading all the images in a specific folder to my Revit project.

I found a post about Reloading images but I can’t get it working.

This is what I get when I run it:

@Mohammad_Nawar helped me out with a script Set parameter of image type and I want to add this script to it.

That error message is typically caused by spaces rather than tabs being used to indent your code. Python uses indents instead of curly brackets to define blocks of code.

If you’ve copied all that code from an online source etc, then you might find every indent are spaces. In that case, the easiest thing to do is highlight the existing indent space for each line, backspace (delete), then tab the line back to the same position. As a fail safe, you should backspace until your line starts on the previous line, hit carriage return (i.e. enter key) then tab, otherwise you’ll risk recurring syntax errors.

Thanks Thomas.
I will follow your instructions.

Didn’t know that.
I Just copied and past the code into the Python node.

Hello Thomas,

I managed to fix the code.
I am not good in using Python script but I thought this code would import all the images from a specific folder into my project.
is that correct?

Or do I need different code.

Hi Robert,
As far I can tell from reading the code it will look at the names of every image in your Revit file and if it finds matching file names in the supplied directory it will reload those images in your project.
If you want to check the filenames that the code is reading from the directory you could try adding this to your OUT node:

OUT = reloadedFiles, fileNames

I am just starting to work through this (and I am no Dynamo expert at all) I also want to just reload all images in a project from the same directory that they are already in.

We use images for our design elements and the designers keep updating them (usually about 20). My hope is to just have a reload all images from same location

This would be no problem in revit if you could select multiple images in the image manager and click reload

I keep getting this error
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 33, in
IndexError: index out of range: 1

Anyway thanks in advance for the help

It means it’s expecting input. Could you show us your complete graph?

got the error removed but still doesn’t reload

ok it looks like it was working just needed to click on one of the images and then they all reloaded (sort of a refresh issue)

I still would like to have a couple of other things to make it perfect some might not be able to do

  1. have it look in a relative path location (so not to manual path to a directory)
  2. autorun upon startup or at the least printing.

Once again thanks for the help.

Not pretty but it works just fine. The only thing is to make sure the file is saved before you run the script. This atleast reloads all the jpegs in the saved directory without manual pathing. If anyone has a cleaner way of doing it let me know. or away to autosave the file before

the script runs

well I thought I had it but then I did it on a live project and enabled worksets. this makes you file local. so I used the node Document.CentralPath. and it looked correct, but once I run it it only reloaded 1 jpeg ugh.

any help would be great thanks once again