Hey guys i found this lisp at http://www.cadtutor.net/forum/showth...-load-CUI-file but i need it to load multiple menus. Any help would be greatly appreciated, i have changed the list to suit what i want.
ORIGINAL
Code:
(defun c:loadit (/ cui_database mnbar flag) (vl-load-com)
(setq cui_database
(list
"EXPRESS" ;<<< MENUGROUP
"C:\\Documents and Settings\\Ronald\\Application Data\\Autodesk\\AutoCAD 2008\\R17.1\\enu\\support\\acetmain.cui" ;<<<PATH & CUI FILENAME
"E&xpress" ;<<< MENUNAME
) ;_ end_list
) ;_ end_setq
(vlax-for n
(setq all_menus
(vla-get-MenuGroups
(vlax-get-Acad-Object)
) ;_ end_vla-get-MenuGroups
) ;_ end_setq
(if (= (vla-get-name n) (car cui_database))
(setq flag T)
) ;_ end_if
) ;_ end_vlax-for
(if (null flag)
(progn
(vla-load
all_menus
(cadr cui_database)
) ;_ end_vla-load
(setq MnBar
(vla-get-MenuBar
(vlax-get-Acad-Object)
) ;_ end_vla-get-MenuBar
) ;_ end_setq
(vla-InsertInMenuBar
(vla-Item
(vla-get-Menus
(vla-Item
(vla-get-MenuGroups
(vlax-get-Acad-Object)
) ;_ end_vla-get-MenuGroups
(car cui_database)
) ;_ end_vla-Item
) ;_ end_vla-get-Menus
(caddr cui_database)
) ;_ end_vla-Item
(1- (vla-get-Count MnBar))
) ;_ end_vla-InsertInMenuBar
) ;_ end_progn
(princ "\n>>..MENU IS ALREADY LOADED..<<")
) ;_ end_if
(princ)
) ;_ end_defun
EDITED
Code:
;Courtesy of wizman - http://www.cadtutor.net/forum/showthread.php?26379-about-load-CUI-file
(defun c:LOADURB (/ cui_database mnbar flag) (vl-load-com)
(setq cui_database
(list
"URB" ;<<< MENUGROUP
(strcat Std_Lib_CUI "urb.cui") ;<<<PATH & CUI FILENAME
"&General" ;<<< MENUNAME
"&STD Notes & Legends" ;<<< MENUNAME
"&Earthworks" ;<<< MENUNAME
"&Sewer Reticulation" ;<<< MENUNAME
"&Sewer Reticulation2" ;<<< MENUNAME
"&Roadworks" ;<<< MENUNAME
"&Kerb Gradings" ;<<< MENUNAME
"&Long Sections" ;<<< MENUNAME
"&Drainage" ;<<< MENUNAME
"&Water Reticulation" ;<<< MENUNAME
"&Power" ;<<< MENUNAME
) ;_ end_list
) ;_ end_setq
(vlax-for n
(setq all_menus
(vla-get-MenuGroups
(vlax-get-Acad-Object)
) ;_ end_vla-get-MenuGroups
) ;_ end_setq
(if (= (vla-get-name n) (car cui_database))
(setq flag T)
) ;_ end_if
) ;_ end_vlax-for
(if (null flag)
(progn
(vla-load
all_menus
(cadr cui_database)
) ;_ end_vla-load
(setq MnBar
(vla-get-MenuBar
(vlax-get-Acad-Object)
) ;_ end_vla-get-MenuBar
) ;_ end_setq
(vla-InsertInMenuBar
(vla-Item
(vla-get-Menus
(vla-Item
(vla-get-MenuGroups
(vlax-get-Acad-Object)
) ;_ end_vla-get-MenuGroups
(car cui_database)
) ;_ end_vla-Item
) ;_ end_vla-get-Menus
(nth 2 cui_database)
) ;_ end_vla-Item
(1- (vla-get-Count MnBar))
) ;_ end_vla-InsertInMenuBar
) ;_ end_progn
(princ "\n>>..MENU IS ALREADY LOADED..<<")
) ;_ end_if
(princ)
) ;_ end_defun