AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

 

Can anybody remember the Acad.lsp file? Now that there are MNL files and Acaddoc.Lsp, Acad.Lsp would seem to be redundant. Well not really. The Acad.Lsp file is great for ensuring that partial menu's are loaded.
So, want to ensure your custom menu/menu's, including pulldowns, are loaded everytime AutoCAD is opened? Copy and paste this into your Acad.Lsp file substituting your menu name where applicable :

;;;Start Coding Here

(defun MYSTARTUP ( );;;replace this line with the following if you are using R2000

;;;(defun-q MYSTARTUP ( )

;first set the flag
(setq flag1 T)

;check for the existence of the menu
(setq loaded (menugroup "MYMENU"))

;if it's not loaded
(if (= loaded nil)

;do the following
(progn

;find the menu
(setq temp (findfile "MYMENU.MNU"))

;if you find it
(if temp

;do the following
(progn

;suppress dialogues
(setvar "FILEDIA" 0)

;load the menu
(command "menuload" "MYMENU")

;un-suppress dialogues
(setvar "FILEDIA" 1)

;load the first pulldown
(menucmd "P11=+MYMENU.POP1")

;load the second
(menucmd "P12=+MYMENU.POP2")

;tell them what you are doing
(prompt "\nLoading MyMenu Custom Utilities....\n")

);progn

;if you cannot find the menu, do this
(progn

;tell the it's missing
(alert "Cannot Locate MyMenu Menu. \n
Blame Randall Raath.")

;clear the flag
(setq flag1 nil)

);progn

);if

);progn

);if

;if the flag is set
(if flag1

;inform the user
(prompt "\nMyMenu Custom Utilities Loaded....\n")

);if

;finish clean
(princ)

);defun

;append your startup function to any other startup function
(setq S::STARTUP (append S::STARTUP MYSTARTUP))

;;;End Coding Here

Please ensure that all "MYMENU" menu files are in your AutoCAD search path.

 

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