mhy3sx Posted April 11 Posted April 11 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 Quote
mhupp Posted April 11 Posted April 11 (edited) I use this to open to the current drawing folder location https://www.cadtutor.net/forum/topic/73166-open-current-file-containing-folder/#comment-581826 -edit But you probably want to select an image so use getfiled (getfiled "Select Image" (getvar 'dwgprefix) "" 16) Edited April 11 by mhupp Quote
mhy3sx Posted April 11 Author Posted April 11 (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 April 11 by mhy3sx Quote
mhy3sx Posted April 11 Author Posted April 11 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 Quote
mhupp Posted April 11 Posted April 11 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 Quote
BIGAL Posted April 12 Posted April 12 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. Quote
pkenewell Posted April 12 Posted April 12 FYI - (getfiled...) will only display a preview image when DWG is used as the extension. See link: https://help.autodesk.com/view/ACD/2024/ENU/index.html?guid=GUID-AD65DF88-5218-4655-B877-B4D33B9FB6D1 1 Quote
mhy3sx Posted April 12 Author Posted April 12 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 Quote
pkenewell Posted April 12 Posted April 12 (edited) 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 April 12 by pkenewell Quote
GP_ Posted April 21 Posted April 21 (edited) 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 April 21 by GP_ 1 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.