Results 1 to 2 of 2

Thread: copy text entity values

  1. #1
    I could stop if I wanted to
    Join Date
    2006-04
    Posts
    466
    Login to Give a bone
    0

    Default copy text entity values

    ; this autolisp program copy text entity values.

    Code:
    (defun c:tce()
        (prompt "\n Change text of selected object(s) to match entity\n")
        (setq
            loop
                T
        )
        (while loop
            (if
                (setq
                    ent_to_change
                        (entsel "\nSelect text to change: ")
                )
                (progn
                    (setq
                        ent_to_change
                            (entget
                                (car ent_to_change)
                            )
                        loop
                            (not
                               (OR
                                (eq
                                    (dxf 0 ent_to_change)
                                     "TEXT"
                                )
                                (eq
                                    (dxf 0 ent_to_change)
                                     "MTEXT"
                                )
                               );END OR
                            )
                    )
                    (entupd
                        (dxf -1 ent_to_change)
                    )
                )
            )
            (if loop
                (alert "Object selected was not text")
            )
        )
        (setq
            loop
                T
        )
        (while loop
            (if
                (setq
                    ent_to_match
                        (entsel "\nSelect text to match: ")
                )
                (progn
                    (setq
                        ent_to_match
                            (entget
                                (car ent_to_match)
                            )
                        loop
                            (not
                               (OR
                                (eq
                                    (dxf 0 ent_to_match)
                                    "TEXT"
                                )
                                (eq
                                    (dxf 0 ent_to_change)
                                     "MTEXT"
                                )
                               );END OR
                            )
                    )
                )
            )
            (if loop
                (alert "Object selected was not text")
            )
        )
        (setq
            text_to_change
                (dxf 1 ent_to_change)
            text_to_match
                (dxf 1 ent_to_match)
            old
                (assoc 1 ent_to_change)
            new
                (cons 1 text_to_match)
            ent_to_change
                (subst new old ent_to_change)
        )
        (entmod ent_to_change)
        (princ)
    )
    [ Moderator Action = ON ] What are [ CODE ] tags... [ Moderator Action = OFF ]
    Attached Files Attached Files
    Last edited by Mike.Perry; 2007-01-09 at 09:18 AM. Reason: [CODE] tags added.

  2. #2
    I could stop if I wanted to kpblc2000's Avatar
    Join Date
    2006-09
    Posts
    212
    Login to Give a bone
    0

    Default Re: copy text entity values

    Why variables like ent_to_match, loop etc are not local?

Similar Threads

  1. Replies: 0
    Last Post: 2013-06-20, 08:03 AM
  2. Replies: 4
    Last Post: 2008-11-13, 05:36 AM
  3. Replies: 21
    Last Post: 2006-10-18, 05:03 PM
  4. Extract Text and Text insertion point (X and Y values)
    By cscott.94049 in forum AutoCAD General
    Replies: 23
    Last Post: 2006-09-18, 06:02 PM
  5. How to get the width of a text entity?
    By GreyHippo in forum AutoLISP
    Replies: 5
    Last Post: 2006-05-25, 09:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •