Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey all! I have a script that pulls exported .dxf files from a Windows folder and batch inserts them into AutoCAD as blocks stacked vertically in the -Y direction. This script works great except that I have to guess the spacing increment and do some ctrl-z trial and error.
Is it possible to get the local max Y coordinate of the last inserted block, like with like (ssname (ssget "_L") 0), so that I can move the last inserted block based on that value?
(defun c:BI ( / DPATH DWGLST I MSG PT)
(vl-load-com)
(vla-StartUndoMark (setq *DOC* (vla-get-ActiveDocument (vlax-get-acad-object))))
(if (and (setq dpath (getfiled "Open a file in the DXF folder" (strcat (getenv "userprofile") "/Documents/") "" 8))
(setq i (getreal "\nEnter vertical spacing: "))
);; and
(progn
(setq
dpath (substr dpath 1 (- (strlen dpath) (vl-string-search "\\" (vl-list->string (reverse (vl-string->list dpath))))))
dxflst (vl-directory-files dpath "*.dxf" 1)
pt '(0. 0. 0.)
)
(foreach dxf dxflst
(command ".-insert" (strcat dpath dxf) pt "" "" "")
(setq
pt (list 0. (- (cadr pt) i) 0.)
)
);; foreach
);; progn
);; if
(princ)
(vla-EndUndoMark *DOC*)
)
Solved! Go to Solution.