AutoCAD Tips and Tricks

Free AutoLisp Routine (Text Transfer)

2,595 views

I think it is safe to say that, most of the advance AutoCAD users, knows how to use AutoLisp, they might even know how to do a routine by themselves as well.  Just like some of my colleagues, back in the previous company that I’ve been work with. Some of my colleagues there are AutoLisp fanatics, they even develop an AutoLisp routine of their own. And I can even say that I know how to do a AutoLisp routine, albeit not that complex as some of my colleagues does.

Well, anyway I just like to share an AutoLisp routine that my colleagues shared with us back then. This routine called Text Transfer.

Text Transfer is an AutoLisp routine, that will allow you to copy a series of text content to one place to another. You’ll just have to select the text content that you want to be copied and transfer it to another location, by clicking the text on the selected location or the text you want to replace. 

Copy the set of text below and save it to notepad, but make sure that you put (.lsp) as your file extension, or it wont work, then save it and put it on a folder that you can easily remember.

Text Transfer Lisp

 

(defun c:tt ( / A B)

 (setq A (cdr (assoc 1 (entget (car (entsel “Select TEXT to be TRANSFER: “))))))

   (while (setq B (car (entsel “Select TEXT item to be REPLACE: “)))

    (setq C (entget B))

    (entmod (subst (cons 1 A)(assoc 1 C)C))

   (if (or (= (cdr (assoc 0 C)) “POLYLINE”)(= (cdr (assoc 0 C)) “INSERT”))

   (entupd B)))

 

(princ))

 

text_transfer4

Then, at the command prompt, type APPLOAD, then a dialogue box will pop, then frome there select the routine that you saved, then click the Load button. then you’re all set.

At the command prompt, type Text Transfer or TT, then select the text to be transfer, after selecting, select text item to be replace. Then voila!!…

text_transfer1

text_transfer3

 

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • StumbleUpon
  • SphereIt
  • Tumblr
  • BlogMemes
  • Blogosphere News
  • Faves
  • Reddit
  • Yigg
  • blinkbits
  • BlinkList
  • Slashdot

Related Posts:

  • How to Load an AutoLISP File
  • Change layout MS to PS
  • Using command aliases
  • Using Change Text Case (TCASE)
  • Contact me
  • Free AutoCAD Downloads

    18 Responses to “Free AutoLisp Routine (Text Transfer)”

    1. Marti says:

      Hi,
      I tried it but once I loaded it and type TT it says
      Command: tt Unknown command “TT”. Press F1 for help.
      Any clues why this is not working?

    2. jlois says:

      hi you have to upload it first to your autocad, before it works. Try to copy the set of text that I qouted, then put .lsp as extension file.

    3. onzki says:

      I was able to upload- but when i execute the command- it says “too many arguments”.. what do you think is the problem? thanks

    4. jr says:

      It says ” too many arguments”. There might be something wrong with the syntax.

    5. Admin says:

      @jr and onzki

      I just check it and tried many times and i dnt see any prblems at all?

    6. jowycv says:

      after copying the routine from this page, paste it to notepad and then retype quatation marks from (“) to (”), ACAD doesn’t recognize the mark “, instead use “..

    7. cad blog says:

      Thanks for sharing this autolisp. Will it work on autocad 2000?

    8. Admin says:

      @cadblog
      I think it will work in autocad 2000

    9. clixs says:

      I got better routines in copying text from one to another. I can share it here with you. I can do a lot of Autolisp programming too, but it will cost you some bucks.

      To the Author:
      Keep up the good work for contributing your experience to the Filipino Community. I’ve been mastering Autocadd too for 13 years and counting.

    10. clixs says:

      DEBUG IT:

      Program Structures are fine only that you have a special characters on the quote signs (”"). Here it is;

      (defun c:tt ( / A B)
      (setq A (cdr (assoc 1 (entget (car (entsel “Select TEXT to be TRANSFER: “))))))
      (while (setq B (car (entsel “Select TEXT item to be REPLACE: “)))
      (setq C (entget B))
      (entmod (subst (cons 1 A)(assoc 1 C)C))
      (if (or (= (cdr (assoc 0 C)) “POLYLINE”)(= (cdr (assoc 0 C)) “INSERT”))
      (entupd B)))
      (princ))

      Hope you like it.
      clixs
      clirrie@yahoo.com

    11. clixs says:

      Oh sorry for the last post, please remove it coz when i try to copy & paste the code it says too many arguments. Your forum automatically converts the open and close apostrophe (”") to a web characters.

      For the people who wants to try this out please replace the Open & Close apostrophe in notepad then try to save it, it will work fine. I also tried it to 2007 and it works perfect too.

      clixs (email: clirrie@yahoo.com)
      Autolisp Programmer

    12. How to Load an AutoLISP File | PinoyCAD[dot]net | Your Daily dose of AutoCAD Tutorials says:

      [...] of this method here in this post Free AutoLISP Routine. Share and [...]

    13. How to Load an AutoLISP File | All About CAD says:

      [...] More of this method here in this post Free AutoLISP Routine. [...]

    14. CADcaster » How to Load an AutoLISP File says:

      [...] More of this method here in this post Free AutoLISP Routine. [...]

    15. Ronald Maneja says:

      hi, i just read this one today, I made a few adjustments because there is no need for polyline and insert checking. This works also for texts nested in blocks, just do a regen to update the block.

      (defun c:tt (/ A B)
      (if (setq A (nentsel “\nSelect TEXT to TRANSFER: “))
      (progn
      (setq A (cdr (assoc 1 (entget (car A)))))
      (while (setq B (car (nentsel “\nSelect TEXT item to be REPLACED: “)))
      (entmod
      (subst
      (cons 1 A)
      (assoc 1 (entget B))
      (entget B)
      ) ;_ end of subst
      ) ;_ end of entmod
      ) ;_ end of while
      ) ;_ end of progn
      ) ;_ end of if
      (princ)
      ) ;_ end of defun

    16. Admin says:

      @Ronald

      Thank you for that ronald.

    17. Ronald Maneja says:

      You’re welcome sir, :-)

    18. Orzabal says:

      clix is good in lisp! i know this guy :)

    Leave a Reply