如果我要用宏执行此操作,我会加载以下LISP代码:
- (defun c:Insert11x17Border (/ *error* layerName oldClayer)
-
- (defun *error* (msg)
- (and oldClayer (setvar 'clayer oldClayer))
- (cond ((not msg)) ; Normal exit
- ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit)
- ((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it
- )
- (princ)
- )
- (if (tblsearch "layer" (setq layerName "Dimension"))
- (progn
- (setq oldClayer (getvar 'clayer))
- (setvar 'clayer layerName)
- (command "._insert" "I:/borders/11x17" pause "1.0" "1.0" "0.0")
- )
- (*error* (strcat """ layerName "" layer not found"))
- )
- (*error* nil)
- )
... 并使用以下宏之一。。。如果在打开图形时加载LISP文件,则:
- ^C^C^PInsert11x17Border ^P
... 第一次点击按钮时,如果需要加载LISP文件:
- ^C^C^P(if (not c:Insert11x17Border)(load "Insert11x17Border.lsp")) Insert11x17Border ^P
... 假设LISP文件名为“Insert11x17Border.lsp”,并且驻留在SFSP中。 |