LAYWRAP adds or removes a prefix and/or suffix on layer names, in bulk. The usual reason is a merge: you are bringing another consultant’s drawing into yours and their layer names would collide with your own, so every incoming layer gets stamped with an identifying prefix.
What LayerWrap does
LAYWRAP adds the prefix and suffix; LAYUNWRAP removes them again, for when the merge has to be unpicked.
Layers are chosen by selecting objects rather than by picking from a list. That sounds indirect, but it is the practical way to work: you window the drawing you have just pasted in, and exactly the layers it uses get renamed — without having to identify them by name first, which on an unfamiliar drawing is the hard part.
How to use it
- Load the routine with
APPLOAD, or put it on your support file search path. - Type
LAYWRAP. - Select objects on the layers you want renamed — windowing the pasted-in drawing is usually enough.
- Give the prefix and/or suffix.
- Use
LAYUNWRAPwith the same strings to reverse it.
How it works
Renaming a layer changes the layer table, not the objects on it. So every object on that layer follows the rename automatically, including objects that were not part of your selection.
That is the important behaviour to understand before using it. Selecting one line on a layer renames the layer for everything on it, everywhere in the drawing. It is what makes the select-objects approach workable — you do not have to catch every object, only one per layer.
Notes and limits
- Selecting one object renames its whole layer. The selection identifies layers, not objects to move.
- LAYUNWRAP needs the same strings you wrapped with, to strip them back off.
- Watch for name collisions. Wrapping is what prevents them; unwrapping can reintroduce them if two consultants used the same underlying names.
- One undo group covers the whole rename.
Download and details
| Name | LayerWrap — add or remove a prefix and suffix on layer names, in bulk |
| Download | LayerWrap.lsp — 10.1 KB, plain AutoLISP source. Downloads directly; no zip to unpack. |
| Type | AutoCAD AutoLISP routine |
| Commands | LAYUNWRAP, LAYWRAP |
| Requires | nothing beyond a CAD platform with AutoLISP. |
| Source size | 10.1 KB, 265 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
- LAYERHARVEST LISP — see what layers a drawing brings with it before merging
- LAYERSPLIT LISP — split a merged drawing back out by layer
- AIA and NCS layer format — the naming standard a prefix is protecting
- More free AutoLISP routines on this site
- Wisey’s Steel Shapes — free structural steel section drawing program