Author Topic: Loading menu on A2006  (Read 5644 times)

0 Members and 1 Guest are viewing this topic.

LE

  • Guest
Loading menu on A2006
« on: November 21, 2005, 10:39:09 AM »
Hello,

I been using the following function to load my menus on autocad, and now with the new CUI ones, I would like to know if still could work. [I do not have A2006 yet]

Code: [Select]
(defun pulldownmenu  (menu / n vla_menu menugroups get_acad)
  (if (and (findfile (strcat menu ".mnu"))
   (not (menugroup menu)))
    (if (setq
  vla_menu
   (vla-load
     (setq menugroups
    (vla-get-menugroups
      (setq get_acad (vlax-get-acad-object))))
     (findfile (strcat menu ".mnu"))))
      (progn
(setq n 1)
(while (< n 24)
  (if (menucmd (strcat "p" (itoa n) ".1=?"))
    (setq n (+ n 1))
    (progn
      (menucmd (strcat "p" (itoa n) (strcat "=+" menu ".pop1")))
      (setq n 25))))))))


I normally place a call of the above function (pulldownmenu) and when my filename.vlx files are loaded that function will load the pulldown menu.

But, what would happen now with the new CUI?.... are still the functions used to load menus programatically will work with the CUI?

Thanks in advance.
Luis.

LE

  • Guest
Re: Loading menu on A2006
« Reply #1 on: November 21, 2005, 11:10:12 AM »
Now, can you keep using the .MNU/.MNS on AutoCAD 2006?

ronjonp

  • Needs a day job
  • Posts: 7533
Re: Loading menu on A2006
« Reply #2 on: November 21, 2005, 11:17:41 AM »
I believe you can import legacy menus but it converts them to CUI's.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: Loading menu on A2006
« Reply #3 on: November 21, 2005, 11:44:11 AM »
Hi Luis

That's what I use in A2k2-A2k6:
Code: [Select]
;
; -- Function MeLoadPartMenu
; Loading partial menus.
; Arguments [Type]:
;   Grp = Menu group [STR]
;   Nme = Menu file name (w/o .ext) [STR]
; Return [Type]:
;   > True if file found [BOOLEAN]
;   > Nil if not [BOOLEAN]
; Notes:
;   - Already loaded menu remains
;   - Consider changed menu file paths
;
(defun MeLoadPartMenu (Grp Nme / AcaObj FilPth GrpCol MnuExt MnuLst)
 (setq AcaObj (vlax-get-acad-object)
       GrpCol (vla-get-MenuGroups AcaObj)
       MnuExt (< (atof (getvar "ACADVER")) 16.2) ".mnc" ".cui")
 )
 (vlax-for Obj GrpCol
  (setq FilPth (strcase (vla-get-MenuFileName Obj))
        MnuLst (cons                           
                (strcat
                 (vl-filename-directory FilPth)
                 "\\" (vl-filename-base FilPth)
                )
                MnuLst
               )
  )
  (vlax-release-object Obj)
 )
 (if (or
      (setq FilPth (findfile (strcat Nme MnuExt)))
      (setq FilPth (findfile (strcat Nme ".mnu")))
     )
  (progn
   (setq FilPth (strcat
                 (vl-filename-directory FilPth)
                 "\\" (vl-filename-base FilPth)
                )
   )
   (if (menugroup Grp)
    (if (not (member (strcase FilPth) MnuLst))
     (progn
      (MeUnloadMenuGroup Grp)
      (vla-load (vla-get-MenuGroups AcaObj) Nme)
     )
    )
    (vla-load GrpCol Nme)
   )
   T
  )
  (alert
   (strcat
    "Menu file '" Nme MnuExt "/.mnu' not found."
    "\nCheck your installation please."
   )
  )
 )
)
;
; -- Function MeUnloadPartMenu
; Unload a partial menu.
; Arguments [Type]:
;   Grp = Menu group name [STR]
; Return [Type]:
;   > Null
; Notes:
;   None
;
(defun MeUnloadPartMenu (Grp)
 (vlax-for Obj (vla-get-MenuGroups (vlax-get-acad-object))
  (if (eq (vla-get-Name Obj) Grp)
   (vla-unload Obj)
  )
  (vlax-release-object Obj)
 )
 (princ)
)
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

LE

  • Guest
Re: Loading menu on A2006
« Reply #4 on: November 21, 2005, 12:04:48 PM »
Thank you Jürg.

LE

  • Guest
Re: Loading menu on A2006
« Reply #5 on: November 21, 2005, 12:05:19 PM »
I believe you can import legacy menus but it converts them to CUI's.

Thanks.

LE

  • Guest
Re: Loading menu on A2006
« Reply #6 on: November 21, 2005, 12:08:44 PM »
That's what I use in A2k2-A2k6

What about the .MNL files?.... are they still loaded from MENU.CUI ?

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: Loading menu on A2006
« Reply #7 on: November 21, 2005, 12:09:46 PM »
What about the .MNL files?.... are they still loaded from MENU.CUI ?
Yes, no prob...
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18