AutoCAD/Lisp routines

Advertisement


Question
QUESTION: Hi,
I've been using autocad for almost as long as you and have been very interested by LISP programming since then, it has made my working life easier.
Here's my question:
after all this years, I created a custom menu containing what it could be percieved as a CAD Standard that could be used by any office. It is made out of a lot of routines, including LISP.
For some reason, since Autocad 2010, my menu is not responding adequatly. It's like every command works the first time in a drawing and then it stops working. I'm wondering if there is some ''variable'' blocking the way through.
For example; I insert a symbol through a menu routine.. a very simple ''_insert'' command and then it would not insert again..
When I do it manually, it works.
I realized, by doing it manually, that autocad ''alerts'' me about the block being allready inserted and if I would like to redefine it...Could that be blocking my automatic routine?
Thanks

ANSWER: I suspect you are doing an insert where the filename equals something else causing the block redefinition, otherwise autocad will not prompt. Look for and = sign where the filename is being specified in your code.

---------- FOLLOW-UP ----------

QUESTION: I actually added =
My sentence looks like this;
[BGA Imperial]^c^cclayer;0;-insert;0000_template_arch-IMP;0,0;1;1;0
Now it looks like this;
[BGA Imperial]^c^cclayer;0;-insert;0000_template_arch-IMP=0000_template_arch-IMP;0,0;1;1;0
And now it works...it inserts every time now.
The funny thing is that it happened only with this file..all other blocks insert fine.
This is actually an empty dwg file I use as a template.

My menu now works fine and I have another question;
I'm implementing the menu in the office and I'm wondering if there is a simple way of inserting (or regenerating) the menu file everytime it is updated, instead of going through every single station to reload the menu with ''menuload''...unload then reload..

Thanks

Answer
Yes, you need to locate the menu file on the network and menuload it from there.  When you reload the menu on your workstation, the others will also get an update of it next time they start autocad.  Make sure the folder is read-only for regular users, and read-write for yourself so that they aren't able to change it accidentally.
I also use the .mnl file with the same name as the menu to load shared lisp routines that are required for the menu to function.
You may need to add the folder to the autocad search path, too.

AutoCAD

All Answers


Answers by Expert:


Ask Experts

Volunteer


Scott Cook

Expertise

I`ve been using AutoCAD since 1987 and programming AutoLISP nearly as long. I can answer questions about programming AutoCAD (except ARX) and production enhancement techniques. I cannot answer questions about AutoCAD crashes or DWG corruption. AutoCAD PROGRAMMING (menus, lisp) related questions only!

Experience

Since 1987. Author of Plot2000 software for for AutoCAD, http://www.plot2000.com. PROGRAMMING QUESTIONS ONLY PLEASE. Questions that are NOT related to programming or AutoCAD customization (menus and lisp only please) are outside the scope of my volunteer services and will NOT BE ANSWERED.

©2012 About.com, a part of The New York Times Company. All rights reserved.