SSGET & ENTSEL

Discussion in 'AutoCAD' started by Adesu, Oct 7, 2004.

  1. Adesu

    Adesu Guest

    This is my argument,is it true,I wait comment from others.

    (setq ss (ssget "x" '((0 . "TEXT")))) => this function only for object text
    and last entity,because it automatic collect without wait from user

    (setq info (entget (car (entsel)))) => this function for alls object as user
    choose,it can't collect data without instruction from user to select it.
     
    Adesu, Oct 7, 2004
    #1
  2. (setq ss (ssget "x" '((0 . "TEXT"))))
    this statement is used to find all text in the drawing with user interaction

    (setq info (entget (car (entsel))))
    this statement is used to let the user select an entity and save the entity
    data to "info"

    personally I don't do this in one line

    Here is an alternative method to avoid errors in the program -
    (while (not (setq ES (entsel "\nSelect ? ")))
    (princ "\nNothing selected, please try again....")
    )
    (setq info (entget (car ES)))
    ....do the rest of your code here....

    this method forces the user to select something
     
    Alan Henderson @ A'cad Solutions, Oct 7, 2004
    #2
  3. <snip> this statement is used to find all text in the drawing without user interaction<snip>
     
    Casey Roberts, Oct 7, 2004
    #3
  4. Adesu

    Adesu Guest

    Hi Alan & Casey,thanks a lot for your comment,I 've got good format formula
    as below.

    (while (not (setq ES (entsel "\nSelect ? ")))
    (princ "\nNothing selected, please try again....")
     
    Adesu, Oct 8, 2004
    #4
  5. Adesu

    CAB2k Guest

    Here are some more options for you to look at.
    Code:
    (defun c:test (/ es data)
    (setvar "errno" 0) ; reset error no.
    (while
    (progn
    (initget "eXit")
    (setq es (entsel "\nSelect a text object: [eXit] "))
    (cond
    ((= 52 (getvar "errno"))
    (princ "\nENTER Pressed, please try again....")
    t ; stay in loop
    )
    ((null es)
    (princ "\nNothing selected, please try again....")
    t ; stay in loop
    )
    ((= es "eXit") ; exit if the user keyed-in or used the
    ;; right-click menu to select 'exit'
    nil ; exit loop
    )
    ((and
    (setq data (entget (car es)))
    (= "TEXT" (cdr (assoc 0 data)))
    )
    nil ; exit loop
    )
    (t
    (princ "\nNot a Text object, please try again....")
    t ; stay in loop
    )
    )
    )
    )
    data ; return text entity list or nil
    )
     
    CAB2k, Oct 9, 2004
    #5
  6. Adesu

    Adesu Guest

    Hi CAB2k,thanks for your added comment
     
    Adesu, Oct 11, 2004
    #6
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.