View Full Version : Load a partial menu from lisp
ccowgill
2006-06-23, 12:40 PM
Is there an easy way to load a custom menu from lisp?
CAB2k
2006-06-23, 12:54 PM
You can take a look at this:
http://www.theswamp.org/index.php?topic=7731.msg98122#msg98122
and there is always
(command "menuload" "testmenu")
and this
(menucmd "P6=+sample.pop1")
rkmcswain
2006-06-23, 12:56 PM
You could call the (command) function like:
(command "._menuload" ......)
-or-
...something like this:
(vl-load-com)
(setq *mgs* (vla-get-menugroups (vlax-get-acad-object)))
(vla-load *mgs* "your_menu_name_here")
You may need more code than that to check whether the menugroup already exists, to place pull-downs in a certain place, etc.
...Then again, it looks like CAB has got you fixed up... :)
ccowgill
2006-06-23, 01:04 PM
does it need to be the name of the mns file, or the name of the menu as displayed in AutoCAD?
rkmcswain
2006-06-23, 01:12 PM
does it need to be the name of the mns file, or the name of the menu as displayed in AutoCAD?
Which part? When you "load" the menu, it's the name of the file, but there is also places where you might want to call the menugroup name and/or the pull-down menu title.
ccowgill
2006-06-23, 01:20 PM
I have a mns file called Wightman.mns it contains menu items for all the lisp routines that I have added to my cad, I already have it loaded on my machine, but I want to load the menu on everyone else's station from my main lisp routine. the problem is, if I dont check to see if it is loaded and it already is, it spits back error messages.
rkmcswain
2006-06-23, 01:45 PM
I have a mns file called Wightman.mns it contains menu items for all the lisp routines that I have added to my cad, I already have it loaded on my machine, but I want to load the menu on everyone else's station from my main lisp routine. the problem is, if I dont check to see if it is loaded and it already is, it spits back error messages.
I didn't examine it in great detail, but I think the code that CAB2k pointed to should work for you.
ccowgill
2006-06-23, 02:56 PM
I checked out the program and as soon as I load it, it gives me a syntax error. I have been able to load the menu group, but I dont know how to get the menu to display with the other menus
rkmcswain
2006-06-23, 03:00 PM
Are you familier with using the (vla-) functions in lisp and using the VBA help to figure them out?
Check out
(vla-get-menus)
(vla-get-onmenubar)
(vla-insertinmenubar)
Basically, you want to query the menugroup you just loaded (vla-get-menus), then check to see if the pull-down is visible (vla-get-onmenubar), then load it if necessary (vla-insertinmenubar)
vBulletin® v3.6.7, Copyright ©2000-2010, Jelsoft Enterprises Ltd.