• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
blog.draftsperson.net

blog.draftsperson.net

the art of technical drawing

blog.draftsperson.net

LAYWRAP LISP: Add or Remove a Prefix on Layer Names

August 3, 2026

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

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Type LAYWRAP.
  3. Select objects on the layers you want renamed — windowing the pasted-in drawing is usually enough.
  4. Give the prefix and/or suffix.
  5. Use LAYUNWRAP with 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

NameLayerWrap — add or remove a prefix and suffix on layer names, in bulk
DownloadLayerWrap.lsp — 10.1 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandsLAYUNWRAP, LAYWRAP
Requiresnothing beyond a CAD platform with AutoLISP.
Source size10.1 KB, 265 lines
Error handlingYes — a *error* handler restores every system variable it changed, on cancel as well as on error.
UndoThe whole operation is wrapped in a single undo group, so one U reverses all of it.
CompatibilityAutoCAD (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.
AuthorYZ, August 2026
LicenceFree 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

Filed Under: AutoLISP Routines

Primary Sidebar

Subscribe to our Youtube Channel

Post CAD drafting jobs on Freelancer.com. and get some free money to do this.

Categories

  • American Steel Industry (4)
  • AutoCAD Articles & Reference (30)
  • AutoCAD Bugs & Problems (19)
  • AutoCAD Tips (29)
  • AutoCAD Tutorials (54)
  • AutoLISP Routines (328)
  • AutoLISP Tutorials (15)
  • CAD Standards (7)
  • Civil 3D (7)
  • Civil Drafting (4)
  • Dimensions (2)
  • Drafting Funnies (71)
  • Drafting History (9)
  • Drafting Standards (84)
  • Electrical Drafting (2)
  • General IT reference (7)
  • Geometry (15)
  • GIS (2)
  • Hatch Patterns (12)
  • Office Life Hacks (3)
  • PT (1)
  • Revit Tutorials (54)
  • Steel Detailing (14)
  • Structural Drafting (26)
  • Technical Dictionary (61)
  • Useful Website Links (19)

Footer

Free downloads

  • Free AutoLISP routines
  • Free hatch patterns
  • SHX fonts & text styles
  • Numbering LISP collection
  • ISO 3098B font

Reference charts

  • AWS weld symbols chart
  • Steel detailing chart
  • Hole & slot sizes
  • Bolt edge distance
  • ANSI & ARCH paper sizes
  • How to fold an A1 drawing

Useful links

  • CAD blocks (DWG)
  • Revit families
  • structuraldrafter.com
  • cad-corner.com
  • About
  • Privacy policy

Provided for free with no warranty · Log in