pausing for a command to complete

Fred Hopkins

Usenet Archive
Joined
Sep 17, 2003
Messages
6
Reaction score
0
I have a lisp to set a certain layer active, then execute a command, then reset the layer back to what it was beforehand. I am running into trouble where I issue the command (itself a variable), becuase the number of user inputs can vary and I don't know how to make my lisp wait for the user to complete the command before resetting the layer. Pause would only work if I always needed the same number of pauses for every type of command. The way this works is I define the lisp as part of a company mnl file, then modify toolbar properties, such as dimlinear and qleader to call the lisp and use the command as an argment to the lisp.

 

(defun C:layerkey ( / currentlayer newlayer acadcommand)

(setq currentlayer (getvar "clayer"))

(setq acadcommand (getstring))

(if (wcmatch acadcommand "*dim*")

(setq newlayer "A-Anno-Dims")

(setq newlayer "A-Anno-Note")

)

(command "-layer" "m" newlayer "c" "42" "" "")

(command acadcommand)

(setq currentlayer (getvar "clayer"))

(princ)

)

 

Any thoughts?
 
Try using this sequence

(command acadcommand)

(while (> (getvar "cmdactive") 0) (command pause))

(setq currentlayer (getvar "clayer"))

fred hopkins said:
I have a lisp to set a certain layer active, then execute a command, then reset the
layer back to what it was beforehand. I am running into trouble where I issue the command (itself a variable), becuase the number of user inputs can vary and I don't know how to make my lisp wait for the user to complete the command before resetting the layer. Pause would only work if I always needed the same number of pauses for every type of command. The way this works is I define the lisp as part of a company mnl file, then modify toolbar properties, such as dimlinear and qleader to call the lisp and use the command as an argment to the lisp.
 
Fred,

The following links to a nice example of how to use reactors to do what you're trying to do.

http://www.afralisp.com/vl/reactors2.htm

Not exactly what you asked for, but maybe of interest.

Steve
I have a lisp to set a certain layer active, then execute a command, then reset the layer back to what it was beforehand. I am running into trouble where I issue the command (itself a variable), becuase the number of user inputs can vary and I don't know how to make my lisp wait for the user to complete the command before resetting the layer. Pause would only work if I always needed the same number of pauses for every type of command. The way this works is I define the lisp as part of a company mnl file, then modify toolbar properties, such as dimlinear and qleader to call the lisp and use the command as an argment to the lisp.

(defun C:layerkey ( / currentlayer newlayer acadcommand) (setq currentlayer (getvar "clayer")) (setq acadcommand (getstring)) (if (wcmatch acadcommand "*dim*") (setq newlayer "A-Anno-Dims") (setq newlayer "A-Anno-Note") ) (command "-layer" "m" newlayer "c" "42" "" "") (command acadcommand) (setq currentlayer (getvar "clayer")) (princ)
)

Any thoughts?
 
For qleader remember to set texteval to 1 or the results will not be as expected.

fred hopkins said:
I have a lisp to set a certain layer active, then execute a command,
then reset the layer back to what it was beforehand. I am running into trouble where I issue the command (itself a variable), becuase the number of user inputs can vary and I don't know how to make my lisp wait for the user to complete the command before resetting the layer. Pause would only work if I always needed the same number of pauses for every type of command. The way this works is I define the lisp as part of a company mnl file, then modify toolbar properties, such as dimlinear and qleader to call the lisp and use the command as an argment to the lisp.
 

Latest threads

Back
Top