| 只是对李的常规做了一个小改动。。。 
 
 (defun c:psfix ( / #Doc ct lay i ss ent) ;; Initiate Defun and localise Vars  (vl-load-com)  ;; Load Visual LISP Console  (setq ct (getvar "ctab")) ;; Store Current Layout (setq #Doc (vla-get-activedocument (vlax-get-acad-object)))  (foreach lay (layoutlist) ;; For Every Layout in the Drawing      (mapcar 'setvar '("CTAB" "PSLTSCALE") (list lay 1))     ;; Apply the function 'setvar' to each argument in each list.     ;; Setvar needs two arguments, sys var and value, so mapcar needs     ;; two lists.     ;; This is equivalent to putting (setvar "CTAB" lay) (setvar "PSLTSCALE" 1)   [color=Red]    ;(vl-cmdf "_.mspace")  ;; Equivalent to (command "_.mspace")   (and (zerop (getvar 'tilemode)) (vla-put-mspace #Doc :vlax-true))[/color]      (setvar "ANNOALLVISIBLE" 1) ;; Set Sys Var ANNOALLVISIBLE to 1   [color=Red]    ;(vl-cmdf "_.pspace")  ;; Equivalent to (command "_.pspace")   (and (zerop (getvar 'tilemode)) (vla-put-mspace #Doc :vlax-false))[/color] )  ; end foreach (if (setq i -1 ss (ssget "_X" '((0 . "VIEWPORT"))))     ;; If there are Viewports in the Database      (while (setq ent (ssname ss (setq i (1+ i))))     ;; While we can get an entity name in the Selection Set          (vl-catch-all-apply ;; Apply the following function and catch any errors       ;; This is like using 'apply' except the program will not crash if       ;; there is an error executing the function.       'vla-put-displaylocked  ;; Property of the Viewport to determine if it is locked.       ;; List of arguments that belong to 'vla-put-displaylocked'       (list         (vlax-ename->vla-object ent) ;; convert the ename to a VLA-object         :vlax-true) ;; Boolean True - hence the Viewport will be locked              ) ; end vl-catch-all-apply          ) ; end While      ) ; end IF (mapcar 'setvar '("MSLTSCALE" "LTSCALE" "CTAB") (list 1 1 ct)) ;; Same logic as above - read about 'mapcar' to learn more.  (princ) ;; Exit Quietly - i.e. suppress last return) ;; End Defun
 |