pausing for a command to complete

Discussion in 'AutoCAD' started by fred hopkins, Sep 17, 2003.

  1. fred hopkins

    fred hopkins Guest

    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?
     
    fred hopkins, Sep 17, 2003
    #1
  2. Try using this sequence

    (command acadcommand)

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

    (setq currentlayer (getvar "clayer"))


    --

    -Jason
    Member of the Autodesk Discussion Forum Moderator Program


    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.
     
    Jason Piercey, Sep 17, 2003
    #2
  3. fred hopkins

    Steve Jones Guest

    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?
     
    Steve Jones, Sep 17, 2003
    #3
  4. For qleader remember to set texteval to 1 or the results will not be
    as expected.

    --
    Ken Alexander
    Acad2000
    Windows2000 Prof.

    "We can't solve problems by using the same kind
    of thinking we used when we created them."
    --Albert Einstein

    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.
     
    Ken Alexander, Sep 17, 2003
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.