Author Topic: Image path question  (Read 2202 times)

0 Members and 1 Guest are viewing this topic.

V-Man

  • Bull Frog
  • Posts: 343
  • I exist therefore I am! Finally Retired!
Image path question
« on: February 22, 2005, 11:59:00 AM »
How do I go about stripping an images saved path?

I use the below code for stripping xref saved paths...

Code: [Select]

(defun c:spath (/ BLKNAM CNT XNAME)
(prompt "\n[X-REPATH] - Strips all Xref paths.")
(prompt "\nX-REPATH Working... please wait ")
(setq CNT 1)
(while (setq BLKNAM (tblnext "BLOCK" CNT))
(setq CNT nil)
(if (and (/= (assoc 1 BLKNAM) nil)
(> (- (strlen (cdr (assoc 1 BLKNAM))) 4)
(strlen (cdr (assoc 2 BLKNAM)))
)
)
(command ".xref" "path" (cdr (assoc 2 BLKNAM)) (cdr (assoc 2 BLKNAM)) )
)
)
(prompt "\nX-REPATH Done! ")
(princ)
)
AutoCAD 9 - 2023, AutoCADMap 2008 - 2010, Revit 2012 - 2022, Autocad Civil 3D 2023

daron

  • Guest
Image path question
« Reply #1 on: February 22, 2005, 01:22:27 PM »
Images are a little bit more complicated and I've only found it possible through ActiveX. Even that is difficult. If you don't get too much further here, I'll see what I can drudge up on image paths. The problem with repathing is, at least for me, it seemed that the image was active, even though it was pathed wrong and changing it was like renaming a file that's open.

V-Man

  • Bull Frog
  • Posts: 343
  • I exist therefore I am! Finally Retired!
Image path question
« Reply #2 on: February 22, 2005, 01:50:41 PM »
I came up with this so far...

Code: [Select]

(setq imagedict (dictsearch (namedobjdict) "ACAD_IMAGE_DICT"))
AutoCAD 9 - 2023, AutoCADMap 2008 - 2010, Revit 2012 - 2022, Autocad Civil 3D 2023

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Image path question
« Reply #3 on: February 22, 2005, 01:55:28 PM »
How about an activeX method.
Code: [Select]

(vl-load-com)
(vlax-for obj
  (vla-get-modelspace
(vla-get-activedocument (vlax-get-acad-object))
)
   (if
(= (vlax-get-property obj 'ObjectName) "AcDbRasterImage")
 (setq img_path (vlax-get-property obj 'ImageFile))
 )
   )
TheSwamp.org  (serving the CAD community since 2003)