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 selected objects to the chosen layer
Description:
ποΈ ChangeLayerToCurrent is an SEO-friendly AutoCAD layer management tool for changing selected objects to a selected drawing layer.
π The command builds a temporary DCL dialog, lists all layers, supports a filter text box, and remembers the last selected layer and filter using environment variables.
π― A Pick Layer workflow lets the user select an existing object and reuse its layer as the target layer.
π A Copy Layer Name helper sends the chosen layer name to the Windows clipboard through PowerShell/clip logic.
π§ The optional Keep original properties mode captures effective linetype, linetype scale, and lineweight/width before moving objects, then reapplies those values after the layer change.
Helper function: (if any)β
π§© ChangeLayerToCurrent:AddOrReplaceDxf updates entity DXF data safely for specific group codes.
π§© ChangeLayerToCurrent:LayerLinetype resolves BYLAYER linetype from the source layer.
π§© ChangeLayerToCurrent:LayerLineweight resolves BYLAYER lineweight from the source layer.
π§© ChangeLayerToCurrent:GetOriginalProps captures effective visual properties before the move.
π§© ChangeLayerToCurrent:ApplyOriginalProps reapplies captured linetype, linetype scale, and lineweight/width.
π§© ChangeLayerToCurrent:CopySelectedLayerName writes the target layer name to the clipboard.
π§© get-all-layers and update-layer-list populate and refresh the DCL layer selector.
Functionalities:
β
Display all drawing layers in a DCL popup/list interface.
β
Filter layer names with typed search text.
β
Remember the last used layer and last filter between command runs.
β
Pick an existing object to use its layer as the destination layer.
β
Copy the selected layer name to the clipboard.
β
Select multiple objects after confirming the target layer.
β
Move selected objects to the chosen layer using CHPROP.
β
Optionally preserve original displayed linetype, linetype scale, and lineweight/width after the layer change.
Result:
π― The result is faster and safer layer reassignment with fewer manual Layer dropdown actions.
π The optional property-preservation mode keeps object appearance stable while still moving geometry to the selected layer.
Images, animations etc.



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="ChangeLayerToSelected">
<src:RibbonToolTip.ExpandedContent>
<StackPanel>
<TextBlock Background="AntiqueWhite" TextAlignment="Left">
<Bold>Function Syntax: ChangeLayerToCurrent / ChangeLayerToCurrent_Xref</Bold>
<LineBreak/>
<Bold>Version: 1 Date: 28.10.2025</Bold>
<LineBreak/>
<Bold>Version: 2 Date: 30.06.2026 10:07:57AM</Bold>
<LineBreak/>
<Hyperlink>N/A</Hyperlink>
<LineBreak/>
<Bold>Command name</Bold><LineBreak/>
<Run>ChangeLayerToCurrent (type </Run><Run Foreground="DarkRed">ChangeLayerToCurrent</Run><Run> at the AutoCAD command line)</Run><LineBreak/>
<Bold>Description</Bold><LineBreak/>
<Run>This routine lets the user choose a target layer using a </Run><Run Foreground="DarkRed">filtered dialog</Run><Run> or by </Run><Run Foreground="DarkRed">picking an object in the drawing</Run><Run> to capture its layer, and then moves a user-selected set of objects to that chosen layer using CHPROP.</Run><LineBreak/>
<Bold>User interaction</Bold><LineBreak/>
<Run>β’ The routine opens a dialog titled </Run><Run Foreground="DarkRed">Select Layer (Filtered)</Run><Run>.</Run><LineBreak/>
<Run>β’ The dialog provides:</Run><LineBreak/>
<Run> β’ Edit box: </Run><Run Foreground="DarkRed">Filter by Name</Run><Run> (live filters layer list).</Run><LineBreak/>
<Run> β’ Dropdown: </Run><Run Foreground="DarkRed">Matching Layers</Run><Run> (choose target layer).</Run><LineBreak/>
<Run> β’ Button: </Run><Run Foreground="DarkRed">Pick Layer From Drawing</Run><Run> (select an entity to use its layer).</Run><LineBreak/>
<Run> β’ OK and Cancel buttons.</Run><LineBreak/>
<Run>β’ After a layer is confirmed, the user is prompted to </Run><Run Foreground="DarkRed">select objects</Run><Run> to move, with multi-selection enabled.</Run><LineBreak/>
<Bold>High-level workflow</Bold><LineBreak/>
<Run>β’ Loads the last used target layer from </Run><Run Foreground="DarkRed">ChangeLayer_LastLayer</Run><Run>.</Run><LineBreak/>
<Run>β’ Loads the last used filter text from </Run><Run Foreground="DarkRed">ChangeLayer_LastFilter</Run><Run>.</Run><LineBreak/>
<Run>β’ Builds a list of all non-xref layers in the drawing by iterating the Layers collection and excluding names matching </Run><Run Foreground="DarkRed">*|*</Run><Run>.</Run><LineBreak/>
<Run>β’ Writes a temporary DCL file and enters a dialog loop.</Run><LineBreak/>
<Run>β’ In the dialog, it maintains a live list of matching layers based on the current filter string.</Run><LineBreak/>
<Run>β’ Supports an alternate selection path where the user clicks Pick Layer From Drawing and then selects an entity to capture its layer.</Run><LineBreak/>
<Run>β’ Persists the chosen layer and the current filter back to environment variables for next time.</Run><LineBreak/>
<Run>β’ After the dialog completes with OK, it prompts for object selection and moves those objects to the chosen layer using CHPROP.</Run><LineBreak/>
<Bold>Functionalities</Bold><LineBreak/>
<Run>β’ Displays a layer-selection dialog with a live name filter.</Run><LineBreak/>
<Run>β’ Excludes xref layers from the selectable list by pattern </Run><Run Foreground="DarkRed">*|*</Run><Run>.</Run><LineBreak/>
<Run>β’ Remembers the </Run><Run Foreground="DarkRed">last filter</Run><Run> and </Run><Run Foreground="DarkRed">last selected layer</Run><Run> across runs using getenv and setenv.</Run><LineBreak/>
<Run>β’ Allows choosing a target layer by:</Run><LineBreak/>
<Run> β’ Selecting it from the filtered dropdown list.</Run><LineBreak/>
<Run> β’ Picking an object in the drawing and using that object layer.</Run><LineBreak/>
<Run>β’ Moves selected entities to the chosen layer using CHPROP with the LA option.</Run><LineBreak/>
<Run>β’ Supports multi-selection of entities to move (window, crossing, shift-add and remove, etc.).</Run><LineBreak/>
<Bold>Dialog logic details</Bold><LineBreak/>
<Run>β’ The dialog is rebuilt in a loop to allow the Pick Layer From Drawing workflow without losing state.</Run><LineBreak/>
<Run>β’ The layer list is filtered using wildcard matching:</Run><LineBreak/>
<Run> β’ It compares names using </Run><Run Foreground="DarkRed">strcase</Run><Run> and </Run><Run Foreground="DarkRed">wcmatch</Run><Run> against pattern *filter*.</Run><LineBreak/>
<Run>β’ Default dropdown selection priority:</Run><LineBreak/>
<Run> β’ Picked layer, if set and present in the filtered list.</Run><LineBreak/>
<Run> β’ Last used layer, if present in the filtered list.</Run><LineBreak/>
<Run> β’ Otherwise the first entry in the filtered list.</Run><LineBreak/>
<Bold>Important commands and calls highlighted</Bold><LineBreak/>
<Run>β’ <Run Foreground="DarkRed">getenv</Run> and <Run Foreground="DarkRed">setenv</Run> β stores and recalls the last layer and filter text.</Run><LineBreak/>
<Run>β’ <Run Foreground="DarkRed">vlax-for</Run> with Layers β enumerates all layer names from the drawing.</Run><LineBreak/>
<Run>β’ <Run Foreground="DarkRed">wcmatch "*|*"</Run> β filters out xref layers.</Run><LineBreak/>
<Run>β’ <Run Foreground="DarkRed">load_dialog</Run>, <Run Foreground="DarkRed">new_dialog</Run>, <Run Foreground="DarkRed">start_dialog</Run> β runs the temporary DCL dialog.</Run><LineBreak/>
<Run>β’ <Run Foreground="DarkRed">action_tile</Run> β implements live filtering and captures user decisions.</Run><LineBreak/>
<Run>β’ <Run Foreground="DarkRed">entsel</Run> and <Run Foreground="DarkRed">assoc 8</Run> β reads the layer of a picked entity.</Run><LineBreak/>
<Run>β’ <Run Foreground="DarkRed">ssget</Run> β selects the objects that will be moved to the chosen layer.</Run><LineBreak/>
<Run>β’ <Run Foreground="DarkRed">CHPROP</Run> with LA β moves the selected objects to the chosen layer.</Run><LineBreak/>
<Bold>Outputs and messages</Bold><LineBreak/>
<Run>β’ If the dialog fails to load: prints </Run><Run Foreground="DarkRed">Unable to load dialog</Run><Run>.</Run><LineBreak/>
<Run>β’ If the user cancels: prints </Run><Run Foreground="DarkRed">Operation cancelled</Run><Run>.</Run><LineBreak/>
<Run>β’ If the user picks an object but its layer is not in the non-xref list: prints </Run><Run Foreground="DarkRed">Picked layer not found in list</Run><Run>.</Run><LineBreak/>
<Run>β’ If no objects are selected for the final move: prints </Run><Run Foreground="DarkRed">No objects selected</Run><Run>.</Run><LineBreak/>
<Run>β’ On success: prints that the entities were moved to the selected layer and echoes the layer name.</Run><LineBreak/>
<Bold>Operational notes and limitations</Bold><LineBreak/>
<Run>β’ Filtering is case-insensitive due to the use of </Run><Run Foreground="DarkRed">strcase</Run><Run> on both the layer name and filter pattern.</Run><LineBreak/>
<Run>β’ Xref filtering is based solely on the presence of a pipe character in the name; any non-xref layer containing a pipe will be excluded.</Run><LineBreak/>
<Run>β’ The routine uses AutoCAD commands for property changes; command localization or command overrides could affect behavior in some environments.</Run><LineBreak/>
<Run>β’ The dialog is written to a temporary file and deleted afterward; if the temp folder is not writable, the dialog cannot be created.</Run><LineBreak/>
<Bold><Run Foreground="DodgerBlue">Description</Run></Bold><LineBreak/><Run Foreground="White">ποΈ ChangeLayerToCurrent is an AutoCAD AutoLISP utility for moving selected objects to a chosen layer through a searchable DCL dialog.</Run><LineBreak/><Run Foreground="LimeGreen">π― It adds practical production controls such as layer filtering, pick layer from object, copy selected layer name, last-used memory, and optional visual property preservation.</Run><LineBreak/><LineBreak/>
<Bold><Run Foreground="DodgerBlue">Function Syntax</Run></Bold><LineBreak/><Run Foreground="White">Layer change command: </Run><Bold><Run Foreground="Orange">ChangeLayerToCurrent</Run></Bold><Run Foreground="White">opens a searchable layer selector and moves selected objects to the chosen layer</Run><LineBreak/><LineBreak/>
<Bold><Run Foreground="DodgerBlue">SEO Optimized Overview</Run></Bold><LineBreak/><Run Foreground="White">ποΈ ChangeLayerToCurrent is an SEO-friendly AutoCAD layer management tool for changing selected objects to a selected drawing layer.</Run><LineBreak/><Run Foreground="White">π The command builds a temporary DCL dialog, lists all layers, supports a filter text box, and remembers the last selected layer and filter using environment variables.</Run><LineBreak/><Run Foreground="White">π― A Pick Layer workflow lets the user select an existing object and reuse its layer as the target layer.</Run><LineBreak/><Run Foreground="White">π A Copy Layer Name helper sends the chosen layer name to the Windows clipboard through PowerShell/clip logic.</Run><LineBreak/><Run Foreground="White">π§ The optional Keep original properties mode captures effective linetype, linetype scale, and lineweight/width before moving objects, then reapplies those values after the layer change.</Run><LineBreak/><LineBreak/>
<Bold><Run Foreground="LimeGreen">Primary Workflow</Run></Bold><LineBreak/><Run Foreground="White">1οΈβ£ Run </Run><Bold><Run Foreground="Orange">ChangeLayerToCurrent</Run></Bold><Run Foreground="White"> at the AutoCAD command line.</Run><LineBreak/><Run Foreground="White">2οΈβ£ Filter the layer list, pick a layer manually, or use Pick Layer to read a layer from an existing object.</Run><LineBreak/><Run Foreground="White">3οΈβ£ Optionally enable Keep original properties before confirming the dialog.</Run><LineBreak/><Run Foreground="White">4οΈβ£ Select one or more objects to move to the target layer.</Run><LineBreak/><Run Foreground="White">5οΈβ£ Review the command-line result message confirming the layer move and preserved properties if enabled.</Run><LineBreak/><LineBreak/>
<Bold><Run Foreground="LimeGreen">Functionalities</Run></Bold><LineBreak/><Run Foreground="White">β
Display all drawing layers in a DCL popup/list interface.</Run><LineBreak/><Run Foreground="White">β
Filter layer names with typed search text.</Run><LineBreak/><Run Foreground="White">β
Remember the last used layer and last filter between command runs.</Run><LineBreak/><Run Foreground="White">β
Pick an existing object to use its layer as the destination layer.</Run><LineBreak/><Run Foreground="White">β
Copy the selected layer name to the clipboard.</Run><LineBreak/><Run Foreground="White">β
Select multiple objects after confirming the target layer.</Run><LineBreak/><Run Foreground="White">β
Move selected objects to the chosen layer using CHPROP.</Run><LineBreak/><Run Foreground="White">β
Optionally preserve original displayed linetype, linetype scale, and lineweight/width after the layer change.</Run><LineBreak/><LineBreak/>
<Bold><Run Foreground="DodgerBlue">Important Commands and Functions</Run></Bold><LineBreak/><Run Foreground="White">π§© </Run><Bold><Run Foreground="Orange">ChangeLayerToCurrent</Run></Bold><Run Foreground="White"> - main command that opens the layer selector and applies the layer change.</Run><LineBreak/><Run Foreground="White">π§© </Run><Bold><Run Foreground="Orange">ssget</Run></Bold><Run Foreground="White"> - collects the target objects to move after the dialog closes.</Run><LineBreak/><Run Foreground="White">π§© </Run><Bold><Run Foreground="Orange">CHPROP</Run></Bold><Run Foreground="White"> - AutoCAD command used to change selected entities to the chosen layer.</Run><LineBreak/><Run Foreground="White">π§© </Run><Bold><Run Foreground="Orange">entsel</Run></Bold><Run Foreground="White"> - supports picking an object to read its current layer.</Run><LineBreak/><Run Foreground="White">π§© </Run><Bold><Run Foreground="Orange">entget / entmod</Run></Bold><Run Foreground="White"> - captures and reapplies original entity display properties.</Run><LineBreak/><Run Foreground="White">π§© </Run><Bold><Run Foreground="Orange">PowerShell / clip</Run></Bold><Run Foreground="White"> - copies the selected layer name to the clipboard.</Run><LineBreak/><LineBreak/>
<Bold><Run Foreground="LimeGreen">Result</Run></Bold><LineBreak/><Run Foreground="White">π― The result is faster and safer layer reassignment with fewer manual Layer dropdown actions.</Run><LineBreak/><Run Foreground="White">π The optional property-preservation mode keeps object appearance stable while still moving geometry to the selected layer.</Run><LineBreak/><LineBreak/>
<Bold><Run Foreground="DarkRed">Important Notes</Run></Bold><LineBreak/><Run Foreground="White">β οΈ The command changes selected entities to the chosen layer; verify the target layer before selecting a large object set.</Run><LineBreak/><Run Foreground="White">β οΈ Property preservation is focused on linetype, linetype scale, and lineweight/width; it does not preserve every possible entity override.</Run><LineBreak/><Run Foreground="White">β οΈ The clipboard helper depends on Windows clipboard/PowerShell availability.</Run><LineBreak/><LineBreak/>
<Bold><Run Foreground="Yellow">Tags</Run></Bold><LineBreak/><Run Foreground="Yellow">π·οΈ AutoCAD, π·οΈ AutoLISP, π·οΈ Civil 3D, π·οΈ Change Layer, π·οΈ Layer Selector, π·οΈ DCL Dialog, π·οΈ CAD Layer Management, π·οΈ CHPROP, π·οΈ Clipboard, π·οΈ ChangeLayerToCurrent</Run><LineBreak/>
<Bold><Run Foreground="DodgerBlue">Description</Run></Bold><LineBreak/><Run Foreground="White">ποΈ ChangeLayerToCurrent_Xref is an AutoCAD AutoLISP tool for selecting a destination layer from a DCL dialog and moving objects to it.</Run><LineBreak/><Run Foreground="LimeGreen">π― It is designed as a fast layer reassignment helper, especially useful when cleaning copied or xref-related geometry into local drawing layers.</Run><LineBreak/><LineBreak/>
<Bold><Run Foreground="DodgerBlue">Function Syntax</Run></Bold><LineBreak/><Run Foreground="White">Xref layer change command: </Run><Bold><Run Foreground="Orange">ChangeLayerToCurrent_Xref</Run></Bold><Run Foreground="White">selects a layer from the drawing and moves selected objects to it</Run><LineBreak/><LineBreak/>
<Bold><Run Foreground="DodgerBlue">SEO Optimized Overview</Run></Bold><LineBreak/><Run Foreground="White">ποΈ ChangeLayerToCurrent_Xref is an SEO-friendly AutoCAD layer change command for moving selected objects to a chosen drawing layer.</Run><LineBreak/><Run Foreground="White">π§° The command reads all layer names from the active drawing through the AutoCAD Layers collection and displays them in a temporary DCL popup list.</Run><LineBreak/><Run Foreground="White">πΎ The selected layer is saved with setenv so it can be preselected the next time the command runs.</Run><LineBreak/><Run Foreground="White">π― After the dialog closes, the routine sets CLAYER to the chosen layer and prompts the user to select objects to move.</Run><LineBreak/><Run Foreground="White">π It uses AutoCAD CHPROP to assign the selected entities to the chosen destination layer.</Run><LineBreak/><LineBreak/>
<Bold><Run Foreground="LimeGreen">Primary Workflow</Run></Bold><LineBreak/><Run Foreground="White">1οΈβ£ Run </Run><Bold><Run Foreground="Orange">ChangeLayerToCurrent_Xref</Run></Bold><Run Foreground="White"> at the AutoCAD command line.</Run><LineBreak/><Run Foreground="White">2οΈβ£ Choose the target layer from the Available Layers popup list.</Run><LineBreak/><Run Foreground="White">3οΈβ£ Click OK to save the layer selection and make it current.</Run><LineBreak/><Run Foreground="White">4οΈβ£ Select the objects that should be moved to the chosen layer.</Run><LineBreak/><Run Foreground="White">5οΈβ£ Review the command line message confirming that the selected entities were moved.</Run><LineBreak/><LineBreak/>
<Bold><Run Foreground="LimeGreen">Functionalities</Run></Bold><LineBreak/><Run Foreground="White">β
List all drawing layers in a simple DCL popup.</Run><LineBreak/><Run Foreground="White">β
Remember the last selected layer between command runs.</Run><LineBreak/><Run Foreground="White">β
Set the chosen layer as the current layer.</Run><LineBreak/><Run Foreground="White">β
Prompt the user to select objects after layer confirmation.</Run><LineBreak/><Run Foreground="White">β
Move the selected objects to the chosen layer using CHPROP.</Run><LineBreak/><Run Foreground="White">β
Clean up the temporary DCL file after the dialog closes.</Run><LineBreak/><LineBreak/>
<Bold><Run Foreground="DodgerBlue">Important Commands and Functions</Run></Bold><LineBreak/><Run Foreground="White">π§© </Run><Bold><Run Foreground="Orange">ChangeLayerToCurrent_Xref</Run></Bold><Run Foreground="White"> - main command for the DCL layer selection workflow.</Run><LineBreak/><Run Foreground="White">π§© </Run><Bold><Run Foreground="Orange">vla-get-layers</Run></Bold><Run Foreground="White"> - reads layer names from the active AutoCAD document.</Run><LineBreak/><Run Foreground="White">π§© </Run><Bold><Run Foreground="Orange">setenv / getenv</Run></Bold><Run Foreground="White"> - persists the last used layer.</Run><LineBreak/><Run Foreground="White">π§© </Run><Bold><Run Foreground="Orange">setvar CLAYER</Run></Bold><Run Foreground="White"> - sets the selected layer as current.</Run><LineBreak/><Run Foreground="White">π§© </Run><Bold><Run Foreground="Orange">ssget</Run></Bold><Run Foreground="White"> - collects the objects to change.</Run><LineBreak/><Run Foreground="White">π§© </Run><Bold><Run Foreground="Orange">CHPROP</Run></Bold><Run Foreground="White"> - changes selected entities to the chosen layer.</Run><LineBreak/><LineBreak/>
<Bold><Run Foreground="LimeGreen">Result</Run></Bold><LineBreak/><Run Foreground="White">π― The result is a quick DCL-based layer reassignment workflow for moving selected AutoCAD objects to a chosen layer.</Run><LineBreak/><Run Foreground="White">π§Ή It helps clean xref-related or copied geometry by moving it into controlled local drawing layers.</Run><LineBreak/><LineBreak/>
<Bold><Run Foreground="DarkRed">Important Notes</Run></Bold><LineBreak/><Run Foreground="White">β οΈ This version is simpler than the extended ChangeLayerToCurrent tool and does not include filtering or property preservation.</Run><LineBreak/><Run Foreground="White">β οΈ The command modifies selected entity layers, so confirm the selected destination layer before processing.</Run><LineBreak/><Run Foreground="White">β οΈ The selected layer is saved between sessions using an environment variable.</Run><LineBreak/><LineBreak/>
<Bold><Run Foreground="Yellow">Tags</Run></Bold><LineBreak/><Run Foreground="Yellow">π·οΈ AutoCAD, π·οΈ AutoLISP, π·οΈ Civil 3D, π·οΈ Xref Cleanup, π·οΈ Change Layer, π·οΈ Layer Picker, π·οΈ CHPROP, π·οΈ DCL Dialog, π·οΈ ChangeLayerToCurrent_Xref</Run><LineBreak/>
</TextBlock>
<Grid>
<Image Source="Image_000.jpg" Stretch="Uniform"/>
</Grid>
<Grid>
<Image Source="Image_001.jpg" Stretch="Uniform"/>
</Grid>
<Grid>
<Image Source="Image_002.jpg" Stretch="Uniform"/>
</Grid>
</ResourceDictionary>
