TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: stsevedallas on June 13, 2006, 09:01:55 AM

Title: question regarding script and lisp running (together)
Post by: stsevedallas on June 13, 2006, 09:01:55 AM
If I run this in a script...

(load "cloud.lsp") (load "layerdate.lsp") layerdate cloud

It loads both.
It runs "layerdate", then stops.
"Cloud" does not run.
WTF?
Title: Re: question regarding script and lisp running (together)
Post by: stsevedallas on June 13, 2006, 09:08:23 AM
I even tried this change in the script...

(load "cloud.lsp") (load "layerdate.lsp") (c:layerdate) (c:cloud )

same thing...
Title: Re: question regarding script and lisp running (together)
Post by: Didge on June 13, 2006, 09:13:58 AM
Try this:

layerdate;cloud;

(a semi-colon emulates a carriage return)
Title: Re: question regarding script and lisp running (together)
Post by: stsevedallas on June 13, 2006, 09:21:01 AM
";" just put all of that on the command line
nothing...
I put [enter] in the script after each...
nothing.

There is something that I am missing here.
Why does is stop the script before it finishes?
Hmmmmm...
Title: Re: question regarding script and lisp running (together)
Post by: stsevedallas on June 13, 2006, 09:23:24 AM
When I type these on the command line, they work just as they should.
So, why not in a script?
Title: Re: question regarding script and lisp running (together)
Post by: Keith™ on June 13, 2006, 10:16:48 AM
Ok, first things first ...
In a script, if you call a lisp routine that requires user interaction, makes use of "command" or vl-cmdf, or if the lisp generates any error, the script will cease running.
secondly, if you insist upon running scripts that make use of command or vl-cmdf (I think there are a few others, but I cannot remember them at this time), you must edit your lisp routines to be able to interact with scripts.
Finally, you CAN make a simple change to your lisps to make them compatable, but it does not always work and can sometimes create unexpected results.

To fix them so they will work properly, edit the "layerdate" routine to include AS THE LAST LINE in the lisp
Code: [Select]
(vl-cmdf "_.RESUME")

Your scripts will operate as you expect, however, if there is a script that has been interrupted, it will begin execution from where it was interrupted, after running this lisp.

Example ...
You have a script that automates plotting .... after pressing enter, you realize you forgot to change something in the drawing .. rather than plot the things all out and throw them away, you press the ESC key to stop the script. You then begin editing the drawing, and find yourself in need of using the "layerdate" routine. As soon as you run the routine, the resume command is issued and suddenly, inexplicably, the plotting starts up where it left off when you previously cancelled it ...

So, you see it is not a silver bullet, but it will resolve the immediate issue at hand.
Title: Re: question regarding script and lisp running (together)
Post by: stsevedallas on June 13, 2006, 10:27:29 AM
Thanks
Title: Re: question regarding script and lisp running (together)
Post by: David Hall on June 13, 2006, 10:59:36 AM
what version of autocad?  in 2006, for some STUPID IDIOTIC REASON, Autodesk broke scripts.  I know, it seems like thats impossible, but I logged it as a bug and they admitted to breaking it.  Add an extra "space" at the end of your line.  Sounds stupid, but they confirmed it.
Title: Re: question regarding script and lisp running (together)
Post by: Slim© on June 13, 2006, 02:21:45 PM
Add an extra "space" at the end of your line.  Sounds stupid, but they confirmed it.

What reason did they give for adding the "extra" space?
Title: Re: question regarding script and lisp running (together)
Post by: David Hall on June 13, 2006, 02:35:31 PM
it functions like a return.  even though its not needed b/c the real "return" to the next line is there, the scr file needs it.  When I logged it, the tech at AD was amazed b/c "supposedly" the code for scripting hasn't been touched since R13 or something like that.  Maybe it was 14, but either way, I can t believe they broke it