giskumar Posted January 24, 2011 Posted January 24, 2011 Hi All, I have an image attached to the autocad using mapiinsert command. When i select the image i would like to read the name and extension of the image. Is there a way to this. Thanks, Kumar. Quote
MSasu Posted January 24, 2011 Posted January 24, 2011 Not sure about AutoCAD Map – but for raster images inserted in plain AutoCAD you can use the below code: (vl-load-com) (setq theImage (cdr (assoc 1 (entget (cdr (assoc 340 (entget (car (entsel))))))))) (setq thePath (vl-filename-directory theImage) theExtension (vl-filename-extension theImage)) Regards, Mircea Quote
Tyke Posted January 24, 2011 Posted January 24, 2011 When you select the image on screen you should see its name in the properties window. If you have quick properties switched on you will see the name there. Quote
giskumar Posted January 24, 2011 Author Posted January 24, 2011 (setq theImage (cdr (assoc 1 (entget (cdr (assoc 340 (entget (car (entsel))))))))) This really helps me. Thank you all. Quote
MSasu Posted January 24, 2011 Posted January 24, 2011 Sound good! You're welcome! Regards, Mircea Quote
BlackBox Posted January 24, 2011 Posted January 24, 2011 Not sure about AutoCAD Map – but for raster images inserted in plain AutoCAD you can use the below code: (vl-load-com) (setq theImage (cdr (assoc 1 (entget (cdr (assoc 340 (entget (car (entsel))))))))) (setq thePath (vl-filename-directory theImage) theExtension (vl-filename-extension theImage)) (entget nil) ? Perhaps this may be a more viable solution: (defun c:FOO (/ e v) (vl-load-com) (if (and (setq e (car (entsel "\n >> Select an Image: "))) (= "IMAGE" (cdr (assoc 0 (entget e))))) (prompt (strcat "\n >> Image Name >> " (vla-get-name (setq v (vlax-ename->vla-object e))) "\n >> Image Ext. >> " (vl-filename-extension (vla-get-imagefile v))))) (princ)) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.