;; Report about amount of xrefs and it's names for all dwg's in a user selected folder
(defun c:xr()
(vl-load-com)
(setq dir (vl-directory-files (setq dirname (strcat (vl-filename-directory (getfiled "Open file folder" (getvar "dwgprefix") "dwg" 4) ) "\\")) "*.dwg" 1))
(foreach file dir
(if (and (/= file ".") (/= file ".."))
(progn
(setq odbx (vla-GetInterfaceObject (vlax-get-acad-object) (strcat "ObjectDBX.AxDbDocument." (itoa (atoi (getvar "AcadVer"))))))
(vla-open odbx (strcat dirname file))
(setq st "" n 0)
(vlax-for item (vla-get-Blocks odbx)
(if (= (vla-get-IsXRef item) :vlax-true)
(setq st (strcat st (vla-get-Name item) "; ")
n (1+ n))
)
)
(if (/= st "")
(princ (strcat "\nFile " (vla-get-Name odbx) " has " (itoa n) " Xref" (if (> n 1) "s" "") " : " st)))
(vlax-release-object odbx)
)
)
)
(textscr) (princ)
)
(c:xr)

Advertisements