请教,以下内容要如何理解?
本帖最后由 liuhaixin88 于 2014-5-17 08:47 编辑To set and restore system variables, you can also the ai_sysvar function.
This function is available in AutoCAD since a while.
It's defined in acaddoc20XX.lsp (ai_utils.lsp or acad.mnl in older versions), so it's automatically loaded in each document.
Quote
;;; --- ai_sysvar ------------------------------------------
;;; Change system variable settings and save current settings
;;; (Note: used by *merr* to restore system settings on error.)
;;;
;;; The <vars> argument is used to...
;;; restore previous settings (ai_sysvar NIL)
;;; set a single sys'var (ai_sysvar'("cmdecho" . 0))
;;; set multiple sys'vars (ai_sysvar '(("cmdecho" . 0)("gridmode" . 0)))
;;;
;;; defun-q is needed by Visual Lisp for functions which redefine themselves.
;;; it is aliased to defun for seamless use with AutoLISP.
Anywhere in the code, you can call ai_sysvar to save the current value of one or more sysvar and set it a new value (or not).
Example:
[*];; save and set "osmode" to 0
(ai_sysvar '("osmode" . 0))
...
;; save and set "orthomode" to 1 and only save "autosnap"
(ai_sysvar '(("orthomode" . 1) ("autosnap" . nil)))
...
;; restor all sysvars
(ai_sysvar nil)
<EDIT> I forgot to say, the implementation of ai_sysvar is quite interesting with the use of defun-q which allows to store the list of var names ans values within the function.
本帖最后由 自贡黄明儒 于 2014-5-17 10:14 编辑
找到ai_sysvar的定义,一切都清楚了
http://www.askcad.com/bbs/thread-47222-1-1.html
页:
[1]