Jump to content

Help: Insert image lisp


mhy3sx

Recommended Posts

Hi, I use imageattach command to insert image in the drawings. The problem is every time I fave to search in the directories until find drawing folder. Is any way after call imageattach command to open drawing directory ?

 

Thanks

Link to comment
Share on other sites

Posted (edited)

Hi mhupp , I try this

 

(defun c:test ( / ins lst ang scale )
   (if
       (and
           (setq lst (getfiled "Select Image" (getvar 'dwgprefix) "" 16))
           (setq ang 0) ; Set the angle to 0
           (setq scale 1) ; Set the scale to 1
       )
       (command "_.imageattach" lst "Specify On-Screen" scale ang) 
   (princ)
)

 

 

Is any other better way?

 

Thanks

Edited by mhy3sx
Link to comment
Share on other sites

I want to ask something. Why I can not see the preview of the select image? Is something wrong with the code?

 

(defun c:insimg ( / lst ang scale )
   (if
       (and
           (setq lst (getfiled "Select Image" (getvar 'dwgprefix) "" 16))
           (setq ang 0) ; Set the angle to 0
           (setq scale 1) ; Set the scale to 1
       )
       (command "_.imageattach" lst "Specify On-Screen" scale ang) 
   (princ)
)
)

 

 

Thanks

Screenshot 2024-04-12 003753.jpg

Link to comment
Share on other sites

1 hour ago, mhy3sx said:

Why I can not see the preview of the select image?

¯\_(ツ)_/¯

 

No but really does the file have/had a preview in regular windows? then it should have a preview there too.

 

See if this is checked

 

2012-preview.png.jpg.90715981cc1e8d2c05fdf6fa1361f7ef.jpg.599d1a3dd490fa9d0ce9236a6839e836.jpg

 

Link to comment
Share on other sites

If you want to see a preview then set explorer to show a preview, then simply drag and drop onto cad. It will ask for scale and rotation.

Link to comment
Share on other sites

Thanks for reply.  Why when I select Insert--> Raster Image  the window is different and I can see in the preview the image and with the (command "_.imageattach" lst "Specify On-Screen" scale ang) I can't  , isn't the same command ?

 

Thanks

2.jpg

1.jpg

3.jpg

Link to comment
Share on other sites

58 minutes ago, mhy3sx said:

isn't the same command ?

@mhy3sx No. the IMAGEATTACH command is built-in to AutoCAD, not AutoLISP, and it has its own file dialog that is not exposed to the AutoLISP API.

Edited by pkenewell
Link to comment
Share on other sites

  • 2 weeks later...

Try this, Express Tools required

 

(setq scale 10.0 ang 0.0)
    
(if (setq :imm (acet-ui-getfile "Select Image" (getvar"dwgprefix") "jpg;*;png;tif;bmp" "" 288))
    (command "_.-attach" :imm pause scale ang)
)

 

 

Edited by GP_
  • Like 1
Link to comment
Share on other sites

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...