也许有点像。。。
- (defun lt_load (ltname / StrBrk DCTAG F FILES FLAG FN L LLST LST NL PATH TFILE TMP)
- ;; String Breaker by Lee McDonnell
- (defun StrBrk (str chrc / pos lst)
- (while (setq pos (vl-string-position chrc str))
- (setq lst (cons (substr str 1 pos) lst)
- str (substr str (+ pos 2))))
- (reverse (cons str lst)))
- (foreach Path (vl-remove "" (StrBrk (getenv "ACAD") 59))
- (and (setq files (vl-directory-files Path "*.lin" 1))
- (setq lst (append lst (mapcar (function (lambda (x) (strcat Path "\" x))) files)))))
- (foreach file lst
- (setq tmp (open file "r"))
- (while (setq nl (read-line tmp))
- (and (eq "*" (substr nl 1 1))
- (eq (strcase ltname)
- (setq l (strcase (car (StrBrk (substr nl 2) 44)))))
- (setq llst (cons (cons l (strcat (vl-filename-base file) ".lin")) llst))))
- (close tmp))
- (if lLst
- (if (< 1 (length lLst))
- (progn
- (setq fn (open (setq tfile (vl-filename-mktemp "" "" ".dcl")) "w"))
- (foreach str '("lt_dcl : dialog { label = "Select Load File"; spacer;"
- ": popup_list { alignment = centered; key = "flin"; } spacer; ok_cancel; } ")
- (write-line str fn))
- (close fn)
- (if (and (<= 0 (setq dcTag (load_dialog tFile)))
- (new_dialog "lt_dcl" dcTag))
- (progn
- (start_list "flin")
- (mapcar 'add_list (mapcar 'cdr lLst)) (end_list)
- (setq f (car lLst))
- (action_tile "flin" "(setq f (nth (atoi $value) lLst))")
- (action_tile "accept" "(done_dialog 1)")
- (action_tile "cancel" "(done_dialog 0)")
- (setq flag (start_dialog))
- (unload_dialog dcTag)))
- (vl-file-delete tfile))
- (setq flag 1 f (car lLst))))
- (if (eq flag 1)
- (vla-load
- (vla-get-linetypes
- (vla-get-ActiveDocument
- (vlax-get-acad-object))) (car f) (cdr f)))
- (and (tblsearch "LTYPE" ltname)))
现在这对我来说很好(尽管这是一个混乱的;-|…)调用命令“createlayer”时。然后我把它们都填好,它就开始工作了。
但是如果我通过宏使用它,那么它确实可以工作,但层不能获得电流。
这是一个以前从未有过的例程,它在宏中的工作方式与在命令栏中的不同。宏位于工具选项板中,这可能就是问题所在。
谁能给我解释一下怎么解决这个问题?(因此,将从toolpalette中使用createlayer函数,以便将其设置为当前)。
提前谢谢。 |