TEXTSPLIT splits a text object in two and puts the second half where you point. For a note that has run too long for its box, a title that needs to wrap, or a line of imported text that came in as one string when it should have been three.
What TextSplit does
Three ways to say where to cut:
After after a word you name - the usual way
Position after a character count
Half at the nearest space to the middle
The second piece keeps the height, style, rotation, width factor, layer and colour of the original, so the two halves match.
How to use it
- Load the routine with
APPLOAD, or put it on your support file search path. - Type
TEXTSPLIT. - Pick the text.
- Choose After, Position or Half.
- Pick where the second half goes.
How it works
DXF group codes are integers. The original read the text out of the object with (assoc (quote 1.0) entdata), and likewise 40.0 and 50.0 for the height and rotation — group codes written as reals.
assoc compares with equal, under which 1 and 1.0 are not the same thing. Every one of those lookups returned nil, so the text came back as nil and the first (strlen nil) stopped it. The routine could not run at all.
The search for the split word is bounded. Looking for a word that is not in the string, an unbounded loop walks off the end, where substr returns an empty string forever — which never matches — so it hangs until Escape.
Every property is copied to the second half, not just the string, so the two pieces are indistinguishable from text that was always two lines.
Notes and limits
- TEXT objects. MTEXT wraps on its own.
- The second half keeps every property of the first.
- A word that is not there is reported, not hunted for forever.
- One undo group covers the split.
Download and details
| Name | TextSplit — break a line of text in two |
| Download | TextSplit.lsp — 7.6 KB, plain AutoLISP source. Downloads directly; no zip to unpack. |
| Type | AutoCAD AutoLISP routine |
| Command | TEXTSPLIT |
| Requires | nothing beyond a CAD platform with AutoLISP. |
| Source size | 7.6 KB, 193 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
- RESPACE LISP — evening up the lines once you have split them
- WORDSWAP LISP — find and replace across text objects
- TEXTCLONE LISP — copying text with its formatting intact
- More free AutoLISP routines on this site
- Wisey’s Steel Shapes — free structural steel section drawing program