Jump to content

about load CUI file


thanhhuynh

Recommended Posts

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! :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

  • 4 years later...
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?????

Link to comment
Share on other sites

  • 6 months later...
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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...