Program to update Raster Image file path

Program to update Raster Image file path

tcoley95E9Z
Enthusiast Enthusiast
711 Views
7 Replies
Message 1 of 8

Program to update Raster Image file path

tcoley95E9Z
Enthusiast
Enthusiast

Hello,

 

I've been trying to teach myself AutoLISP solely to fix the pesky issue of my raster images being blown in my projects every time I open them. The only thing I have been able to find was the use of the (-image) command and action recorder. Because you need to know the name or file path already within (-image) instead of just selecting on the wanted image, I have been trying to make a program that stores the image name and current file path from selection and then inputs it into the (-image) command. For example:

 

After typing -image in command prompt, you are given a list of options. The actrecord will select the Path option. From there when you are prompted to insert a new file path (in this case its the exact same because they're blown images), the program will take the stored file path and input it there.

 

I know its a lot but searching through as many forums I can get, this might be the best way. If not, I would love to hear your opinions on how best to go about fixing these broken raster images.

 

Thanks.

0 Likes
712 Views
7 Replies
Replies (7)
Message 2 of 8

pendean
Community Legend
Community Legend

@tcoley95E9Z wrote:

...solely to fix the pesky issue of my raster images being blown in my projects every time I open them.....


What does that mean please? Pathing for images is the same as pathing for XREFs, you always want to ensure they are live when you open a DWG file with them in it.

Explain when you can the entire process (where you store the images compared to the DWG files, what pathing if any do you actively set them to be) and we can help you just fix it once and for all.

 

TIA

0 Likes
Message 3 of 8

tcoley95E9Z
Enthusiast
Enthusiast
Sorry about that,

We use a shared cloud for all of our images so often times we have to deal with our raster images being 'not found' despite the same file path. It gets really tedious with bigger projects. I know that most times AutoCAD will have an option to apply same file path to other broken images but sometimes that doesn't work either.

The pathing I set them to be is the exact same. That's why I want the program to store the current images file path as a variable I can call to it when I'm prompted (from -image) to update the images path
0 Likes
Message 4 of 8

Sea-Haven
Mentor
Mentor

You can store information in a dwg I would look at LDATA, for this. Just Google "Ldata Autocad lisp".

 

Yes have lost images because the image was stored on local drive, not server, we always saved images to same location as dwg so much easier.

0 Likes
Message 5 of 8

tcoley95E9Z
Enthusiast
Enthusiast
Thanks! I'll check it out
0 Likes
Message 6 of 8

tcoley95E9Z
Enthusiast
Enthusiast
Looking back today, I see that for whatever reason, the XREF file path is consistent except for the first few directories. Ex:

..\..\..\..\..\Photos\Xref Photo

Do you know of any code that can copy this current directory? I think the best way to go about it is to store the above directory and then call it with the missing paths. Kind of like this:

"C:\Users\foo\" + [stored variable]
0 Likes
Message 7 of 8

Sea-Haven
Mentor
Mentor

Ldata as suggested.

 

(vlax-ldata-put "IMAGES" "PATH" "Photos\\Xref Photo"))

(setq imagepath (vlax-ldata-get "IMAGES" "PATH"))
0 Likes
Message 8 of 8

tcoley95E9Z
Enthusiast
Enthusiast
Thanks! How would I incorporate this to my code? I apologize I'm very new to autoLISP.

For instance, if I wanted to update the raster image path by selection, would the "IMAGES" reference in vlax-ldata-put be replaced with my ssget?
0 Likes