showing selection

Discussion in 'AutoCAD' started by FELIPE, Feb 2, 2005.

  1. FELIPE

    FELIPE Guest

    This is a great lisp file that matches text strings.
    The only this that it doesn't do is show selected text.
    What needs to be done to make it show this selection?

    ;**********************************************************************
    ; Original Program Name: C:CA
    ; Description: Match text values in attributes or text strings. Pick
    ; Source entity (Attribute or Text) then pick destination
    ; entity, it will copy the text value from the source to
    ; the destination.
    ; Date: 4-23-99
    ; Version: 1.00
    ; Author: Micah Nerren (714) 556-4454
    ;**********************************************************************
    ; New Program Name: C:CopyText
    ; Overhauled 06-19-02 by John Uhden, Cadlantic
    ; based on request by
    ; in the AutoCAD Customization Newsgroup.
    ; Note: Since there's almost nothing left of the original code,
    ; this is donated as public domain, aka "Freeware"
    ; R15+ only
    ;**********************************************************************
    (defun C:CA ( / *error* source text pick target ent layer)
    (vl-load-com)
    (if (not *acad*)(setq *acad* (vlax-get-acad-object)))
    (defun *error* (errmsg)
    (vla-EndUndoMark (vla-get-activedocument *acad*))
    (and
    errmsg
    (not (wcmatch (strcase errmsg) "*QUIT*,*CANCEL*"))
    (princ (strcat "\nERROR: " errmsg))
    )
    (princ)
    )
    (vla-StartUndoMark (vla-get-activedocument *acad*))
    (AND
    (setq source (car (nentsel"\nSelect Source Text/Attribute: ")))
    (setvar "errno" 0)
    (or
    (member (cdr (assoc 0 (setq source (entget source))))'("TEXT" "ATTRIB"))
    (prompt "\n Must be either an Attribute or Text!")
    )
    (setq text (cdr (assoc 1 source)))
    (princ (strcat "\n Source Value = " text))
    (while (/= (getvar "errno") 52)
    (and
    (setq pick (nentsel "\nSelect target Text/Attribute to change: "))
    (setq target (car pick))
    (setq ent (entget target)
    layer (cdr (assoc 8 ent))
    target (vlax-ename->vla-object target)
    )
    (or
    (= (length pick) 2)
    (prompt "\n Target is nested in a Block or Xref")
    )
    (or
    (member (cdr (assoc 0 ent)) '("TEXT" "ATTRIB"))
    (prompt "\n Must be either an Attribute or Text!")
    )
    (or
    (/= (logand 4 (cdr (assoc 70 (tblsearch "layer" layer)))) 4)
    (prompt (strcat "\n Layer " layer " is locked"))
    )
    (or
    (/= (vla-get-textstring target) text)
    (prompt "\n Text is the same.")
    )
    (and
    (not (vla-put-textstring target text))
    (/= (vla-get-textstring target) text)
    (princ "\n Failed to modify target.")
    )
    )
    )
    )
    (*error* nil)
    )
     
    FELIPE, Feb 2, 2005
    #1
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.