clicking accidentally beside a block...

Discussion in 'AutoCAD' started by Marcel Janmaat, Mar 7, 2005.

  1. I use;

    (while (setq el1 (entsel (strcat "\nSelect block for code " spc " <cancel>:
    ")))
    ...
    ...
    )

    But don't want to leave the wile when accidentally clicking just beside the
    block. Wich is what happens now.
    Enter should leave the while loop.

    Any sugs.

    M
     
    Marcel Janmaat, Mar 7, 2005
    #1
  2. Use (getvar "errno") to see if the user picked a point
    or pressed ENTER.
     
    Tony Tanzillo, Mar 7, 2005
    #2
  3. Marcel Janmaat

    James Allen Guest

    Hi Marcel,
    Here's one way:
    Code:
    (while (and (not (setq ename (entsel "\nPick object. ")))
    (= (getvar "errno") 7))
    (prompt "\nMissed, Try again. ")
    )
    
    For a good discussion of this, see the following thread:
    http://discussion.autodesk.com/thread.jspa?messageID=1112390
    --
    James Allen, EIT
    Malicoat-Winslow Engineers, P.C.
    Columbia, MO
     
    James Allen, Mar 7, 2005
    #3
  4. Marcel Janmaat

    Jürg Menzi Guest

    Hi Marcel

    Try this:
    Code:
    (defun MeExtEntsel (Pmt Lst Err / CurEnt ExLoop)
    (while (not ExLoop)
    (initget " ")
    (setq CurEnt (entsel Pmt))
    (cond
    ((eq CurEnt "") (setq ExLoop T CurEnt nil))
    (CurEnt
    (if (apply 'and
    (mapcar '(lambda (l) (member l (entget (car CurEnt)))) Lst)
    )
    (setq ExLoop T)
    (princ (strcat " the selected object is not a " Err "!"))
    )
    )
    ((princ " 1 selected, 0 found. "))
    )
    )
    CurEnt
    )
    
    Use:
    (MeExtEntSel "\nSelect block: " '("INSERT") "block")

    Cheers
     
    Jürg Menzi, Mar 7, 2005
    #4
  5. Thanx! Got it working with this...

     
    Marcel Janmaat, Mar 7, 2005
    #5
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.