Results 1 to 4 of 4

Thread: Macro to edit text

  1. #1
    Member
    Join Date
    2015-05
    Posts
    20
    Login to Give a bone
    0

    Default Macro to edit text

    I would like to click an existing (single line) text in my drawings and have the text replaced by a text in my macro. The text in my drawing will not always be the same, but the new text (from the macro) will always be the same.

    Thanks in advance for the help.

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Macro to edit text

    So you want to pick any TEXT object and replace the entire string with a new string of your own?

    Maybe something like this?

    Code:
    (defun c:tr ( / mynewstr sset ent lst newlst i)
      (setq mynewstr "REPLACED")
      (setq sset (ssget '((0 . "TEXT"))) i 0)
      (repeat (sslength sset)
        (setq ent (ssname sset i))
        (setq lst (entget ent))
        (setq newlst (subst (cons 1 mynewstr) (assoc 1 lst) lst))
        (entmod newlst)
        (setq i (1+ i))
      )
    )
    R.K. McSwain | CAD Panacea |

  3. #3
    Member
    Join Date
    2015-05
    Posts
    20
    Login to Give a bone
    0

    Default Re: Macro to edit text

    I don't do autolisp but will try it out. I am hoping for a simple script in a button.
    I thought this would work:
    ^C^C.DDEDIT;"My New Text String";
    I don't do scripts very well either

  4. #4
    Member
    Join Date
    2015-05
    Posts
    20
    Login to Give a bone
    0

    Default Re: Macro to edit text

    That works great! How could I add it to a button though?

Similar Threads

  1. Macro for polyline edit
    By Michael J in forum AutoLISP
    Replies: 2
    Last Post: 2015-01-09, 06:18 AM
  2. Edit text in place with macro
    By kole_bg907874 in forum AutoLISP
    Replies: 3
    Last Post: 2012-01-12, 12:39 PM
  3. AutoCAD LT - Macro to set text size according to dimscale text
    By kwong in forum AutoCAD Customization
    Replies: 6
    Last Post: 2007-05-07, 10:18 AM
  4. Text Style Macro Help!
    By jvoight in forum AutoCAD Customization
    Replies: 0
    Last Post: 2005-04-17, 10:31 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
  •