Jump to content

Recommended Posts

Posted

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.

Posted

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

Posted

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.

Posted

(setq theImage

(cdr (assoc 1 (entget (cdr (assoc 340 (entget (car (entsel)))))))))

 

 

This really helps me.

 

Thank you all.

Posted

Sound good! You're welcome!

 

Regards,

Mircea

Posted
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))

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...