我真的需要试试Visual LISP编辑器。我大多数简单的工作(蝙蝠、林等)都使用记事本++ 不客气
即使你不喜欢编辑器本身-帮助文件是必不可少的。。。 李,
使用以下工具的优势是什么:
vl-cmdf
vs。
command
? vl cmdf在继续之前评估参数的有效性-命令不会。 你知道vl、vla、vlax函数的好参考以及如何使用它们吗? 只是对李的常规做了一个小改动。。。
(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)
;(vl-cmdf "_.mspace");; Equivalent to (command "_.mspace")
(and (zerop (getvar 'tilemode)) (vla-put-mspace #Doc :vlax-true))
(setvar "ANNOALLVISIBLE" 1) ;; Set Sys Var ANNOALLVISIBLE to 1
;(vl-cmdf "_.pspace");; Equivalent to (command "_.pspace")
(and (zerop (getvar 'tilemode)) (vla-put-mspace #Doc :vlax-false))
); 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
是的,Visual LISP编辑器帮助文件
干杯,艾伦,下次我会注意到的 没问题。
以防万一你不知道。 太棒了,谢谢你们。
我会学这些东西,如果它杀了我。。。 我的收藏:
http://www.theswamp.org/index.php?topic=7097.0
页:
1
[2]