(vl-load-com)
;;; Equal Image and Xref Names in drawing to External Images and Xrefs Names (Lee Mac Program)
;;; Modified by Igal Averbuh 2016 (added reloading of all images after main process)

(defun c:rai (/)
(vl-load-com)
(vl-cmdf "_.-image" "r" "*")
(princ)
)

(defun c:ein ( / dic img itm lst )
(if (setq lst (dictsearch (namedobjdict) "acad_image_dict")
dic (cdr (assoc -1 lst))
)
(while (setq lst (member (assoc 3 lst) lst))
(setq itm (cdr (assoc 3 lst))
img (vl-filename-base (cdr (assoc 1 (entget (cdr (assoc 350 lst))))))
lst (cdr lst)
)
(if (not (or (= img itm) (dictsearch dic img)))
(dictrename dic itm img)
)
)
)
(princ)
)

(defun c:exn (/ name)
(vlax-For blk (vla-Get-Blocks
(vla-Get-ActiveDocument (vlax-Get-Acad-Object))
)
(if
(and
(= (vla-Get-IsXref blk) :vlax-True)
(not
(wcmatch (vla-get-Name blk)
(setq
name (vl-filename-base (setq path (vla-get-path blk)))
)
)
)
)
(if
(not
(vl-catch-all-error-p
(vl-catch-all-apply '(lambda () (vla-put-Name blk name)))
)
)
(vla-reload blk)
)
)
)
(princ)
)
(c:exn)
(c:ein)
(c:rai)

Advertisements