• 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

LS LISP: Set an AutoCAD Layer, or Create It on the Fly

September 19, 2020

Last updated July 28, 2026

This sets the current layer, and if the layer you name does not exist it offers to make it for you — asking for a colour and linetype as it goes. That second half is what lifts it above a plain layer-setting shortcut: you can name a layer you have not created yet and keep drawing, instead of stopping to open the layer manager.

It is by Craig Carr of Superior Designs, written in 1994, and the header notes it was a winner in Cadalyst. He is also the author of CHT and the ADD calculator on this site.

Two ways in, three ways out

The opening prompt does double duty. Type a layer name and it goes straight for that layer; press Enter instead and it switches to asking you to pick an object, then reads the layer off whatever you clicked. Miss, and it says so and asks again rather than dropping out.

What happens next depends on whether the layer exists.

  • It exists — it becomes current. Done.
  • It does not exist, and you choose Create — you are asked for a colour, defaulting to white, and a linetype, defaulting to continuous. The layer is made with those properties and set current.
  • It does not exist, and you choose Search — it lists the drawing’s layers on screen so you can find the one you actually meant, then asks you to type its name.

The Search branch is the thoughtful bit. A layer name that does not exist is usually a typo rather than a new layer, and being shown the real list at that moment is more useful than being told you were wrong.

The command is LS

Not LLS, which is what the file and the download are called. Two letters, and a fairly obvious two letters at that, so check it against your own aliases before loading — LS is exactly the sort of shortcut people assign themselves.

One code note for anyone reading the file: the error handler is written in a way that would itself fail if it ever ran, because it is defined to take no message but then tries to use one. In normal use it never fires. If you cancel out of the routine partway through you may find command echo left switched off, in which case set CMDECHO back to 1.

How to load it

Unzip LLS.zip and load LLS.lsp with APPLOAD, or put it in the Startup Suite — a layer shortcut is only a shortcut if it is always available. No support files. Our AutoLISP guide covers loading.

Step-by-step usage

  1. Type LS.
  2. Either type the layer name, or press Enter and click an object on the layer you want.
  3. If the layer does not exist you are told so, and asked whether to Create or Search.
  4. Choosing Create asks for colour and linetype — press Enter at either to accept white and continuous.
  5. The layer becomes current.

Compatibility notes

1994, so written-for rather than tested-on. It drives the command-line form of the LAYER command with a fixed sequence of responses, which is the part most likely to age badly — if any of those prompts have shifted in your release, the answers land in the wrong places. Test the Create branch on a scratch drawing before relying on it.

Plain AutoLISP with no dialog boxes and no Express Tools calls, so nothing requires the full product; LT users on LT 2024 or later, the release that brought AutoLISP to LT, should be able to run it. See what runs on AutoCAD LT. It creates layers but does not touch geometry.

Download

Name: Layer Set
Description: Lisp routine for setting layers.
Type: AutoCAD AutoLISP Routine
Author: Craig Carr
File Size: 1 Kb
Cost: Free
Worked on: AutoCAD
Download File: LLS.zip

Related routines

  • LayerMatch — the same job by picking only, and it reads inside blocks.
  • Delete Layer — the other end of layer housekeeping.
  • CHT — the same author’s text standardiser.

References

  • AutoLISP: the complete guide
  • Free LISP routines library
  • AutoLISP on AutoCAD LT

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