Replacing Text in AutoCAD: How to find & replace a text with another text in AutoCAD using a Lisp

How to find & replace a text with another text in AutoCAD?

If you use AutoCAD, you understand the significance of having precise and consistent text in your drawings. Text can communicate information, instructions, dimensions, labels, notes, and more. However, there may be times when you need to substitute one text with another in your drawing, for different reasons. For instance, you may want to rectify a spelling mistake, update a specification, or modify a name.

Introduction to AutoCAD.

But how can you do this task easily and quickly? AutoCAD does have a built-in command to replace text, which is FIND. However, this command has some limitations and drawbacks. For instance, it can only replace text within a single object, such as a text or a Mtext. It cannot replace text within a block or an attribute. It also cannot replace text that has special characters, such as, *, or ^. It also requires you to enter the exact text that you want to replace, which can be tedious and error-prone.

But what if I told you there is a way to replace text with another text in your drawing in just one click? Yes, you heard me right. One-click. And you don’t need any special software or plugins to do it. All you need is a simple AutoCAD LISP routine that you can load and run in your AutoCAD session.

First LISP: After you have uploaded the LISP file, you need to type 'TC' to activate it.

Specify the mode (multiple or pairwise).

Select the text to copy it.

Then select the text to paste it.

You can download the lisp from here.

Second LISP: After you have uploaded the LISP file, you need to type 'SUBSTR' to activate it.

Pick the text.

Then enter the number of text.

Pick the text to be replaced.

That’s it. You have successfully replaced the text with another text in your drawing in one click using a LISP routine. You can use this LISP routine as many times as you want, on any drawing that you want. You can also customize the LISP routine to suit your needs, such as changing the case or the style of the text.

You can download the LISP from here.

Conclusion:

In this blog post, I demonstrated to you how to use a LISP routine that can replace text with another text in your drawing in one click. I hope you found this blog post useful and interesting. If you want to learn more about AutoCAD LISP routines, you can check out my blog, where he has hundreds of LISP routines for various AutoCAD tasks, tips and tricks on AutoCAD programming and development.

Comments