Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can you create a menu from a lisp file?

28 REPLIES 28
Reply
Message 1 of 29
Anonymous
2289 Views, 28 Replies

Can you create a menu from a lisp file?

so I have a lisp file with about 50 lisp routines inside of it.
what would be the most direct, (easiest), way to create an AutoCAD menu out of it?
would it be a .cui, .cuix, .mnu or .mns?
I have tried creating it through the cui editor, however this is far too cumbersome.
I don't want to have to define 50 different commands in the cui, and then drag them onto a menu.
I mean... they are already bundled together in one place, surely there is a way to import them somehow?
Plus, I see no way to export these menus after they are created.
Ultimately, I want to be able to just MENULOAD from any cad machine and pull the menu instantly form a thumb drive.

28 REPLIES 28
Message 21 of 29
Anonymous
in reply to: Kent1Cooper

As I've corrected my previous message, in my settings, under the Emoticon Type, the Smiley is selected.

 

ANd you make me think, maybbe you're right, maybe I didn't use none of these combinations so far! So here is an attempt:

 

(defun C:DoTheMath ()(1+ 1))

 

 

(defun C:DoTheMath ()(1+ 1))

So as you can see, I have the same problem, it shows smileys no matter where the code is written and even if I'm signed in! And now I remember that I've already replaced a closing bracket with (chr 41)  in one of my previous posts just for the same reason, so most probably until Autodesk will fix this (if ever) using the (chr ...)  might be the (only) solution to this nuisance!

 

And maybe the right place for your AutoDesk request in order to remove these smileys, is in the  Updates to Autodesk Discussion Groups thread, where it might have a chance to be seen by Eric Wright.

Message 22 of 29
Anonymous
in reply to: Anonymous

Thank you guys so much for your help
I was able to use the CmdNameLineMenu.lsp to create a txt file.
The output was a very clean file with all commands (144) very nicely seperated.

At this point I changed the filename from MenuLines.txt to MenuLines.mns.
It informed me "Customization file loaded successfully. Customization Group: MENULINES"
This created a MenuLines.mnr and a MenuLines.cuix.
However no menu showed up.

So, I unloaded the menu, then changed the filename from MenuLines.mns to MenuLines.mnu, and reloaded it.
It informed me "Customization file loaded successfully. Customization Group: MENULINES"
This also created a MenuLines.mnr and a MenuLines.cuix.
But still, no menu ever showed up.

Am I missing something?

 

Attached is the output file

Message 23 of 29
Anonymous
in reply to: Anonymous

This is not a valid menu file structure. You can name it as such if you want, but it doesn't mean it will work. A menu file (even by the old school menu rules) has a very specific structure which has to be respected.

 

I am affraid you have to read a little bit more about menu customization, because is too much to be explained it here. You will have to open an existing one and try to understand how it works. Just do not open the original ones, but rather make a copy to play with.

Message 24 of 29
Kent1Cooper
in reply to: Anonymous


@Anonymous wrote:

....I was able to use the CmdNameLineMenu.lsp to create a txt file.
The output was a very clean file with all commands (144) very nicely seperated.

At this point I changed the filename from MenuLines.txt to MenuLines.mns.
....


You're welcome, but as SomeBuddy says, its return is not going to be valid as a Menu file just as it is.  Just to expand slightly on his reply:

 

I set it up to make a .txt file, not a .mnu or .mns file, precisely because what it returns isn't a valid Menu file by itself.  It should be valid menu syntax, if you incorporate it into an existing Menu file.  That would already have all its section headers and so on, but you'll also need to supply subheaders and things in connection with the added lines.  The form of those additional subheaders [and possibly some intermediate lines to subdivide the routine's output into smaller sections, and/or maybe others to follow it] will depend on what kind of menu section/subsection you put it in.  If you know where you want it, we may be able to steer you in the right direction, but Help should be able to do that, too.

Kent Cooper, AIA
Message 25 of 29
Anonymous
in reply to: Anonymous

Oh, OK, I get it now. This just extracts the function names to add to an existing menu.

I guess now it's off to learn about menus.

Geez, one thing about AutoCAD is the more you learn, the more you realize you need to learn more.

 

Thanks for your help and I really did look this up before asking for help but this is a quote directly from the help file:

"However, you no longer perform customization tasks by creating or editing MNU or MNS text files by hand. All customizations are done through the program interface, in the Customize User Interface (CUI) Editor."

 

Autodesk does not provide instructions on how to write this code, and I'm not interested in using the CUI.

Message 26 of 29
Kent1Cooper
in reply to: Anonymous


@Anonymous wrote:

.... this is a quote directly from the help file:

"However, you no longer perform customization tasks by creating or editing MNU or MNS text files by hand. All customizations are done through the program interface, in the Customize User Interface (CUI) Editor."

....


I don't have a new-enough version to have the CUI, but I do wonder whether it might be more accurate to say:

"...you no longer need to perform customization tasks by creating or editing MNU or MNS text files by hand. All customizations can be done through the program interface...."  I seem to recall people on this forum talking about editing .mnu/.mns files even under newer versions that have the CUI, but I may be mistaken.  But if the files that "drive" menus still are .mnu/.mns/etc. files, I can't imagine why you couldn't still edit them directly, as before.

Kent Cooper, AIA
Message 27 of 29
Anonymous
in reply to: Anonymous

You have to find some old AutoCAD installment and read the customization help. Or maybe there are some ttutorials on the Internet from people feeling like you.

Message 28 of 29
Anonymous
in reply to: Anonymous

well I was able to pull it off thanks to your help
after finding a sample of another simple mns I was able to grab these lines:

//
//      AutoCAD menu file - C:\Program Start\MY_MENU.mnc
//

***MENUGROUP=MY_MENU

***POP1
**MY_MENU

ID_001   [MY_MENU]
ID_002   [--]

I just prefixed these to the list compiled by your routine and that was all it took
Now I realize it is very simple menu lacking flyouts and images and tooltips etc but for a beginner this will do just fine. I did read somewhere during all this I can creat a lot of images and include them in a single dll and somehow link it together with this same mns.

 

Anyway this is how it stands as of right now, I have to submit it as a txt, but it is my mns

Message 29 of 29
Anonymous
in reply to: Anonymous

I'm glad It worked for you.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost