Missing images files - how to repath multiple files at once?

When opening a certain file I got a missing images dialog. Now I want to point Rhino to a directory to repath all images. But I can only do them one at a time?
I know I can use a search path so that Rhino finds the images, but I want to change the actual path for the file location.
The reason I need this is because when I want to convert the Rhino material to a V-Ray material, the paths of the images need to be correct.

Hi Gijs - so the situation is, the images are all in the same folder, but a different one than Rhino thinks, correct? I don’t know off hand a good way to do this…

-Pascal

@pascal yes this is correct.
If I add a search path, Rhino will find the images but doesn’t change the image paths to this location either. Is this an option somehow?

Yeah… I’m not saying it’s not there, but I do not see a good way to do this. It might be possible in Rhino Common…

@andy - do you know?

-Pascal

The texture names are in place, so all I needed to do is add the paths. Looks like this works:

import scriptcontext as sc

materials = sc.doc.Materials
for material in materials:
    if material.GetBitmapTexture() !=None:
        texturename =  material.GetBitmapTexture().FileName
        path = "D:/path/to/maps/"
        path += texturename
        material.SetBitmapTexture(path)
        material.CommitChanges()
1 Like