@Kent1CooperI made some modifications, It works but it selects images in these order: 1,10,100,101,102,103,104,105,106,107,108,109,11,110,...
I want the order to be like 1,2,3,4,... and I want them to be arranged horizontally instead of vertically.
here is the code I modified.
(defun c:BC (/ blkfolder space nextLL rowht rowL blkLL blkUR objwid objht)
(vl-load-com)
(setvar 'osmode 0)
(alert "Pick OK here, then double-click any file in desired folder: ")
(setq
blkfolder (getfiled "Find folder" "" "png" 0)
blkfolder (substr blkfolder 1 (1+ (vl-string-position 92 blkfolder 1 T))); path without dwg name
space 1 ; between blocks and min. from limits <------ set as desired
nextLL (mapcar '+ (getvar 'limmin) (list space space 0)); lower left of next block
rowht 0 ; height of tallest block in row
rowL nextLL; left end of baseline of row
); end setq
(foreach blk (vl-directory-files blkfolder "*.png" 1)
(command "_.imageattach" (strcat blkfolder blk) (getvar 'viewctr) "" "" "")
(vla-getboundingbox (vlax-ename->vla-object (entlast)) 'minpt 'maxpt)
(setq
blkLL (vlax-safearray->list minpt)
blkUR (vlax-safearray->list maxpt)
objwid (- (car blkUR) (car blkLL))
objht (- (cadr blkUR) (cadr blkLL))
)
(if (> (+ (car nextLL) objwid space) (car (getvar 'limmax)))
(setq ; then - start new row above previous row
nextLL (polar rowL (/ pi 2) (+ rowht space))
rowL nextLL
rowht 0
); end setq
); end if - no else [next in current row]
(command "_.move" (entlast) "" blkLL nextLL)
(setq nextLL (polar nextLL 0 (+ objwid space)))
(if (> objht rowht) (setq rowht objht))
); end foreach
); end defun