0 Members and 1 Guest are viewing this topic.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Xref Images Function ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;(defun C:Images () (setvar "ctab" "A0-0 COVER") (setvar "filedia" 0) (setenv "XLOADPATH" (getvar "dwgprefix")) (initget 1 "V A F") (setq tmp (getkword "\n* Xref Images: [V]icinity map [A]erial image [F]ront elevation *")) (if (not tmp) (setq tmp "P")) (cond ((= "V" tmp) (command "IMAGEATTACH" "Vicinity Map.png")) ((= "A" tmp) (command "IMAGEATTACH" "Aerial Image.png")) ((= "F" tmp) (command "IMAGEATTACH" "Front Elevation.png"))) (setvar "filedia" 1) (princ))
(setq owner (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))) imageName "c:\\legit_path\\legit_file_name.cal" insertionPoint '(0.0 0.0 0.0) scalefactor 1.0 rotationAngle 0.0)(vlax-invoke owner 'AddRaster imageName insertionPoint scalefactor rotationAngle)
Ron, your routine works like mine. I would like to set the image without the dialog box...Setting the insertion point, scale etc thru lisp....
Ron, what is spc(vlax-invoke (vla-get-paperspace spc) 'addraster f p 1. 0.)
(defun C:IMG-vicinity (/ d pvicinity i p) (setq d (vla-get-activedocument (vlax-get-acad-object))) (setvar "ctab" "A0-0 COVER") (setvar 'filedia 0) (setq i "V") (if (and (findfile (setq f (strcat (getvar 'dwgprefix) (car (vl-remove-if-not '(lambda (x) (wcmatch x (strcat i "*"))) '("Vicinity Map.png") ) ) ) ) ) (setq pvicinity '(3.85156 14.0 0.0)) ) (vlax-invoke (vla-get-paperspace d) 'addraster f pvicinity 10.0 0.0) (print (strcat f " NOT FOUND!!!")) ) (setvar 'filedia 1) (princ))(defun C:IMG-aerial (/ d paerial i p) (setq d (vla-get-activedocument (vlax-get-acad-object))) (setvar "ctab" "A0-0 COVER") (setvar 'filedia 0) (setq i "A") (if (and (findfile (setq f (strcat (getvar 'dwgprefix) (car (vl-remove-if-not '(lambda (x) (wcmatch x (strcat i "*"))) '("Aerial Image.png") ) ) ) ) ) (setq paerial '(3.85156 2.39844 0.0)) ) (vlax-invoke (vla-get-paperspace d) 'addraster f paerial 10.0 0.0) (print (strcat f " NOT FOUND!!!")) ) (setvar 'filedia 1) (princ))(defun C:IMG-front (/ d pfront i p) (setq d (vla-get-activedocument (vlax-get-acad-object))) (setvar "ctab" "A0-0 COVER") (setvar 'filedia 0) (setq i "F") (if (and (findfile (setq f (strcat (getvar 'dwgprefix) (car (vl-remove-if-not '(lambda (x) (wcmatch x (strcat i "*"))) '("Front Elevation.png") ) ) ) ) ) (setq pfront '(19.4766 2.39844 0.0)) ) (vlax-invoke (vla-get-paperspace d) 'addraster f pfront 10.0 0.0) (print (strcat f " NOT FOUND!!!")) ) (setvar 'filedia 1) (princ))(C:IMG-FRONT)(C:IMG-AERIAL)(C:IMG-VICINITY)
Thanks again RON
Yes the name in the xref manager.
SWEET...works perfectlyThanks again
Be aware that that sometimes the name does not update in the xref manager palette, but it should be renamed.
Quote from: ronjonp on May 03, 2018, 09:39:41 AMBe aware that that sometimes the name does not update in the xref manager palette, but it should be renamed.If you rename an xref / image def thru code you can force it to update in the xref palette by forcing a reload (vla-reload block_or_image_def).