我真的需要阅读整条线索,但你是否“顺其自然”完全取决于你自己 Okay, that was a little stupid I guess... but still dont work.
The lisp:
(defun c:loadit (/ cui_database mnbar flag)(vl-load-com)(setq cui_database(list"options" ; works fine here, try restarting acad, if still not ok, may be others can assist. See also this example:
http://www.theswamp.org/index.php?topic=7731.msg98122#msg98122 I have Autocad 2007, maybe that is important to know...
The code:
;; -- Function MeLoadPartMenu; Loading partial menus.; Arguments :;Grp = Menu group SO Grp = options (?);Nme = Menu file name (w/o .ext) SO Nme = options.mnu (?); Return :; > True if file found ; > Nil if not ; Notes:; - Already loaded menu remains; - Consider changed menu file paths;(defun MeLoadPartMenu (options options.mnu / AcaObj FilPth GrpCol MnuExt MnuLst)(setq AcaObj (vlax-get-acad-object) GrpCol (vla-get-MenuGroups AcaObj) MnuExt (< (atof (getvar "ACADVER")) 16.2) ".mnc" ".cui"))(vlax-for Obj GrpCol (setq FilPth (strcase (vla-get-MenuFileName Obj)) MnuLst (cons (strcat (vl-filename-directory FilPth) "\\" (vl-filename-base FilPth) ) MnuLst ) ) (vlax-release-object Obj))(if (or (setq FilPth (findfile (strcat Nme MnuExt))) (setq FilPth (findfile (strcat Nme ".mnu"))) ) (progn(setq FilPth (strcat (vl-filename-directory FilPth) "\\" (vl-filename-base FilPth) ))(if (menugroup Grp) (if (not (member (strcase FilPth) MnuLst)) (progn (MeUnloadMenuGroup Grp) (vla-load (vla-get-MenuGroups AcaObj) Nme) ) ) (vla-load GrpCol Nme))T ) (alert(strcat "Menu file '" Nme MnuExt "/.mnu' not found." "\nCheck your installation please.") )));; -- Function MeUnloadPartMenu; Unload a partial menu.; Arguments :; Grp = Menu group name ; Return :; > Null; Notes:; None;(defun MeUnloadPartMenu (Grp)(vlax-for Obj (vla-get-MenuGroups (vlax-get-acad-object)) (if (eq (vla-get-Name Obj) Grp)(vla-unload Obj) ) (vlax-release-object Obj))(princ))
How do I run this? I know how to get lisp running, this isn't lisp?
And when my menu is called options is it correct as altered above?
Pff... I shall win !! This is LISP, but they are sub-functions, hence will need to be called from a main-function with arguments I think the LISP has been tampered with, some parts of it were wrong/missing:
; ; -- Function MeLoadPartMenu ; Loading partial menus. ; Arguments : ;Grp = Menu group SO Grp = options (?) ;Nme = Menu file name (w/o .ext) SO Nme = options.mnu (?) ; Return : ; > True if file found ; > Nil if not ; Notes: ; - Already loaded menu remains ; - Consider changed menu file paths ;(defun MeLoadPartMenu(Grp Nme / AcaObj FilPth GrpCol MnuExt MnuLst) (setq AcaObj (vlax-get-acad-object) GrpCol (vla-get-MenuGroups AcaObj) MnuExt (if (< (atof (getvar "ACADVER")) 16.2) ".mnu" ".cui")) (vlax-for ObjGrpCol (setq FilPth (strcase (vla-get-MenuFileName Obj)) MnuLst (cons (strcat (vl-filename-directory FilPth) "\\" (vl-filename-base FilPth) ) MnuLst ) ) (vlax-release-object Obj) ) (if (or (setq FilPth (findfile (strcat Nme MnuExt))) (setq FilPth (findfile (strcat Nme ".mnu"))) ) (progn (setq FilPth (strcat (vl-filename-directory FilPth) "\\" (vl-filename-base FilPth) ) ) (if (menugroup Grp) (if (not (member (strcase FilPth) MnuLst)) (progn (MeUnloadMenuGroup Grp) (vla-load (vla-get-MenuGroups AcaObj) Nme) ) ) (vla-load GrpCol Nme) ) T ) (alert (strcat "Menu file '" Nme MnuExt "/.mnu' not found." "\nCheck your installation please.") ) ) ) ; ; -- Function MeUnloadPartMenu ; Unload a partial menu. ; Arguments : ; Grp = Menu group name ; Return : ; > Null ; Notes: ; None ;(defun MeUnloadPartMenu(Grp) (vlax-for Obj(vla-get-MenuGroups (vlax-get-acad-object)) (if (eq (vla-get-Name Obj) Grp) (vla-unload Obj) ) (vlax-release-object Obj) ) (princ) )(defun c:test () (MeLoadPartMenu "options" "options") (princ))
This is what I think on first glance, but haven't had time to look properly tbh. Hi Lee Mac, thank you for your help.
Yes the lisp runs now, but the problem still is not solved.
Aargh...
Commandline: menuload
Commandline: browse
Browsing to the desired .mnu file
Then the browsed file is loaded by pressing the button "load".
This way it is visible, not via the lisproutine allthough it is loaded.
Beats me.
Should I consider "leave it be" ? The LISP routine will only return T or the alert will show.
I need to read the whole thread really - but whether you "leave it be" is entirely up to you
页:
1
[2]