0 Members and 1 Guest are viewing this topic.
You're welcome Deegs. Could you post one of the drawings? No need for the images, I just want to see if I can get them to repath with the code, as it was working here.
You can do this type of thing with ObjectDBX, so you could run through a folder pretty quickly. Could be done in any language your comfortable with also.
I'm glad you got something, but you shouldn't have to resort to ' command ' calls.
(defun c:im_upd2 (/ new_path img_file_name) (setq new_path (GETVAR "DWGPREFIX")) (vlax-for i (vla-get-Layouts (vla-get-ActiveDocument (vlax-get-Acad-Object))) (if (= (vla-get-Name i) "00") (vlax-for item (vla-get-Block i) (if (and (= (vla-get-objectname item) "AcDbRasterImage") (vlax-property-available-p item 'ImageFile) ) (progn (setq img_file_name (strcat (vl-filename-base (vla-get-ImageFile item)) (vl-filename-extension (vla-get-ImageFile item)) ) ) (print (vla-get-ImageFile item)) (vla-put-imagefile item (strcat new_path img_file_name) ) (print (vla-get-ImageFile item)) ) ) ) ) ) (princ));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;defun---End Prog
error: Automation Error. File access error
Quoteerror: Automation Error. File access error I'm using 04 btw...
(defun c:im_upd2 (/ new_path img_file_name *error*) (defun *error* (msg) (vl-bt)) (setq new_path (GETVAR "DWGPREFIX")) (vlax-for i (vla-get-Layouts (vla-get-ActiveDocument (vlax-get-Acad-Object))) (if (= (vla-get-Name i) "00") (vlax-for item (vla-get-Block i) (if (and (= (vla-get-objectname item) "AcDbRasterImage") (vlax-property-available-p item 'ImageFile) ) (progn (setq img_file_name (strcat (vl-filename-base (vla-get-ImageFile item)) (vl-filename-extension (vla-get-ImageFile item)) ) ) (print (vla-get-ImageFile item)) (vla-put-imagefile item (strcat new_path img_file_name) ) (print (vla-get-ImageFile item)) ) ) ) ) ) (princ));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;defun---End Prog