LayersNameToClipboard

Short description

📋 LayersNameToClipboard is an AutoCAD AutoLISP clipboard utility that reads the Layer property from selected objects and copies unique cleaned layer names.
🧹 It includes a simple formatting-code stripping helper and is useful for preparing layer-name lists for documentation, filters, Excel, and CAD QA workflows.

Command:

🚀 Main command: LayersNameToClipboard
🧩 Load the LSP in AutoCAD or Civil 3D, then type the command at the command line.

Description:

📋 This AutoCAD command collects selected objects, converts them to VLA objects, and reads the Layer property where available.
🧹 The StripSimpleCodes helper removes backslash-based formatting codes from text before the layer name is stored.
🔎 Duplicate layer names are ignored so the final result contains each layer only once.
📄 The layer list is converted into newline-separated text, printed in the command line, and copied to the Windows clipboard.
⚙️ Clipboard output is created through the Windows htmlfile ActiveX clipboardData interface.

Helper function: (if any)​

🧩 StripSimpleCodes removes simple AutoCAD formatting fragments such as \A1;, \C256;, and \fArial; from a text string.
🧩 C:LayersNameToClipboard runs the selection, VLA property reading, unique-list creation, clipboard copy, and command-line output.

Functionalities:

✅ Read unique layer names from selected AutoCAD objects.
✅ Use VLA object property access instead of raw DXF entity data.
✅ Check whether the selected object exposes a Layer property.
✅ Remove duplicate names from the collected list.
✅ Copy the cleaned list to the clipboard as newline-separated text.
✅ Print the number of copied unique layer names for confirmation.

Result:

✅ Unique selected-object layer names are copied to the Windows clipboard.
✅ The output can be pasted into layer filters, Excel sheets, text reports, scripts, or project documentation.

Images, animations etc.

Pixel

XAML code:

<ResourceDictionary
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 xmlns:src="clr-namespace:Autodesk.Windows;assembly=AdWindows">
 
 <src:RibbonToolTip x:Key="LayersNameToClipboard">
 <src:RibbonToolTip.ExpandedContent>
 <StackPanel>
 <TextBlock Background="AntiqueWhite" TextAlignment="Left">
<Bold>Function Syntax:  LayersNameToClipboard</Bold>
<LineBreak/>
<Bold>Version: 1.1 Date: 20.06.2026 6:38:54PM</Bold>
<LineBreak/>
<Hyperlink>web</Hyperlink>
<LineBreak/>

<Bold>Command name</Bold><LineBreak/>
<Run>LayersNameToClipboard (type </Run><Run Foreground="DarkRed">LayersNameToClipboard</Run><Run> at the AutoCAD command line)</Run><LineBreak/>
<Bold>Description</Bold><LineBreak/>
<Run>This routine collects the </Run><Run Foreground="DarkRed">unique layer names</Run><Run> of the objects in a user selection set, strips simple MText-style formatting codes from the layer strings, and copies the resulting list to the </Run><Run Foreground="DarkRed">Windows clipboard</Run><Run> as plain text (one layer name per line).</Run><LineBreak/>
<Bold>Prerequisite</Bold><LineBreak/>
<Run>• Requires Visual LISP COM support via </Run><Run Foreground="DarkRed">(vl-load-com)</Run><Run>.</Run><LineBreak/>
<Bold>User interaction</Bold><LineBreak/>
<Run>• The user is prompted to create a selection set using </Run><Run Foreground="DarkRed">(ssget)</Run><Run>.</Run><LineBreak/>
<Run>• If the user cancels or selects nothing, the routine prints </Run><Run Foreground="DarkRed">Nothing selected</Run><Run>.</Run><LineBreak/>
<Bold>High-level workflow</Bold><LineBreak/>
<Run>• Builds a selection set using </Run><Run Foreground="DarkRed">ssget</Run><Run>.</Run><LineBreak/>
<Run>• Iterates through each entity in the selection set using </Run><Run Foreground="DarkRed">sslength</Run><Run> and </Run><Run Foreground="DarkRed">ssname</Run><Run>.</Run><LineBreak/>
<Run>• Converts each entity name to a VLA object using </Run><Run Foreground="DarkRed">vlax-ename->vla-object</Run><Run>.</Run><LineBreak/>
<Run>• Verifies the object exposes a Layer property using </Run><Run Foreground="DarkRed">vlax-property-available-p</Run><Run>.</Run><LineBreak/>
<Run>• Reads the layer name using </Run><Run Foreground="DarkRed">vla-get-layer</Run><Run> and cleans it via </Run><Run Foreground="DarkRed">StripSimpleCodes</Run><Run>.</Run><LineBreak/>
<Run>• Maintains a list of unique layer names by checking membership before adding.</Run><LineBreak/>
<Run>• Converts the unique list to a newline-separated string.</Run><LineBreak/>
<Run>• Copies the result to the Windows clipboard through an </Run><Run Foreground="DarkRed">htmlfile COM object</Run><Run> and ClipboardData SetData call.</Run><LineBreak/>
<Run>• Prints a summary showing the number of unique layers copied and echoes the copied content.</Run><LineBreak/>
<Bold>Functionalities</Bold><LineBreak/>
<Run>• Extracts layer names from a user selection set.</Run><LineBreak/>
<Run>• Ensures the output contains only </Run><Run Foreground="DarkRed">unique</Run><Run> layer names (no duplicates).</Run><LineBreak/>
<Run>• Removes simple formatting sequences embedded in the layer string using </Run><Run Foreground="DarkRed">StripSimpleCodes</Run><Run>.</Run><LineBreak/>
<Run>• Outputs the layer list as </Run><Run Foreground="DarkRed">plain text</Run><Run>, one entry per line.</Run><LineBreak/>
<Run>• Copies the final list directly to the </Run><Run Foreground="DarkRed">clipboard</Run><Run> for immediate paste into other applications.</Run><LineBreak/>
<Bold>Helper function behavior</Bold><LineBreak/>
<Run>• <Run Foreground="DarkRed">StripSimpleCodes</Run> removes sequences that start with a backslash and typically end at the next semicolon.</Run><LineBreak/>
<Run>• Intended to remove full formatting tokens such as \A1; \C256; \fArial; so only the readable layer name remains.</Run><LineBreak/>
<Bold>Important commands and calls highlighted</Bold><LineBreak/>
<Run>• <Run Foreground="DarkRed">(ssget)</Run> — prompts the user to select objects.</Run><LineBreak/>
<Run>• <Run Foreground="DarkRed">sslength</Run> and <Run Foreground="DarkRed">ssname</Run> — iterates through the selection set.</Run><LineBreak/>
<Run>• <Run Foreground="DarkRed">vlax-ename->vla-object</Run> — converts entity names to ActiveX objects.</Run><LineBreak/>
<Run>• <Run Foreground="DarkRed">vlax-property-available-p</Run> — verifies the Layer property exists on the object.</Run><LineBreak/>
<Run>• <Run Foreground="DarkRed">vla-get-layer</Run> — reads the layer name.</Run><LineBreak/>
<Run>• <Run Foreground="DarkRed">vlax-create-object "htmlfile"</Run> — creates a COM object to access ClipboardData.</Run><LineBreak/>
<Run>• <Run Foreground="DarkRed">ClipboardData SetData</Run> — writes the newline-separated text to the clipboard.</Run><LineBreak/>
<Bold>Outputs and messages</Bold><LineBreak/>
<Run>• If layers are found: prints </Run><Run Foreground="DarkRed">Copied N unique layer name(s) to clipboard</Run><Run> and lists the names.</Run><LineBreak/>
<Run>• If the selection contains no valid Layer properties or nothing usable: prints </Run><Run Foreground="DarkRed">No valid layers found</Run><Run>.</Run><LineBreak/>
<Run>• If nothing is selected: prints </Run><Run Foreground="DarkRed">Nothing selected</Run><Run>.</Run><LineBreak/>
<Bold>Operational notes and limitations</Bold><LineBreak/>
<Run>• Clipboard support relies on Windows COM interfaces; behavior may differ in non-Windows environments.</Run><LineBreak/>
<Run>• The uniqueness check is case-sensitive because it uses </Run><Run Foreground="DarkRed">member</Run><Run> on strings; layers that differ only by case may appear separately.</Run><LineBreak/>
<Run>• The formatting stripper removes backslash-initiated segments up to the next semicolon; unusual strings without semicolons are handled by removing a short portion after the backslash.</Run><LineBreak/>




<Bold><Run Foreground="DodgerBlue">Description</Run></Bold><LineBreak/>
<Run Foreground="White">📋 LayersNameToClipboard is an AutoCAD AutoLISP clipboard utility that reads the Layer property from selected objects and copies unique cleaned layer names.</Run><LineBreak/>
<Run Foreground="White">🧹 It includes a simple formatting-code stripping helper and is useful for preparing layer-name lists for documentation, filters, Excel, and CAD QA workflows.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">Function Syntax</Run></Bold><LineBreak/>
<Run Foreground="White">🚀 Main command: </Run><Bold><Run Foreground="Orange">LayersNameToClipboard</Run></Bold><LineBreak/>
<Run Foreground="White">📌 Load the LSP file with APPLOAD or from your AutoCAD startup suite, then run the command from the command line.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">SEO Optimized Overview</Run></Bold><LineBreak/>
<Run Foreground="White">📋 This AutoCAD command collects selected objects, converts them to VLA objects, and reads the Layer property where available.</Run><LineBreak/>
<Run Foreground="White">🧹 The StripSimpleCodes helper removes backslash-based formatting codes from text before the layer name is stored.</Run><LineBreak/>
<Run Foreground="White">🔎 Duplicate layer names are ignored so the final result contains each layer only once.</Run><LineBreak/>
<Run Foreground="White">📄 The layer list is converted into newline-separated text, printed in the command line, and copied to the Windows clipboard.</Run><LineBreak/>
<Run Foreground="White">⚙️ Clipboard output is created through the Windows htmlfile ActiveX clipboardData interface.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="LimeGreen">Primary Workflow</Run></Bold><LineBreak/>
<Run Foreground="White">1️⃣ Run LayersNameToClipboard.</Run><LineBreak/>
<Run Foreground="White">2️⃣ Select drawing objects.</Run><LineBreak/>
<Run Foreground="White">3️⃣ The routine reads the VLA Layer property for each object.</Run><LineBreak/>
<Run Foreground="White">4️⃣ Duplicate names are removed and a newline-separated list is generated.</Run><LineBreak/>
<Run Foreground="White">5️⃣ Paste the copied list into documentation, filters, scripts, or Excel.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="LimeGreen">Core Functionalities</Run></Bold><LineBreak/>
<Run Foreground="White">✅ Read unique layer names from selected AutoCAD objects.</Run><LineBreak/>
<Run Foreground="White">✅ Use VLA object property access instead of raw DXF entity data.</Run><LineBreak/>
<Run Foreground="White">✅ Check whether the selected object exposes a Layer property.</Run><LineBreak/>
<Run Foreground="White">✅ Remove duplicate names from the collected list.</Run><LineBreak/>
<Run Foreground="White">✅ Copy the cleaned list to the clipboard as newline-separated text.</Run><LineBreak/>
<Run Foreground="White">✅ Print the number of copied unique layer names for confirmation.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">Important Commands and Helper Functions</Run></Bold><LineBreak/>
<Run Foreground="White">🧩 StripSimpleCodes removes simple AutoCAD formatting fragments such as \A1;, \C256;, and \fArial; from a text string.</Run><LineBreak/>
<Run Foreground="White">🧩 C:LayersNameToClipboard runs the selection, VLA property reading, unique-list creation, clipboard copy, and command-line output.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="LimeGreen">Result</Run></Bold><LineBreak/>
<Run Foreground="White">✅ Unique selected-object layer names are copied to the Windows clipboard.</Run><LineBreak/>
<Run Foreground="White">✅ The output can be pasted into layer filters, Excel sheets, text reports, scripts, or project documentation.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DarkOrange">Operational Notes</Run></Bold><LineBreak/>
<Run Foreground="White">📌 This command operates on the current selection only.</Run><LineBreak/>
<Run Foreground="DarkRed">⚠️ Objects without a Layer property are skipped.</Run><LineBreak/>
<Run Foreground="DarkRed">⚠️ Clipboard output requires Visual LISP ActiveX and the Windows htmlfile clipboard object.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">Best Use Cases</Run></Bold><LineBreak/>
<Run Foreground="White">📋 VLA-based layer name extraction from selected objects.</Run><LineBreak/>
<Run Foreground="White">🧹 Clean copied layer lists for documentation and filters.</Run><LineBreak/>
<Run Foreground="White">📊 CAD QA and layer audit workflows.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="Yellow">Tags</Run></Bold><LineBreak/>
<Run Foreground="Yellow">🏷️ AutoCAD, 🏷️ AutoLISP, 🏷️ Civil 3D, 🏷️ Layer Names, 🏷️ Clipboard, 🏷️ VLA Object, 🏷️ Layer Reporting, 🏷️ CAD QA, 🏷️ Text Cleanup</Run><LineBreak/>



</TextBlock>
 
 <!-- Use MediaElement for GIF (static first frame) and Image as fallback -->



</StackPanel>
 </src:RibbonToolTip.ExpandedContent>
 </src:RibbonToolTip>
 
 </ResourceDictionary>

Additional info:

Share this page:

Leave a Reply

Page Tag: 🏷️ AutoLISP

  • LayersNameToClipboard

    Short description📋 LayersNameToClipboard is an AutoCAD AutoLISP clipboard utility that reads the Layer property from selected objects and copies unique cleaned layer names. 🧹 It includes a simple formatting-code stripping helper and is useful for preparing layer-name lists for documentation, filters, Excel, and CAD QA workflows. Command:🚀 Main command: LayersNameToClipboard 🧩 Load the LSP in…

  • Import_Layer_Filter

    Short description📥 Import_Layer_Filter is an AutoCAD AutoLISP layer filter transfer tool for exporting and importing property layer filters through .lft, DWG, and DWT sources. 🗂️ It adds predefined project-folder management, multi-filter export and import, and xref-style prefix/suffix handling for NAME== filter patterns. Command:🚀 Export command: ExpFltr 📥 Import command: ImpFltr 🗂️ Folder manager command: LfPredefinedFolders…

  • FreezeLayersInMS

    Short description❄️ FreezeLayersInMS is an AutoCAD and Civil 3D DCL layer manager for filtering current and xref layers, then freezing, thawing, locking, plotting, or switching them on and off. 🔍 It displays matching layer status in a fixed-width table and hides xref prefixes for readability while preserving the true layer names for operations. Command:🚀 Main…

  • Export_Layer_Filter

    Short description📤 Export_Layer_Filter is an AutoCAD AutoLISP tool for exporting layer property filters to reusable .lft files. 🗂️ It adds a DCL interface for multi-filter selection, xref prefix handling, predefined project folders, and folder management. Command:🚀 Export command: ExpFltr 📥 Import command included: ImpFltr 🧪 Debug command: ExpFltrDebug 🗂️ The DCL workflow supports Select All,…

  • DuplicateToSelectedLayer

    Short description📋 DuplicateToSelectedLayer is an AutoCAD and Civil 3D AutoLISP utility for copying selected entities to a chosen existing local layer. 🧩 It uses a temporary DCL layer picker, ignores xref-prefixed layers, remembers the last selected target layer, and brings the copied objects to the front. Command:🚀 Main command: DuplicateToSelectedLayer 📋 Select entities first inside…

  • DuplicateToNewLayer

    Short description🧩 DuplicateToNewLayer and CloseParallelPolylines is an AutoCAD and Civil 3D DCL offset utility for creating left and right offsets from selected LINE LWPOLYLINE POLYLINE SPLINE and ARC geometry. 🎛️ The interface combines offset profiles independent left and right distances target layer controls optional source deletion parallel closing optional centerline generation Apply Undo OK and…

  • DeleteLayerByFilter

    Short description🧹 DeleteLayerByFilter is an AutoCAD and Civil 3D AutoLISP utility for finding, exporting, and deleting layers by multiple wildcard filter patterns. 🛡️ The tool uses a DCL dialog with protected layer patterns, confirmation prompts, preset filters, inverse matching, and export options so CAD users can clean drawings more safely and systematically. Command:🚀 Main command:…

  • Color2Llayers

    Short description🎨 Color2Llayers is an AutoCAD AutoLISP Extended Layer Color Changer with a DCL list, wildcard filter, multi-select, pick color, apply, undo, clipboard export, and dialog position memory. 🧰 It edits layer color values directly and uses a reopen-after-Apply pattern so AutoCAD can regenerate and show color changes immediately. Command:🚀 Main color changer command: XCC…

  • ChangeLayerToCurrent

    Short description🗂️ ChangeLayerToCurrent is an AutoCAD AutoLISP layer reassignment tool with a dynamic DCL layer selector, filtering, pick-from-object support, and clipboard helper. 🎯 It changes multiple selected objects to a chosen layer and optionally preserves original displayed linetype, linetype scale, and lineweight/width. Command:🚀 Layer change command: ChangeLayerToCurrent – opens a searchable layer selector and moves…

  • All_Color2Layers

    Short description🎨 All_Color2Layers is an AutoCAD AutoLISP ByLayer cleanup utility for resetting entity color and/or linetype overrides to BYLAYER. 🧰 It adds a DCL interface with operation options, scope controls, layout filtering, layer selection, settings memory, and undo support. Command:🚀 Main dialog command: BYLAYERDLG – opens the ByLayer Tool DCL interface 🚀 Alias command: BYLAYER…