If user click ""

Discussion in 'AutoCAD' started by Adesu, Aug 16, 2004.

  1. Adesu

    Adesu Guest

    (setq loc (entsel "\nCLICK TEXT WOULD YOU CHANGE: ")
    lisloc (entget (car loc))
    namtex (cdr (assoc 0 lisloc)))
    (cond ((/= namtex "TEXT")(princ "YOUR CHOOSE OBJECT INVALID"))
    ((eq loc "")(princ "DON'T CLICK ENTER,YOU NOT YET CHOOSE"))
    )
    ; end of cond

    Can you help me, if user hit enter , "DON'T CLICK ENTER,YOU NOT YET CHOOSE"
    it work,thanks a lot.
     
    Adesu, Aug 16, 2004
    #1
  2. Adesu

    Jürg Menzi Guest

    Hi Ade

    Add this funtion to your code:
    Code:
    (defun ExtEntsel (Pmt Typ / CurEnt ExLoop)
    (while (not ExLoop)
    (initget " ")
    (setq CurEnt (entsel Pmt))
    (cond
    ((eq CurEnt "") (setq ExLoop T CurEnt nil))
    (CurEnt
    (if (eq (cdr (assoc 0 (entget (car CurEnt)))) Typ)
    (setq ExLoop T)
    (princ (strcat " the selected object is not a " Typ "!"))
    )
    )
    ((princ " 1 selected, 0 found. "))
    )
    )
    CurEnt
    )
    Returns:
    - User select a correct entity: '(<Ename> '(x y z))
    - User select a wrong entity: remains in loop, print message 'the selected
    object is not a TEXT!'
    - User pick nothing: remains in loop, print message '1 selected, 0 found.'
    - User press Enter, Space or right mouse click: nil
    
    Call the function in your code like this:
    (if (setq loc (ExtEntsel "\nCLICK TEXT WOULD YOU CHANGE: " "TEXT")
    (progn
    (...rest of your code)
    ) ;end progn
    ) ;end if
    
    Cheers
     
    Jürg Menzi, Aug 16, 2004
    #2
  3. Adesu

    Adesu Guest

    any others ?
     
    Adesu, Aug 18, 2004
    #3
  4. Adesu

    Jürg Menzi Guest

    Not enough?
     
    Jürg Menzi, Aug 18, 2004
    #4
  5. Adesu

    Adesu Guest

    Yes Sir
     
    Adesu, Aug 18, 2004
    #5
  6. Adesu

    Jürg Menzi Guest

    Hi Ade

    I wouldn't be impolite, but consider...
    You place many questions in this forum and that's ok. However there is
    something what's very surprising me. You receive many good suggestions
    and references, but ignore those often and post code with the same old
    errors for the next question. If you - as you mentioned - really wanna
    learn LISP, it would be recommendable to work at your attention.
    Only a well meant advice - no offending behaviour.

    Good luck and happy programming...:cool:
     
    Jürg Menzi, Aug 18, 2004
    #6
  7. Adesu

    Adesu Guest

    Hi Jürg, thanks for your comment and I hope you don't boring to my question
    in this forum,and very sorry ,if you got unpolite "sentence" or not in
    place,you hope understand for my English.
    Best regards
    Ade Suharna
     
    Adesu, Aug 18, 2004
    #7
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.