Jump to content

Recommended Posts

Posted

Hello members,

 

Greetings,

 

How to insert our own defined menus into to the autocad menu area through lisp program.

 

In autocad through Menuload command to add defined menus from a mnu file.

 

through programing how to insert the two or three defined menu's from an mnu file.

 

Thanks and regards

 

Ramana

Posted

When you say "insert two or three defined menus from a mnu file", do you mean insert two or three "pull down" menus, or do you mean load two or three "menu files"?

 

If you want to load a pull-down menu, you can do something like this:

 

(defun c:menuld ( / menuname *mgs* PD1)
 (setq menuname "C:\\CADSTUFF\\mymenu.mnu")
 (setq *mgs* (vla-get-menugroups (vlax-get-acad-object)))
 (vla-load *mgs* menuname)
 (setq PD1 (vla-item (vla-get-menus (vla-item *mgs* "MYMENUGROUP")) 0 ))
 (vla-InsertInMenubar PD1 
)

 

Of course you will have to use the path and name of your actual menu, and replace MYMENUGROUP with the name of your menugroup, the 0 represents the position of the pull-down menu in the menu file, and the 8 represents the position that you want to place this new pull-down in the menu bar.

 

I didn't test this exact example and it doesn't include any error checking such as checking to make sure the menu exists, and checking to see if it's already loaded.

Posted

Mr.Rkmcswain,

 

thanks for the procedure, i will check it.

 

inserting 2 or three menu's because my menu file consists of more than 4 menus but i may need all some time and some time specific.

 

 

thanks & regards

Ramana.

  • 2 years later...
Posted

Hello RKMCSWAIN,

 

I tried the code and it works great for me. Only problem: it appears between the dimension and modify menu, so in the 9th position.

Several other paramters I checked but then it only loads the menu; it will not be visible in the screen.

 

So my first big question to you is how do I place the desired menu right to the express menu?

 

In the end my "wanting to do" is create a macro or command thad loads, unloads or reloads a custom menu.

The strange thing is, when using lisp ie. like (command "menuload" "test.mnu") it does load / unload like I want but the menus stay invisible.

 

Check out my other threats in order to solve the problem.

 

http://www.cadtutor.net/forum/showthread.php?t=36549

 

http://www.cadtutor.net/forum/showthread.php?t=35754

 

http://www.cadtutor.net/forum/showthread.php?t=35739

 

Thank you.

Posted
Hello RKMCSWAIN,

 

I tried the code and it works great for me. Only problem: it appears between the dimension and modify menu, so in the 9th position.

Yes, that is what the "8" is telling it to do in that code. (vla-InsertInMenubar PD1 8)

 

So my first big question to you is how do I place the desired menu right to the express menu?

Figure out what place the Express menu is in and then adjust the location into which you insert your menu. Remember, the Express menu may not always be in the same place, so you will have to determine it's location at run time.

 

The strange thing is, when using lisp ie. like (command "menuload" "test.mnu") it does load / unload like I want but the menus stay invisible.

Nothing strange about it. Loading a menu is a separate operation from making a pull-down menu visible.
Posted
Yes, that is what the "8" is telling it to do in that code. (vla-InsertInMenubar PD1 8

 

Any other number ie. 6 don't work... Have any idea what I am doing wrong?

 

Figure out what place the Express menu is in and then adjust the location into which you insert your menu. Remember, the Express menu may not always be in the same place, so you will have to determine it's location at run time.

 

How do I do that?

 

Nothing strange about it. Loading a menu is a separate operation from making a pull-down menu visible.

Is it (vla-InsertInMenubar PD1 8 what is making it visible?

Posted
Any other number ie. 6 don't work... Have any idea what I am doing wrong?
From help: The index location in the menu bar where the popup menu is to be added. The index must be either an integer or a string. If an integer, the index must be between 0 and N-1, where N is the number of objects in the menu bar. The new item will be added immediately before the specified index location.

 

 

 

 

How do I do that?

That was pretty much the pseudo code version. I don't have any actual code to do this that I can post here.

 

Is it (vla-InsertInMenubar PD1 8 what is making it visible?

 

Yes. Look up the InsertInMenuBar method in the developers guide for more info. Also see the "Insert Menus in the Menu Bar" section in the same help file. Note that the help file is written from the perspective of using VBA, but the same general idea applies.

Posted

Thank you for the reply, I have managed to do what i wanted, load and unload custom menu's by "command". So now i have made macro's that will do the thing. he problem was the expresstools menu. Why, I don't know but I had it unloaded then reloaded. Since then my menu's show the right way. So i do not really know what happend... but it did.

 

What i noticed is following. Imagine I modify a menu, ie. i put a few macros to it.

Then the menu should be unloaded; menuload, select the specified menu and press unload.

 

When i load the menu again by menuload, browse, select menu and press load, it all works fine. When i use the code above it reloads the old version of the menu, so not the modified one.

 

Why is this "hard reload" not carried out? Can that be done anyway? This is might handy after editing a menu file (.mnu). I could press 1 button (macro in menu) to reload and have the new 9modified) menu present. Just an idea...

Posted

I am a bit confused why are you loading and unloading menus are you using the ability to have sub menu's within a menu item our 1 menu has sub menus with 22 options per sub menu and these can have sub sub menus again or they load a dialog box with lots of other menu options and settings etc.

 

Are you using the menus to set variables then why not use the side bar menu this can return values even in the middle of a command or a tool bar the latter takes very little room.

Posted

We are a multi diciplinair installation company, plumbing HVAC, electrics, etc. So some of us need the electric menu's and other only the plumbing menu's. Because I am the only one to create / modify I have loaded em all. There are 5 menu's. Whenever a menu is loaded, and then modified, it needs to be unloaded and loaded again else the changes are not visible / present. Thats why. My menu's are part only macro's, others are full image tile menu's.

  • 5 months later...
Posted

OK. I have read all the instructions on how to create a legacy tile menu. Did that. But the slidelib does not show up. The instructions are sort of like "Yes, Virginia, there is a Santa Claus, but here's just PART of the information you need to know about him". We used to put in $I=elecsym1 $I=* and up would come the slide library on the screen. At the end of the .mnu file we put the lisp routine Defun commands for the symbols on the screen as follows:

 

**elecsym1

[select Logic Symbol]

[elecsyb(nosw)]^C^Cnopb;

and so on

 

How do you do this now?

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