Author Topic: Image Path Options  (Read 11748 times)

0 Members and 1 Guest are viewing this topic.

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Image Path Options
« Reply #15 on: March 14, 2012, 09:25:58 PM »
Maybe this will help Mike.

Code: [Select]
(defun _stripimagepath (/ el imgdef path)
  (if (setq imgdef (cdadr (member '(3 . "ACAD_IMAGE_DICT") (entget (namedobjdict)))))
    (foreach x (entget imgdef)
      (and (eq (car x) 350)
   (setq path (cdr (assoc 1 (setq el (entget (cdr x))))))
   (setq path (strcat (vl-filename-base path) (vl-filename-extension path)))
   (findfile (strcat (getvar 'dwgprefix) path))
   (entmod (subst (cons 1 path) (assoc 1 el) el))
      )
    )
  )
  (princ)
)
(_stripimagepath)
« Last Edit: March 19, 2012, 10:49:00 AM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Jeff H

  • Needs a day job
  • Posts: 6150
Re: Image Path Options
« Reply #16 on: March 15, 2012, 01:36:18 AM »
I believe all that needs to be done is grab the 'RasterImageDef' that the RasterImage uses from 'ACAD_IMAGE_DICT' in NOD and set its SourceFileName to just the picture file.
 
 

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Image Path Options
« Reply #17 on: March 15, 2012, 11:48:14 AM »
You get this figured out Mike?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

M-dub

  • Guest
Re: Image Path Options
« Reply #18 on: March 15, 2012, 11:52:11 AM »
No yet.  I have had a few little fires to put out this morning and have a doc's appointment this afternoon... I can't get to it until tomorrow morning.

I will post back though.

Thanks!

ANDYSMI

  • Guest
Re: Image Path Options
« Reply #19 on: March 16, 2012, 10:50:15 PM »
Hi Mike:
You replied to my thread in the VB forum about xref and image file paths. I got to thinking about this thread and did some experimenting and have learned some stuff and might have a solution to your issue or at least shed some light on it. The one caveat is that I did this in 2006, not sure it will work in other versions.
You asked:
Still would like to know if anyone knows how to change the path to NO PATH without detaching the image and reattaching it... 
What I find is this. If I open a drawing with some images attached, I go into the image manager and click on one of the images in the list, the 'Image found at' textbox becomes enabled along with the 'Browse...' and 'Save Path' buttons. We all know we can use this button to fix a broken path. By clicking 'Browse...' we can navigate to a file location, select the file in the 'Select Image File' dialog box and hit open and when we are returned to the image manager, our new path is in the 'Image found at' textbox. We can then click the 'Save Path' button and our new path will be saved as the path of that image. What I found was that you can also use the 'Image found at' textbox, 'Browse...' button and 'Save Path' button to 'fake' a relative path or even no path. Heres how. For a relative path, you just manually type in what AutoCAD uses for a relative path or for no path you just erase or leave blank the 'Image found at' textbox and then click the 'Save Path' button. Done! Now... when you do this you are greeted with a little popup dialog box that says 'Active path is invalid' But if you click 'OK' (the only choice) and then click 'OK' to close the image manager, when you reopen it, sure enough, it now lists your homemade relative path or no path in the list above in the 'Saved Path' column. If you save and close the drawing and reopen it, it sticks. Try it, it works!!! Problem solved Mike?
Now for those of you who may be playing along at home and are wondering how to manualy type in a relative path, you type in a path exactly how AuotCAD creates one when you insert an image and choose relative path from the 'Path Type' dropdown. Make one to see. Lets say we are working in a drawing in a directory named 'Client_Name'. We insert a new image into the drawing by clicking the 'Attach...' button in the Image Manager. We choose an image file and click 'Open' in the 'Select Image File' dialog box. Now we're in the 'Image' Dialog box where we can select an insertion point, scale and rotation as well as pick a 'Path Type' so we pick 'relative path' and click OK and insert our image. Now go back and open the Image Manager and look at the 'Saved Path' column for the image we just inserted. Suppose the image file was in a sub-directory of the 'Client_Name' directory named 'Design'. The relative path will read .\Design\OurImageFile.TIF The leading period means 'This directory'. (anybody who knows Linux has seen this)
You can change the path of an already inserted image to a 'relative' path by typing something like the above into the 'Image found at' textbox and clicking 'Save Path'. When you do you will be greeted by a little popup dialog box that says 'Image file not found. Do you really want to use this path' (I'm not kidding) with 'Yes' and 'No' buttons. Click 'Yes', you will the be greeted by the 'Active path is invalid' dialog mentioned above. Again click OK, close the Image Manager, save the drawing, close it and reopen it and sure enough your relative path works like the real deal. By the way the 'Image file not found' dialog box pops up wheather you type in a legitamate good path or not so don't be discouraged. Also, syntax and spelling include case (upper or lower) count so be careful typing.
So anyhow.... for anybody who hasn't fallen asleep and is still reading this, it is my personal opinion that there is no property or system variable that defines 'path type' in the program. I believe that the 'Path Type' dropdown box in the insert dialog just tells AutoCAD how to format the path. If you choose 'full path' it saves the full path, if you choose 'relative path' it formats it like above and if you choose 'no path' it doesn't save anything in the path property. I believe the registry setting Jeff H. found in the prior post is simply a place the program stores the setting so when you reopen the dialog box next time, your previous choice reappears. That is what the registry is for, saving user settings and such so when you open a window for instance, it reappears in the same place on the screen as when you last had it open. In this way, when you reopen the Image manager, your choice the last time you used 'path type' is still there. I don't think there is a 'default' setting for it.
« Last Edit: March 17, 2012, 01:02:44 AM by andySMI »

M-dub

  • Guest
Re: Image Path Options
« Reply #20 on: March 19, 2012, 08:34:27 AM »
Nice!  I will try this when I get back to the office... Off work with a sick kid today.  :(

Thanks a lot for looking into this, Andy!

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Image Path Options
« Reply #21 on: March 19, 2012, 10:32:03 AM »
From my limited testing, you could add this to your startup and then the paths would be stripped upon open (if found in the same directory).
http://www.theswamp.org/index.php?topic=37809.15

Not sure how to set the default attachment type though.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

M-dub

  • Guest
Re: Image Path Options
« Reply #22 on: March 19, 2012, 10:44:11 AM »
From my limited testing, you could add this to your startup and then the paths would be stripped upon open (if found in the same directory).
http://www.theswamp.org/index.php?topic=37809.15

Not sure how to set the default attachment type though.

Hmmm... That sounds mighty interesting, too!  Thanks, Ron!

KewlToyZ

  • Guest
Re: Image Path Options
« Reply #23 on: March 29, 2012, 08:56:17 AM »
Just out of curiosity, Does anyone use Reference Manager? :|

M-dub

  • Guest
Re: Image Path Options
« Reply #24 on: March 29, 2012, 08:58:20 AM »
Yep, I does!

BlackBox

  • King Gator
  • Posts: 3770
Re: Image Path Options
« Reply #25 on: March 29, 2012, 09:08:41 AM »
Just out of curiosity, Does anyone use Reference Manager? :|
Yep, I does!

1+
"How we think determines what we do, and what we do determines what we get."

KewlToyZ

  • Guest
Re: Image Path Options
« Reply #26 on: March 30, 2012, 08:34:51 PM »
Just out of curiosity, Does anyone use Reference Manager? :|
Yep, I does!

1+
I just always wondered why Reference Manager wasn't part of the XREF manager functionality, and part of it is the way the drawing database mounts when opened as near as I can figure it.

BlackBox

  • King Gator
  • Posts: 3770
Re: Image Path Options
« Reply #27 on: March 31, 2012, 07:16:10 PM »
Speculating... I would think that is due to needing to manipulate the reference paths outside of AutoCAD, no? AFAIK - Reference Manager doesn't work on drawings that are open in editor.
"How we think determines what we do, and what we do determines what we get."