- ;;说明:获得图档中包含的填充图案列表
- ;;返回:填充图案列表
- (defun lm-get-hatchlist (/ lst )
- (defun unique ( lst )
- (if lst (cons (car lst) (unique (vl-remove (car lst) (cdr lst)))))
- )
- (defun fixdir ( str )
- (vl-string-right-trim "\\" (vl-string-translate "/" "\\" str))
- )
- (defun parsesupportpaths ( str / pos )
- (if (setq pos (vl-string-position 59 str))
- (vl-remove "" (cons (substr str 1 pos) (parsesupportpaths (substr str (+ pos 2)))))
- (list str)
- )
- )
- (defun parsepatfile ( fn / fd hp ln )
- (if
- (and
- (setq fn (findfile fn))
- (setq fd (open fn "r"))
- )
- (progn
- (while (setq ln (read-line fd))
- (if (wcmatch ln "`**`,*")
- (setq hp (cons (strcase (substr ln 2 (1- (vl-string-position 44 ln)))) hp))
- )
- )
- (close fd)
- (reverse hp)
- )
- )
- )
-
- (foreach dir (cons (getvar 'dwgprefix) (parsesupportpaths (getenv "ACAD")))
- (foreach pat (vl-directory-files dir "*.pat" 1)
- (setq lst (cons (parsepatfile (strcat (fixdir dir) "\\" pat)) lst))
- )
- )
- (vl-sort (unique (apply 'append lst)) '<)
- )
|