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

"Escape" command in a script that doesn't end the script

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
Anonymous
13965 Views, 9 Replies

"Escape" command in a script that doesn't end the script

I can't find a keystroke or combination of keystrokes that will issue the "escape" command in a script file without ending the script. In other words, I want a line in the script which will issue the "escape" command and then go to the next line of the script and continue on. I never learned Lisp and don't have time to learn it for this exercise.

9 REPLIES 9
Message 2 of 10
Lee_Mac
in reply to: Anonymous

In a macro, you can use ^C or ^C^C to act as escape, I'm not sure whether the same would work in a script however.

 

I can't see why you would need to issue an Escape though? Surely there is a better way to accomplish your task.

Message 3 of 10
scot-65
in reply to: Anonymous

If you are using LT (I.E.: no LISP support), Then

  You may be out of luck.

Else

 Use an IF statement.

End If

 

???


Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.


Message 4 of 10
Kent1Cooper
in reply to: Anonymous


@Anonymous wrote:

I can't find a keystroke or combination of keystrokes that will issue the "escape" command in a script file without ending the script. ....


Neither can I, nor can I find anything in Help about it.  ^C [which works in macros as Lee mentioned] doesn't work in Scripts, and (command) with no arguments [which works in Lisp] stops the entire Script.  Various things involving nil and such get invalidity error messages.

 

One thing that you might be able to use, depending on the particular circumstances, is to do something [anything] to "finish" whatever command you're in, and then put in a U to Undo it.

 

However, I agree that there may be a better way to accomplish whatever you're trying to do than something that requires cancelling.

Kent Cooper, AIA
Message 5 of 10
EC-CAD
in reply to: Anonymous

Try this technique.

To cause an interrupt in the script, do:

(command)

And, to get it going again, at the top of your script, add:

(defun C:N ()

(command "_resume")

)

Then, after your interrupt, just type in N to resume.

Good luck.

EC-CAD

 

Message 6 of 10
Anonymous
in reply to: Anonymous

Thanks to all for the suggestions. Here's the solution that accomplishes my task:

By setting ATTREQ to "0", I can then redefine a block using the block=redefined block method of block insertion, placing the block at 0,0 (instead of needing to "escape"), invoke ATTSYNC to fix all the existing copies of the block, then erase the block at 0,0 by choosing "L" (last). This way I can redefine multiple blocks in one script file without interruption. Of course, running that script as a batch file fixes all the drawings in a project without needing my intervention.

Message 7 of 10
Kent1Cooper
in reply to: Anonymous


@Anonymous wrote:

.... using the block=redefined block method of block insertion, placing the block at 0,0 (instead of needing to "escape"), invoke ATTSYNC ..., then erase the block at 0,0 by choosing "L" (last). ....


A small suggestion:  The Last option in selection within an editing command finds the last object visible within the screen display area.  That may or may not be the last object added to the drawing.  If you're zoomed in or panned over to where a Block inserted at 0,0 isn't visible on the screen, then it will erase something else.

 

Maybe that's not an issue, if you always do this zoomed out to the drawing limits or something.  But if it's a possibility, I suggest using (getvar 'viewctr) as the insertion point.  That will always put it in the middle of the screen, so it will always be there on-screen to be selected for erasure.  [That's assuming the Block's content has a reasonable positional relationship to its insertion point, and the zoom level isn't too extremely far in for a Block that has no actual drawn content at its insertion point].

 

Or, instead of using Erase Last, use (entdel (entlast)), which will remove the last thing in the drawing, whether or not it's visible or even in the current space.  [That's assuming that Attsync doesn't change the draw order somehow -- I haven't experimented with that.]

Kent Cooper, AIA
Message 8 of 10
Anonymous
in reply to: Kent1Cooper

Thanks, Kent. I'll make that change.

Message 9 of 10
jarno.simolin
in reply to: Anonymous

Solve copied from the other forum:

 

You can put (command) in your script file to cancel a command.

Message 10 of 10

Aaah, so the (command) itself is the solution!

I tried to click on it because I thought there was a link to another forum thread! When I found it apparently broken, I kept searching for the other thread. The funny thing is I did find somewhere else saying (command) to be typed in the script! 😄

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

Post to forums  

Autodesk Design & Make Report

”Boost