eplisp

FlattenLayer (FLATLAY)

eplisp, the free multilingual LISP library

FlattenLayer (FLATLAY)
Openly licensed; the original file is hosted here together with its license.
…
Rate this tool:
CommandsFLATLAY
CategoryLayer Tools
Authorzenius (zxzenius)
Sourcezxzenius/pnid_autolisps
LicenseMIT
Version1.0
RequirementsAutoCAD (full version, not LT). Uses ActiveX (vla/vlax), so it should also run in Visual LISP-compatible programs such as BricsCAD.
Prompt languageEnglish
FilesFlattenLayer.lsp (5 KB)
Added2026-10-26
Download the original fileSource repository

Moves selected objects to one layer and keeps their look by first writing ByLayer color, linetype, lineweight and transparency onto each object.

FLATLAY is a layer-flattening tool from zenius's P&ID routines. Before sending a drawing to someone who does not want its layer structure, or when preparing a single-layer background, it stops colors and linetypes from changing when the objects are moved.

Overview

For each object the source layer's properties are read. Objects with ByLayer color get the layer's color (true color included), ByLayer linetype gets the layer's linetype, ByLayer lineweight gets the layer's lineweight and ByLayer transparency gets the layer's transparency, all as explicit values. The object is then moved to the target layer.

You are asked for the target layer name; pressing Enter uses layer 0. If the typed layer does not exist, it is created with color 7 (white/black). The work is wrapped in a single undo group, and objects that cannot be moved are reported with the reason.

How to use it

  1. Load FlattenLayer.lsp with APPLOAD.
  2. Type FLATLAY at the command line.
  3. Select the objects to move.
  4. Type the target layer name, or press Enter for layer 0.

Notes and limitations

  • Changes the layer and properties of objects; use U to undo.
  • Objects inside block definitions are not touched; block contents drawn ByLayer or ByBlock may look different on the target layer.
  • Objects on locked layers are skipped and reported.
  • Creates the target layer if it is missing.
  • It redefines *error* without localizing it in the command, which can affect the error handler of other loaded routines.

Source and license

This tool is not made by eplisp. The file is published unchanged under its author's license; copyright stays with the author.

References

  1. Source repository: zxzenius/pnid_autolisps – https://github.com/zxzenius/pnid_autolisps/tree/c4f757e52373a96320d4ed76b3ab20d954d6080e/FlattenLayer
  2. Author: zenius (zxzenius) – https://github.com/zxzenius
  3. License: MIT – https://github.com/zxzenius/pnid_autolisps/blob/c4f757e52373a96320d4ed76b3ab20d954d6080e/LICENSE

Found a mistake, or are you the author of this tool? Request a correction or removal