• 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

SL LISP: Set the Current AutoCAD Layer by Picking an Object

September 19, 2020

Last updated July 28, 2026

Click an object, and its layer becomes the current layer. That is the whole routine, and it is one of the most-used operations in drafting — you are about to draw something that belongs with that, so make that layer current.

It is by Art Whitton, finished on 21 November 1996 and revised six days later.

It is coursework, and the header says so

The file’s header records where it was written: a lab directory path, and a room number at BCIT — the British Columbia Institute of Technology. The original filename was the author’s own surname, which is what you call a file when you are handing it in.

That makes it the third piece of student work in this library, alongside two from Billings Vo-Tech in Montana. It is also worth noting who the student was: Art Whitton also wrote the polyline chainage routine and the text matching routine here, both of which are among the best-documented files on this site — full variable tables, a comment on nearly every line, proper error handling.

You can see the habit forming in this one. It is a dozen lines doing something trivial, and it still carries a header block with a description, a finish date and a revision history.

The command is SL

Not SSL, which is what the download is called. Two letters, and two letters that are heavily contested — the TOOLS collection on this site also defines SL, doing something else entirely.

Check it against your own aliases before loading, and if you keep it, consider giving it a name of your own choosing.

Compared with the alternatives here

Three routines on this site do this job, and they are not identical.

  • This one — pick an object, done. The simplest of the three and the easiest to read if you are learning.
  • LayerMatch — accepts a typed layer name as well as a pick, and reads the layer of objects inside blocks and xrefs rather than the container’s layer.
  • LS — will create the layer for you if the name you give does not exist.

If you only ever pick, this is enough. If you work with blocks a lot, LayerMatch handles the nested case better.

How to load it

Unzip SSL.zip and load SSL.lsp with APPLOAD, or put it in the Startup Suite — a command this small only saves time if it is always available. No support files. Our AutoLISP guide covers loading.

Step-by-step usage

  1. Type SL.
  2. Click any object on the layer you want to work on.
  3. That layer is now current. Draw.

Because it reads the picked object’s own layer, clicking a block gives you the block’s layer rather than the layer of whatever you can see inside it. That is usually what you want; when it is not, use LayerMatch.

Compatibility notes

1996, so written-for rather than tested-on, though there is almost nothing in it that could age — it reads one property off an object and sets one system variable.

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 changes a setting rather than any geometry, so there is nothing at risk in trying it.

Download

Name: Set Layer By Selection
Description: This program will reset the current layer to the layer of a user picked entity.
Type: AutoCAD AutoLISP Routine
Author: Art Whitton
File Size: 1 Kb
Cost: Free
Worked on: AutoCAD
Download File: SSL.zip

Related routines

  • LayerMatch — the same job, reading inside blocks and xrefs.
  • PDIST — the same author’s chainage routine, and a model of documentation.
  • CHGTEXT — his text height and style matcher.

References

  • AutoLISP: the complete guide
  • Free LISP routines library
  • AutoLISP Lesson 1: Introduction
  • 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