IS THERE A SIMILAR COMMAND LIKE ^C^C FOR LISP?

IS THERE A SIMILAR COMMAND LIKE ^C^C FOR LISP?

Satoews
Advocate Advocate
1,630 Views
3 Replies
Message 1 of 4

IS THERE A SIMILAR COMMAND LIKE ^C^C FOR LISP?

Satoews
Advocate
Advocate

I have been trying to convert a few of my tool palette custom buttons to lisps so I can keybind them. One of the things that has me stumped is how to mimic the ^C^C in the macro. That way if I am in the middle of another command i don't have to hit escape or enter. I have looked both in this forum and the broader web and haven't found anything that has worked to get me out of a command at the begining of a lisp. (command) has been the closest thing that i have seen with it bringing in a *cancel* in the command line but it dosen't work while in a command.

 

thanks in advance!

 

Shawn T
0 Likes
1,631 Views
3 Replies
Replies (3)
Message 2 of 4

scot-65
Advisor
Advisor
What you are suggesting is to invoke a transparent
command for the purposes of canceling the command
and then starting your command.

I do not know of any method that can do this other than
to define your command inside the CUI, where ^C^C can
be written?

Perhaps assign one of the [F#] keys?
Perhaps change your habits?

???

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

Message 3 of 4

Kent1Cooper
Consultant
Consultant

If you're talking about an AutoLisp routine defined as a command with

 

(defun C:WHATEVER (/ ....

 

bear in mind that [I believe] the C: there stands for "Command," and that typing in [or feeding in from a keystroke combination or menu item] WHATEVER will only be accepted to start that command when the Command: prompt is waiting for a command, at which time you won't be in any command for it to cancel.  Similarly, you can't type in MOVE in the middle of a Line command and expect it to cancel the Line command and go into the Move command -- you have to type in MOVE at the Command: prompt.  There are exceptions in transparent commands, with the apostrophe prefix, and I think you can build AutoLisp routines to work that way, but the whole point of those is to not cancel the command you're in, so I assume that's not relevant to the question at hand.  But without looking it up, I have a vague recollection that if you want to be able to use a routine transparently, it can't have any (command) functions in it.

 

I'm going to speculate without trying any of this, and if the preceding sentence is correct, it may kill the whole idea, but....

 

You may need to treat a (defun)'d command, when in the middle of another command, like a function, [that's what puts the "fun" in (defun), after all], rather than like a command.  Just as you can start up an AutoLisp function in mid-command [you could, for instance, at a Line command's pick-a-point prompt, type in things like (getvar 'viewctr)], and it's the left parenthesis at the beginning that tells it that's what you're doing, maybe you can call for a (defun)'d command in the same way that you would when inside another AutoLisp routine, but enclosing its name in parentheses and including the C: prefix:

 

(C:WHATEVER)

 

If that's allowable, and if WHATEVER is defined with a (command)-with-no-arguments function [or two, to parallel the typical command-macro ^C^C situation] at the beginning, it may be able to cancel whatever other command you're in and continue doing its own thing.  That shouldn't be hard to set up and try with a Toolbar item, and through that with a keystroke combination.  But to use WHATEVER by typing at the Command: prompt, if it will allow it at all in mid-command, you would also need to include the parentheses and C: with it.

 

Now someone who really knows can chime in and correct me.

Kent Cooper, AIA
Message 4 of 4

Satoews
Advocate
Advocate

Thanks guys for the input and apologies for the late response. I found the easiest way at this time is to just make them into shortcuts in the CUi so i can add the ^c^c into the macro there.

 

thanks again!! 

Shawn T
0 Likes