AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

 

Loading Partial Menu's

In AutoCAD R14 you have no problems in loading Partial Menu's.
AutoCAD Release 13, though is a different story!
Every time you re-start AutoCad you have to manually re-load the partial menu.
If you load it from your Acad.Lsp using the menuload command that works fine the first time you enter AutoCad. But as soon as you open another drawing you get an error in your Acad.lsp file with Autocad telling you that the partial menu is already loaded.

The following is an extract from the AutoCAD Custumization Manual :

To determine if a menu file is currently partially loaded, you can use the following syntax with any POP menu item (it works with only a POP menu item) :

(menucmd "Gmenugroup.nametag=?")

If the menu file is currently loaded, this will return a nonnil value
otherwise it will return nil.

Example : Use the following code in your Acad.lsp file.
You must have a partial menu named TEST.MNU and a POP menu item called AMENUITEM. (You can, of course, use your own Menu and POP names).

;;*-------------------------------------------------------------------
(defun S::STARTUP ()	
;define Startup function

       (setq temp (menucmd "GTEST.AMENUITEM=?"))	
       ;is the POP item loaded?

       (if (= temp nil)		
       ;test it

           (progn	
           ;if it is not loaded

            (setvar "filedia" 0)	
            ;suppress dialog boxes

            (command "menuload" "TEST")	
            ;load Menu

            (menucmd "P8=+TEST.POP1")
            ;load POP1

            (menucmd "P9=+TEST.POP2")
            ;load POP2

            (setvar "filedia" 1)	
            ;restore dialogs

           );progn

       );if	
										
       (prompt "\nPartial Menu Loaded....\n")	
       ;prompt user

     (princ)

);defun
;*---------------------------------------------------------------------
The AutoLisp/Visual Lisp/VBA Resource Website

Copyright © 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website