thanhhuynh Posted August 20, 2008 Share Posted August 20, 2008 Hi all, I have a CUI file include toolbar and menu with name mycuifile.cui, when i use a scrip file with command (command "_menuload" "C:\\mycuifile.cui") Autocad load toolbar only, it can't load menu why? thanks for support! Quote Link to comment Share on other sites More sharing options...
ASMI Posted August 20, 2008 Share Posted August 20, 2008 (command "_cuiload" "C:\\mycuifile.cui") Quote Link to comment Share on other sites More sharing options...
thanhhuynh Posted August 21, 2008 Author Share Posted August 21, 2008 thanks but it can't load menu, too. But when i type (command "_menuload" "C:\\mycuifile.cui") in command line, it work correct Autocad load toolbar and menu Quote Link to comment Share on other sites More sharing options...
wizman Posted August 21, 2008 Share Posted August 21, 2008 you may try this one. (defun c:loadit (/ cui_database mnbar flag) (vl-load-com) (setq cui_database (list "EXPRESS" [color="Blue"];<<< MENUGROUP[/color] "C:\\Documents and Settings\\Ronald\\Application Data\\Autodesk\\AutoCAD 2008\\R17.1\\enu\\support\\acetmain.cui" [color="blue"];<<<PATH & CUI FILENAME[/color] "E&xpress" [color="blue"];<<< MENUNAME[/color] ) ;_ 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 Quote Link to comment Share on other sites More sharing options...
thanhhuynh Posted August 22, 2008 Author Share Posted August 22, 2008 Thanks for your support, it work correctly. But I want to use scrip file to add my menu and toolbar in Cad on another PC. That cui file is a share file. Can you help me? Thanks! Quote Link to comment Share on other sites More sharing options...
wizman Posted August 22, 2008 Share Posted August 22, 2008 in your scr file, you may have this: ;;;Point the script to the location of the loadit.lsp (load "c:\\completepathhere\\loadit) ;;;then run (c:loadit) you may also need to add additional support paths for your menu to work correctly in another computer. Quote Link to comment Share on other sites More sharing options...
thanhhuynh Posted August 22, 2008 Author Share Posted August 22, 2008 i think so, thanks for your support! Quote Link to comment Share on other sites More sharing options...
thanhhuynh Posted August 25, 2008 Author Share Posted August 25, 2008 When i use command cuiunload in my scrip to unload my cui file, it's only unload menu and toolbar on screen. partial cui file in CUI interface is not unload. when i restart ACAD it show toolbar again. Why? Thanks for support. Quote Link to comment Share on other sites More sharing options...
wizman Posted August 25, 2008 Share Posted August 25, 2008 try this: [color=navy](defun c:unloadit ()[/color] [color=navy](vl-load-com)[/color] [color=navy](vla-unload (vla-Item (vla-get-MenuGroups (vlax-get-Acad-Object)) "EXPRESS")) [/color][color=darkorange];...<<< MENUGROUP [/color] [color=navy](princ)[/color] [color=navy]) ;_ end_defun[/color] Quote Link to comment Share on other sites More sharing options...
thanhhuynh Posted August 25, 2008 Author Share Posted August 25, 2008 Thanks, but it used like command "cuiunload" cui file in CUI dialog is still there Quote Link to comment Share on other sites More sharing options...
wizman Posted August 25, 2008 Share Posted August 25, 2008 using acad09 here, this one works fine here: (command "._cuiunload" "Express") Quote Link to comment Share on other sites More sharing options...
thanhhuynh Posted August 26, 2008 Author Share Posted August 26, 2008 Thanks for your support! Quote Link to comment Share on other sites More sharing options...
Ahmeds Posted February 7, 2013 Share Posted February 7, 2013 you may try this one. (defun c:loadit (/ cui_database mnbar flag) (vl-load-com) (setq cui_database (list "EXPRESS" [color="Blue"];<<< MENUGROUP[/color] "C:\\Documents and Settings\\Ronald\\Application Data\\Autodesk\\AutoCAD 2008\\R17.1\\enu\\support\\acetmain.cui" [color="blue"];<<<PATH & CUI FILENAME[/color] "E&xpress" [color="blue"];<<< MENUNAME[/color] ) ;_ 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 wizman, your code really works for me and that was what i am looking for a long time, thanks for that but, I have to ask some modification because I try to modified coz what I need is for more than 1 menu name(actually I have 3).. I tried to, but it wont work for me.. can u please????? Quote Link to comment Share on other sites More sharing options...
stusic Posted September 6, 2013 Share Posted September 6, 2013 wizman, your code really works for me and that was what i am looking for a long time, thanks for that but, I have to ask some modification because I try to modified coz what I need is for more than 1 menu name(actually I have 3)..I tried to, but it wont work for me.. can u please????? Yes, this. I've been using this for almost a year, but now I need to load our company's CUI and XL2CAD's CUI. I also tried to modify to accept multiple CUIs, but was unsuccessful. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.