我使用的是秋风的二次开发安装程序,其中 ;;; 判断是否加载本文件 (if (car (atoms-family 1 '("vl-load-com"))) (vl-load-com) ;;else (progn (Alert "这个程序集是为AutoCAD 2000以及更高的版本设计的,许多程序有可能在没有Visual Lisp for R14支持的AutoCAD R14上不能正确地运行。" ) (exit) ; 版本不符,退出加载。 ) ) ;;; 以下定义文件中用到的函数 ;;;---------------------------------------------------------------------------------- ;;; 取得本程序的路径 ;;; --------------------------------------------------------------------------------- (defun GetMyApplicationPath (AppID) (vl-registry-read (strcat "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" AppID "_is1" ) "Inno Setup: App Path" ) ) (defun GetsceiPath () (GetMyApplicationPath "1") ) ;;; 解析字符串为表(函数来自明经通道转载) ;;; --------------------------------------------------------------------------------- (defun strParse (Str Delimiter / SearchStr StringLen return n char) (setq SearchStr Str) (setq StringLen (strlen SearchStr)) (setq return '()) (while (> StringLen 0) (setq n 1) (setq char (substr SearchStr 1 1)) (while (and (/= char Delimiter) (/= char "")) (setq n (1+ n)) (setq char (substr SearchStr n 1)) ) ;_ end of while (setq return (cons (substr SearchStr 1 (1- n)) return)) (setq SearchStr (substr SearchStr (1+ n) StringLen)) (setq StringLen (strlen SearchStr)) ) ;_ end of while (reverse return) ) ;_ end of defun ;;; 反解析表为字符串(函数来自明经通道转载) ;;; --------------------------------------------------------------------------------- (defun StrUnParse (Lst Delimiter / return) (setq return "") (foreach str Lst (setq return (strcat return Delimiter str)) ) ;_ end of foreach (substr return 2) ) ;_ end of defun ;;; 移除支持文件搜索路径 ;;; --------------------------------------------------------------------------------- (defun RemoveSupportPath (PathToRemove / supportlist) (setq supportlist (strparse (getenv "ACAD") ";")) (setq supportlist (vl-remove "" supportlist)) (setq supportlist (vl-remove-if '(lambda (x) (= (strcase x) (strcase PathToRemove))) supportlist ) ) (setenv "ACAD" (strUnParse supportlist ";")) ) ;;; 添加支持文件搜索路径 ;;; --------------------------------------------------------------------------------- ;;; note: 第二个参数如果为真, 插最前,否则插最后 ;;; (defun AddSupportPath (PathToAdd isFirst / supportlist) (RemoveSupportPath PathToAdd) (setq supportlist (strparse (getenv "ACAD") ";")) (setq supportlist (vl-remove "" supportlist)) (if isFirst (setq supportlist (cons PathToAdd supportlist)) (setq supportlist (append supportlist (list PathToAdd))) ) (setenv "ACAD" (strUnParse supportlist ";")) ) ;;; 根据不同的AutoCAD版本加载不同的菜单文件: (defun Load_sceiMenu (/ acadver) (setq acadver (atof (getvar "acadver"))) (cond ((and (>= acadver 15.0) (< acadver 16.0)) (command "_menuload" "scei.mnu") ) ((and (>= acadver 16.0) (<= acadver 16.1)) (command "_menuload" "scei.mnu") ) ((>= acadver 16.2) (command "_menuload" "scei.cui")) ) ) ;;; The following code "placemenu" written by LUCAS ;;; 插入菜单条 Placemenu由LUCAS编写 ;;; --------------------------------------------------------------------------------- (defun scei_PlaceMenu (/ n) (if (menugroup "gj") (progn (setq n 1) (while (< n 24) (if (menucmd (strcat "P" (itoa n) ".1=?")) (setq n (+ n 1)) (progn ;(if (> n 3) ;(setq n (- n 2)) ;(setq n 3) ;) ;if (menucmd (strcat "p" (itoa n) "=+gj.pop3")) (menucmd (strcat "p" (itoa n) "=+gj.pop2")) (menucmd (strcat "p" (itoa n) "=+gj.pop1")) (setq n 25) ) ;progn ) ;if ) ;while ) ;progn ) ;if (princ) ) ;;; 初始化主函数 ;;; --------------------------------------------------- (defun Init_scei () ;; 添加支持路径 (AddSupportPath (GetsceiPath) nil) (AddSupportPath (strcat (GetsceiPath) "\\阀门") nil) (AddSupportPath (strcat (GetsceiPath) "\\计算工具") nil) (AddSupportPath (strcat (GetsceiPath) "\\图签") nil) (AddSupportPath (strcat (GetsceiPath) "\\文档") nil) (AddSupportPath (strcat (GetsceiPath) "\\其他软件") nil) ;; 如果菜单组还没有被加载,则加载之 (if (not (menugroup "gj")) (Load_sceiMenu) )
;; 安排菜单条的位置 (scei_PlaceMenu) (princ) ) ;;; 以上函数部分定义完毕 ;;; ----------------------------------------------------- ;;; 主程序: ;;; ----------------------------------------------------- ;(princ "\n加载scei工具集……") (setq scei_cmdecho_save (getvar "cmdecho")) (setvar "cmdecho" 0) ;;; 执行初始化 (Init_scei) (setvar "cmdecho" scei_cmdecho_save) (setq scei_cmdecho_save nil) (princ "\n") (princ) ;; 加载主程序 (arxload "scei.arx") (command "vbaload" "scei.dvb") (command "-vbarun" "scei.dvb!acadstartup") (load "scei.lsp") (load "bplot.vlx") (load "y5.vlx") (princ) 请问该怎么修改!谢谢! |