#AutoLISP question
5 messages in this thread
I am using the AutoLISP routines from within the MENUS. I am creating an
application which is completely driven by MENUS. However from time to time I
get an error saying "Can not reenter AutoLISP". What does this mean ?. Does
anyone has experience doing AutoLISP programming in MENU file ?. It seems
that an extra Carriage return can screw up the MENUS completely. Can you give
me some insight how the AutoLISP works from the MENU file ?. Thanks.
Prakash —
There's really no difference in using AutoLISP from an AutoCAD menu
file and using it at the "Command:" prompt.
A space character in a menu file is an explicit carriage return.
The "Can't re-enter AutoLISP" error message indicates that the
AutoCAD-AutoLISP communication buffer is in use by an active function, and
that no new function can be called until the active one is complete. Can
you give me an example of the AutoLISP function-menu selection that is
causing this error? We should be able to debug your code and fix it.
— Brad
..
Brad:
Not to butt in, but I had the same thing happen to me the other day when I
was trying to do a quick fix to a menu macro. I didn't have the time to think
it all out, but this is something like what I was doing. I don't remeber the
exact condition, but I was trying to add some commands to one of those
wonderful 'Kelvinated' lisp routines in a series.
….(f:drag "a1008b" x y r)/^c (command "insert" "a1008b" "@" x y pause)…
etc… The error occured after the cancellation of the drag function. The
macro originally had standard commands following the lisp routine, but I
needed to proceed with a series of commands. I tried listing the commands as
standard prompt commands, and also using (progn… and couldn't get around
the 'Can't reenter Autolisp, even though with one version, everything
executed properly. I'm not sure if I used a space (return) following the ^c,
but I'm pretty sure I tried it both ways in one form or another. What did I
do wrong? I am sure the error occured in this portion of the macro.
Craig.
.
Craig —
I don't know, but here's an example of what can cause the "Can't
re-enter AutoLISP" error (kids, don't try this at home):
..
Command: (setq pt1 (getpoint "\nPoint: "))
Point: (getpoint)
Can't re-enter AutoLISP
Invalid point.
Try again:
..
After the first expression is entered, the GETPOINT function is
active and waiting for input. If we try to respond to the GETPOINT
function's prompt with another GETPOINT function, that's when we get the
error. Does this help? I can think of any number of situations where it
would be possible to attempt to do something like this, only to be doomed
to failure (of course).
One caveat about AutoLISP and menus. There is a DOS imposed
limitation on the length of any line of text which, for some probably very
good reason, effectively limits the length of any single AutoLISP
expression contained in a menu macro to 255 characters…UNLESS explicit
carriage returns are included in the menu item/AutoLISP expression before
the 255th character!
— Brad
..
Brad:
Thanks for the response; I think you may have hit on something; the 255
character limit is new to me; You know, I have always had a goofy time
combining command prompt responses and lisp routines in menu; macros. I think
I have always been missing part of the concept.
Craig;
.