;; 未经测试,慎用!- ;; 将folderlst里边的全路径目录添加到cad搜索支持
- (defun addsearchs (folderlst)
- (setenv "ACAD"
- (strcat (getenv "ACAD")
- (apply 'strcat
- (mapcar '(lambda (x) (strcat ";" x)) folderlst)
- )
- )
- )
- )
- ;; PathAll 指定目录下的所有子目录 (PathAll path)
- (defun PathAll (PathName / lst1 lst2 pa a pa1 b)
- (setq lst1 (list PathName)
- lst2 lst1
- )
- (while (setq pa (car lst1))
- (setq lst1 (cdr lst1))
- (foreach a (setq lst (cddr (vl-directory-files pa nil -1)))
- (setq pa1 (strcat pa "/" a))
- (if (setq b (cddr (vl-directory-files pa1 nil -1)))
- (setq b (mapcar '(lambda (x) (strcat pa1 "/" x)) b)
- lst2 (append b lst2)
- lst1 (append b lst1)
- )
- )
- )
- )
- (reverse lst2)
- )
- ;;主程序
- (defun c:tt ()
- (if (setq lst (PathAll "d:\\xcad"))
- (addsearchs lst)
- )
- (princ)
- )
|