这是本人《一个非常好用的AutoCAD工具集》中关于自动加载Ayunger.PGP文件的函数,先与大家分享! 有问题,直接: E-mail:AyungerStudio@163.com或QQ:420304230 ;;******************************** ;;; No.3 AY工具快捷命令初始化 函数 ;;;******************************** (defun C:ayCMD(/ PGPFile fp i xString aList shortCMD GlobalCMD) (vl-load-com) (setq PGPFile "Ayunger.pgp");F:\\Ayungerstudio\\VLisp\\Ayunger.pgp (if (setq PGPFile (findfile PGPFile)) (progn;then (setq fp (open PGPFile "r")) (setq i 1) (while (setq xString (read-line fp)) (if (= (type xString) 'SYM) (setq xString (vl-symbol-name xString)));转换数据文件中无引号的字符串. (while (vl-string-search " " xstring);去掉所有的空格. (setq xString(vl-string-subst "" " " xstring));空格. (setq xString(vl-string-subst "" " " xstring));tab符. );end_while (if (and (/= (substr xString 1 1) ";") (vl-string-search "," xstring) (vl-string-search "*" xstring)) (progn (setq aList (read (strcat "(" (vl-string-subst " . C:" ",*" xString) ")"))) (setq shortCMD (vl-string-trim " " (vl-symbol-name (car aList)))) (setq GlobalCMD (cdr aList)) ;(vlax-remove-cmd shortCMD);删除已定义的命令. (vlax-add-cmd shortCMD GlobalCMD) );end_progn );end_if (setq i (+ i 1)) );end_while read-line (close fp) );end_progn then (princ "\nAY工具简化命令定义文件 Ayunger.pgp 没找到或不存在!") );end_if (princ) );end_defun ;;;┏━━━━━━━━━━━━━━━━━━┓ ;;;┃ AY工具快捷命令自动加载(反应器调用) ┃ ;;;┗━━━━━━━━━━━━━━━━━━┛ (C:ayCMD);调用AY工具快捷命令自动加载函数. (defun ayLoadSCMDReactor();建立AutoCAD文档级反应器. (vl-load-com) (if (not #AY_LOADSCMDREACTOR) (setq #AY_LOADSCMDREACTOR (vlr-docmanager-reactor nil '((:vlr-documentBecameCurrent . AI:aySCMDCallBack)))) );end_if (defun AI:aySCMDCallBack (aReactor bList) (C:ayCMD));;;定义反应器的回调函数. );end_defun (or #AY_LOADSCMDREACTOR (ayLoadSCMDReactor));自动加载反应器. (princ "\nAutoCAD AYunger Tools Copyright (C)2001-2008 AYunger Studio") (prin1)
|