Draw a rectangle, circle, slot or rounded rectangle around a piece of text, and it stays around that text. Edit the wording and the shell resizes. Change the height, style or justification and it resizes. Move, rotate or copy the text and the shell follows.
What TextShell does
This is the difference between a shell and a box you drew yourself. A drawn box is right once. A shell is right permanently — which matters on revision clouds, room tags, detail markers and any label that gets edited twice a week for six months.
Four shapes: rectangle, a plain box offset evenly around the text; filleted, with rounded corners; slot, with fully rounded left and right ends; and circle, through the box corners, for balloon-style tags.
The offset factor is a multiple of the text height, not a fixed distance, so a shell around 2.5 mm text and one around 100 mm text look the same. Change the text height and the gap scales with it.
How to use it
- Load the routine from
acaddoc.lspif you want shells live in every drawing — see the note below. - Type
TEXTSHELL. - Pick the text and choose the shape and offset factor.
- Edit the text freely. The shell keeps up.
- Type
UNSHELLto break the link, leaving both objects as ordinary geometry.
How it works
Two pieces of machinery hold the pairing together.
Extended entity data. Both the text and its shell carry a small block of xdata under a private application name, each recording the handle of its partner plus the shape and offset factor. Handles are used rather than entity names because a handle is permanent — it survives saving, closing and reopening the drawing, where an entity name does not. That is what allows shells to keep working after the file has been round-tripped.
Object reactors. One watches every shelled text, another watches every shell. When either is modified, the callback reads the xdata, finds the partner by handle, and rebuilds the shell around the text’s current extents.
Why there is a command reactor dance. A modification reactor is forbidden from modifying the drawing while it is running — AutoCAD is mid-edit and the database is not safe to touch. So when a shell is dragged, the callback cannot immediately rebuild it. Instead it remembers which object needs attention and creates a temporary command reactor, which fires the moment the command finishes and the database is stable. That temporary reactor removes itself straight away, so they never accumulate.
The same trick handles copying. A copied shelled text inherits xdata pointing at the original shell, which would be wrong. The copy callback queues the new object and, once the command ends, builds it a shell of its own and repoints the xdata. Copying a shell on its own instead deletes the copy, since a shell with no text is meaningless.
Notes and limits
- Reactors do not survive between drawings. The file re-establishes them from the xdata every time it is loaded, so load it from
acaddoc.lspif you want shells live everywhere. - Until it is loaded the shells are ordinary geometry. Nothing is lost; they just stop updating.
- UNSHELL breaks the link and leaves both objects in place.
- The offset is proportional, so one setting suits every text size.
Download and details
| Name | TextShell — a box around text that resizes when the text changes |
| Download | TextShell.lsp — 48.7 KB, plain AutoLISP source. Downloads directly; no zip to unpack. |
| Type | AutoCAD AutoLISP routine |
| Commands | TEXTSHELL, UNSHELL |
| Requires | the ActiveX layer (loaded automatically by the routine with vl-load-com). |
| Source size | 48.7 KB, 1,191 lines |
| Error handling | Yes — a *error* handler restores every system variable it changed, on cancel as well as on error. |
| Undo | The whole operation is wrapped in a single undo group, so one U reverses all of it. |
| Compatibility | AutoCAD (any release with AutoLISP), BricsCAD, ZWCAD, GstarCAD, ProgeCAD and other IntelliCAD-based platforms. AutoCAD LT needs a LISP enabler. No .NET, no ObjectARX, no installer. |
| Author | YZ, August 2026 |
| Licence | Free to use, supplied “as is” with no warranty. |
References
- TEXTFRAME LISP — a static box, when a live one is more than you need
- NUMSTAMP LISP — numbered labels with borders drawn to fit
- STARTUPBUILD LISP — getting this loaded in every drawing automatically
- More free AutoLISP routines on this site
- Wisey’s Steel Shapes — free structural steel section drawing program