I have a some logos that I am trying to repath, Rename and make relative. It is suppose to look thru all the images for a desired name and the swap it for a another image with a different name and rename the image and make relative, I got 2 out of the 3 to work but when it comes to changing the name it changes the last image in the list, I thought my "IF" statement would have captured it and done all three to the correct image but it is not and driving me crazy to figure out. Any assistance would be wonderful, thanks
(defun c:test ( / );|el newpath oldName)|; (vl-load-com)
(setq ActiveDocument (vla-get-ActiveDocument (vlax-get-acad-object)))
;-----------------------------------------------------------------------------------------
(vla-StartUndoMark ActiveDocument) ;Start of UNDO
;-----------------------------------------------------------------------------------------
(setq newPath "D:\\Beer\\New folder\\Logo.png"
Name "*Stout*"
newName "Logo"
relPath "Logo.png"
)
(foreach imagedef (mapcar 'cdr
(vl-remove-if-not
'(lambda (x) (= (car x) 350))
(dictsearch (namedobjdict) "acad_image_dict")
)
)
(setq el (entget imagedef))
(if (wcmatch (cdr (assoc 1 el)) Name)
(progn
(entmod (setq el (subst (cons 1 newPath) (assoc 1 el) el))); set path
(entmod (setq el (subst (cons 1 relPath) (assoc 1 el) el))); set relative path
(setq x (entget (cdr (assoc 330 el)))); enter dictionary
(entmod (subst (cons 3 newName) (assoc 3 x) x)); & change name
)
)
)
(command "-image" "reload" "*")
;-----------------------------------------------------------------------------------------
(vla-EndUndoMark ActiveDocument) ;End of UNDO
;-----------------------------------------------------------------------------------------
(princ)
)