Results 1 to 2 of 2

Thread: Loading CUI and Menus through lisp

  1. #1
    Member
    Join Date
    2013-03
    Posts
    6
    Login to Give a bone
    0

    Default Loading CUI and Menus through lisp

    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

  2. #2
    Member
    Join Date
    2013-03
    Posts
    6
    Login to Give a bone
    0

    Default Re: Loading CUI and Menus through lisp

    bump to top

Similar Threads

  1. Replies: 2
    Last Post: 2015-04-17, 04:00 PM
  2. Loading Partial Menus
    By visualmatrix in forum AutoCAD Customization
    Replies: 7
    Last Post: 2011-07-15, 12:03 PM
  3. loading pull down menus
    By daniel.144778 in forum AutoCAD 3D (2007 and above)
    Replies: 1
    Last Post: 2010-10-11, 05:22 PM
  4. RPC Menus not loading
    By archdraught in forum ACA General
    Replies: 2
    Last Post: 2009-08-14, 04:42 AM
  5. Custom menus & lisp not always loading
    By tim.101799 in forum AutoCAD CUI Menus
    Replies: 8
    Last Post: 2006-07-21, 08:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •