180
639
463
中流砥柱
;inform the user how to run the application(prompt "\nMy_Menu Menu Installer Loaded...Type My_Menu to run......");define the function(defun C:My_Menu ( / flag1 loaded temp) (setq _ACADVERSION (atof (getvar "ACADVER"))) (if (>= ACADVER 19.0) ; AUTOCAD 2013 or 2014 (setq _MENUNAME "My_Menu.cuix") (setq _MENUNAME "My_Menu.cui") ); end if ;add the new support paths (addSupportPath "//a_very_long/novell/path/VLISP" 5) (addSupportPath "//a_very_long/novell/path/VLISP/3rdPartyLisp" 6) ;set the flag(setq flag1 T);check if the menu is not already loaded(setq loaded (menugroup "_MENUNAME"));if it is not loaded(if (= loaded nil) ;do the following (progn;find the menu file (setq temp (findfile _MENUNAME)) ;if you find the menu (if temp ;do the following (progn ;switch off dialogues (setvar "FILEDIA" 0) ;load the menu (command "menuload" _MENUNAME) ;switch on dialogues (setvar "FILEDIA" 1) ; This is for later use ;install the pulldown ;(menucmd "P11=+VBAMENU.POP1") ;inform the user (prompt "\nLoading My_Menu....\n") );progn ;menu not find, so do the following (progn ;inform the user (alert "Cannot Locate My_Menu Menu. \nCall System Administrator.") ;clear the flag (setq flag1 nil) );progn );if );progn);if ;if the flag is set (if flag1 ;inform the user (prompt "\nVBA Menu Loaded....\n") );if (princ));defun;subroutine to add support path(defun addSupportPath (dir pos / tmp c lst)(setq tmp "" c -1)(if (not (member (strcase dir) (setq lst (mapcar 'strcase (parse (getenv "ACAD") ";") ) );setq );member );not (progn (if (not pos) (setq tmp (strcat (getenv "ACAD") ";" dir)) (mapcar '(lambda (x) (setq tmp (if (= (setq c (1+ c)) pos) (strcat tmp ";" dir ";" x) (strcat tmp ";" x) ) ) ) lst ))(setenv "ACAD" tmp)))