Kent Cooper used Cadalyst CAD Tip No. 4212, “Add Text to Piping Drawings” by Theresa Lowe, as inspiration for this routine. Kent’s tip allows you to insert a text string “into” an entity; the entity is broken and the text string is placed into the break. The gap in the entity is sized to accommodate the text string, taking into account the text properties that can change the size of the gap needed. (If you would like to use a wipeout to mask the entity instead of breaking it, see Kent’s alternate routine, “Label Entity with Mask.”)
After you load the LISP file, run the command LTT, then enter the string that you want to add. At this point you can select the drawing entity, but you have the option to change the text style, height, width, and layer before selecting the entity. Subsequent executions of the command in the same drawing will default to the last used text string. Note that entities on locked layers cannot be broken; neither can certain entity types such as text, mtext, or regions.