Input from user changeable by user

Discussion in 'AutoCAD' started by Adesu, Nov 10, 2004.

  1. Adesu

    Adesu Guest

    Command: ept
    Select object:
    ENTER NEW TEXT: INITIAL CHECKLIST OF PART XXXXXXXXX

    I would to

    Select object:
    ENTER NEW TEXT: INITIAL CHECKLIST OF PART BATTERY FIXER

    But problem is "INITIAL CHECKLIST OF PART XXXXXXXXX" can't change by
    user,how to become changeable?

    ; ept is stand for edit part text
    ; Design by Ade Suharna
    ; 10 November 2004
    ; program no. 139/11/2004
    ; edit by
    (defun c:ept (/ en ent opt ed)
    (setq en (entget (car (entsel))))
    (setq ent (cdr (assoc 1 en)))
    (setq opt (getstring T (strcat "\nENTER NEW TEXT: " ent)))
    (setq ed (subst (cons 1 opt)(assoc 1 en) en))
    (entmod ed)
    (princ)
    )
     
    Adesu, Nov 10, 2004
    #1
  2. Adesu

    Jürg Menzi Guest

    Hi Adesu

    How about double click text?

    Cheers
     
    Jürg Menzi, Nov 10, 2004
    #2
  3. Adesu

    Adesu Guest

    Hi Jürg
    It still can't replace or edit by user input,is there any option to
    changeable variable "(setq ent (cdr (assoc 1 en)))",I mean
    Command: ept
    Select object:
    ENTER NEW TEXT: Adesu ====> to become Ade [this here give space by hit 2 x
    mouse pointer and then] s [this here replace text by "S"] u [then added
    "harna"].
    The problem is if text to long and replace only one or two string,I want and
    I would this like below,if I type
    "Jürg Memzi",wrong string only 1 is "m" ,I don't want retype "Jürg Menzi".
     
    Adesu, Nov 11, 2004
    #3
  4. Adesu

    ECCAD Guest

    (defun C:CT (/ p l n e os as ns st s nsl osl sl si chf chm cont)
    (setvar "ATTDIA" 0)
    (setq chm 0 p (ssget)) ; Select objects
    (if p (progn ; If any objects selected
    (setq cont t)
    (while cont
    (setq osl (strlen (setq os (getstring "\nOld string: " t))))
    (if (= osl 0)
    (princ "Null input invalid")
    (setq cont nil)
    )
    )
    (setq nsl (strlen (setq ns (getstring "\nNew string: " t))))
    (setq l 0 n (sslength p))
    (while (< l n) ; For each selected object...
    (if (= "TEXT" ; Look for TEXT entity type (group 0)
    (cdr (assoc 0 (setq e (entget (ssname p l))))))
    (progn
    (setq chf nil si 1)
    (setq s (cdr (setq as (assoc 1 e))))
    (while (= osl (setq sl (strlen
    (setq st (substr s si osl)))))
    (if (= st os)
    (progn
    (setq s (strcat (substr s 1 (1- si)) ns
    (substr s (+ si osl))))
    (setq chf t) ; Found old string
    (setq si (+ si nsl))
    )
    (setq si (1+ si))
    )
    )
    (if chf (progn ; Substitute new string for old
    (setq e (subst (cons 1 s) as e))
    (entmod e) ; Modify the TEXT entity
    (setq chm (1+ chm))
    ))
    )
    )
    (setq l (1+ l))
    )
    ))
    (princ "Changed ") ; Print total lines changed
    (princ chm)
    (princ " text lines.")
    (terpri)
    ); end function

    Bob
     
    ECCAD, Nov 11, 2004
    #4
  5. Adesu

    Jeff Mishler Guest

    Use Acad's "Find" command. It will allow you to search & replace text in
    Mtext, Text, Attributes, Dimensions, Hyperlinks

    --
    Jeff
    check out www.cadvault.com
     
    Jeff Mishler, Nov 11, 2004
    #5
  6. Adesu

    Adesu Guest

    Hi ECCAD,thanks a lot for yours respond,sorry I late to answer,I just week
    for 10 days.
     
    Adesu, Nov 22, 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.