Jump to content

Load Mnu file via lisp


MastroLube

Recommended Posts

Hello guys,

I have to create and load a simple menu from acaddoc.lsp.

 

This is the mnu file

***MENUGROUP=Cordoli

***POP1					
P1-1[Cordoli]				
P1-2[&Load APP]				
P1-3[&Help]

 

How can I add istruction to load my lisp in this file?

(load "cordoli.vlx")

 

Then i have to load the mnu file via acaddoc.lsp. How can i perform this step?

Maybe in this way?

(vl-load-com)
(setq *mgs* (vla-get-menugroups (vlax-get-acad-object)))
(vla-load *mgs* "cordoli")

Loading the .mnu file with "_menuload" work with autocad 2009, but with my 2015 it doesn't appear in the menu bar.

Thanks for the help!

 

Dennis

Link to comment
Share on other sites

Hello guys,

I have to create and load a simple menu from acaddoc.lsp.

 

This is the mnu file

***MENUGROUP=Cordoli

***POP1					
P1-1[Cordoli]				
P1-2[&Load APP]				
P1-3[&Help]

 

How can I add istruction to load my lisp in this file?

(load "cordoli.vlx")

 

Then i have to load the mnu file via acaddoc.lsp. How can i perform this step?

Maybe in this way?

(vl-load-com)
(setq *mgs* (vla-get-menugroups (vlax-get-acad-object)))
(vla-load *mgs* "cordoli")

Loading the .mnu file with "_menuload" work with autocad 2009, but with my 2015 it doesn't appear in the menu bar.

Thanks for the help!

 

Dennis

create .mns file and load with _menuload

Link to comment
Share on other sites

Can you explain me a little more?

 

in the meantime i found that:

(vl-load-com)
(defun c:Example_OnMenuBar()
   ;; This example creates a new menu called TestMenu and inserts a menu item
   ;; into it. The menu is then displayed on the menu bar, and then
   ;; removed from the menu bar.
   (setq acadObj (vlax-get-acad-object))
   (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))
   
   ;; Create the new menu
   (setq newMenu (vla-Add (vla-get-Menus currMenuGroup) "TestMenu"))
   
   ;; Add a menu item to the new menu
   ;; Assign the macro string the VB equivalent of "ESC ESC _open "
   (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))
   (setq newMenuItem (vla-AddMenuItem newMenu (1+ (vla-get-Count newMenu)) "Open" openMacro))
   
   ;; Display the menu on the menu bar
   (vla-InsertInMenuBar newMenu (1+ (vla-get-Count (vla-get-MenuBar acadObj))))
   (if (= (vla-get-OnMenuBar newMenu) :vlax-true)
       (alert (strcat "The menu called " (vla-get-Name newMenu) " is on the menu bar."))
       (alert (strcat "The menu called " (vla-get-Name newMenu) " is not on the menu bar."))
   )
   
   ;; Remove the menu from the menu bar
   (vla-RemoveMenuFromMenuBar (vla-get-Menus currMenuGroup) "TestMenu")
   (if (= (vla-get-OnMenuBar newMenu) :vlax-true)
       (alert (strcat "The menu called " (vla-get-Name newMenu) " is on the menu bar."))
       (alert (strcat "The menu called " (vla-get-Name newMenu) " is not on the menu bar."))
   )
)

Link to comment
Share on other sites

I don't know if i got your question but I want to load it with all the others (acad and so on).

 

(defun c:Crea_menu()
   ;; This example creates a new menu called TestMenu and inserts a menu item
   ;; into it. The menu is then displayed on the menu bar, and then
   ;; removed from the menu bar.
   (setq acadObj (vlax-get-acad-object))
   (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))
   
   ;; Create the new menu
   (setq newMenu (vla-Add (vla-get-Menus currMenuGroup) "Cordoli"))
   
   ;; Add a menu item to the new menu
   ;; Assign the macro string the VB equivalent of "ESC ESC _open "
   (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "cordolo" (Chr 32)))
   (setq newMenuItem (vla-AddMenuItem newMenu (1+ (vla-get-Count newMenu)) "Avvia l'applicazione" openMacro))

   
   ;; Display the menu on the menu bar
   (vla-InsertInMenuBar newMenu (1+ (vla-get-Count (vla-get-MenuBar acadObj))))

)

 

erLHVxR.png

 

This seems to work in acad2009, but not in acad2015

Link to comment
Share on other sites

Do you need to load every time ? Why not load it once and just use a workspace you can turn menu's off and on in a workspace. Every one here works in a workspace of their name, so deafult workspaces are not screwed up.

Link to comment
Share on other sites

Hello Bigal, this is the second time i write this post because my pc crashed :D

 

Well, when I install other add-on i get a menubar/ribbon in my workplace. I want to do exactly the same with mine.

There is a difference between mine and other add-ons: my menubar disappear if i change workplace (or i refresh it)!

 

In this moment I'm doing all with acaddoc.lsp, but I'm sure there is a better way to do that. I'm looking for that way.

 

I've also created a cordoli.cuix for show ribbons in autocad2015 and i call it alway by acaddoc.lsp with this command: (command "_menuload" "C:\\COBIAX\\cordoli.cuix")

 

How can make a "professional" add-on fixing these problems ?

 

thanks, Dennis

 

cordoli.cuix.zip

 

In addition i got this problem:

Command line can't load

Edited by MastroLube
Link to comment
Share on other sites

You need to Save Workspace after loading a mnu etc else it will be gone for next session. We have individual workspace for each user so force a save to their name, we do not have autoupdate on as any mistake gets saved and makes fixing much harder.

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...