稍微修改
 - [FONT=courier new];; 读CAD搜索路径内幻灯片库里面的名称,返回名称的表
- ;; 不要带路径和扩展名
- ;; (read-slb->sldnames "NORTH")
- (defun read-slb->sldnames (slbname / sf ex n
- id app appstr namestr nth1
- nth2 nth3 nth4 nth5
- )
- (if (setq sf (findfile (strcat slbname ".slb")))
- (progn
- (setq app nil
- n 0
- id (open sf "r")
- )
- (read-line id)
- (setq ex (read-char id)
- app (read-line id)
- app (vl-remove 'nil (vl-string->list app))
- )
- (while (and (/= 101 (last app))
- (read-char id)
- (setq ex (read-line id))
- )
- (setq app
- (append app
- (cons 1 (cons 1 (vl-remove 'nil (vl-string->list ex))))
- )
- )
- )
- (close id)
- (setq app (cdr (cdr app))
- app (cons 1 (cons 1 app))
- )
- (foreach x app
- (cond
- ((and (< 0 x) (not nth1)) (setq nth1 x))
- ((and nth1 (not nth2)) (setq nth2 x))
- ((and nth2 (not nth3)) (setq nth3 x))
- ((and nth3 (not nth4)) (setq nth4 x))
- ((and nth4 (not nth5)) (setq nth5 x))
- )
- (if (and nth1 nth2 nth3 nth4 nth5)
- (if (and (< 0 nth1) (< 0 nth2) (< 0 nth5) (= 0 nth4))
- (if (/= x 0)
- (setq namestr (append namestr (list x)))
- (setq appstr (append appstr (list namestr))
- namestr nil
- nth1 nil
- nth2 nil
- nth3 nil
- nth4 nil
- nth5 nil
- )
- )
- (setq nth1 nil
- nth2 nil
- nth3 nil
- nth4 nil
- nth5 nil
- )
- )
- )
- )
- (acad_strlsort (mapcar 'vl-list->string appstr))
- )
- (alert (strcat "\nCAD搜索路径内未找到名为 "
- slbname
- ".SLB"
- " 的幻灯片库!"
- )
- )
- )
- )[/FONT]
|