Short description
- DUPLICATELAYER / DUPLICATELAYERCURRENT — duplicate a layer’s properties into a new layer name via DCL, then set it current (optionally move the selected object).
- Copies common layer properties (Color, Linetype, Lineweight, Description) and PlotStyleName when available (STB-aware).
- DCL dialog asks for the new layer name and includes an “assign selected object” checkbox (used by DUPLICATELAYER).
Command:
- • DUPLICATELAYER
- • DUPLICATELAYERCURRENT
Description:
- DUPLICATELAYER: prompts the user to select an object, reads that object’s layer, then opens a dialog to enter a new layer name (default Copy_of_<layer>) and optionally assign the selected object to the new layer.
- If the target layer name does not already exist, creates it by copying properties from the source layer; if it exists, reuses it.
- Sets the new (or existing) layer as current (CLAYER), and if the checkbox is enabled, modifies the selected entity to the new layer and updates it.
- DUPLICATELAYERCURRENT: duplicates the current layer in the same way (default Copy_of_<current>) and sets the new layer current; the checkbox is displayed by the shared dialog but not used for reassignment in this command.
Helper function: (if any)
- • CreateLayerLike — creates a new layer and copies key properties from an existing layer: Color, Linetype, Lineweight, Description, and (when supported) PlotStyleName.
- • ShowRenameDialog — writes a temporary DCL file, shows a dialog to collect new layer name and an assign toggle, then returns (list name assignFlag) or NIL on cancel.
- • STB/CTB awareness — checks for PlotStyleName support and safely reads it (catch-all) before applying it to the new layer.
Functionalities:
- • Source layer detection — DUPLICATELAYER extracts source layer from the picked entity (DXF group 8); DUPLICATELAYERCURRENT uses CLAYER.
- • Dialog-driven naming — shows “Duplicate Layer” dialog with an edit box for the new name and a toggle defaulted to checked.
- • Existence check — uses tblsearch "LAYER" to determine whether the target name already exists before creating a new layer.
- • Layer creation by cloning — if missing, calls CreateLayerLike to create the new layer and copy properties from the source layer via VLA property gets/puts.
- • Set current layer — sets CLAYER to the new layer name in both commands.
- • Optional entity reassignment — for DUPLICATELAYER when the toggle is enabled, updates the entity’s layer (substitutes group 8), then calls entmod and entupd to apply changes.
- • Temporary DCL lifecycle — dialog definition is written to a temp file, loaded, used, unloaded, then the temp DCL file is deleted.
- • Validation / messaging — handles cancel/empty name/nothing selected conditions and prints status messages for created vs existing layers and assignment actions.
Result:
- After running DUPLICATELAYER, a new (or existing) layer name is selected via dialog; if it did not exist, it is created by copying properties from the picked object’s layer, then set as the current layer.
- If the dialog checkbox is enabled, the originally selected object is moved onto the new layer and updated; otherwise, only the current layer changes.
- After running DUPLICATELAYERCURRENT, the current layer is duplicated into the provided name (created if needed) and becomes the new current layer; no entity reassignment occurs.
Images, animations etc.
Log in to download.
Log in
Log in
Additional info:
Based on / Source code:
Open Website
Share this page:
Subscribe
Login
0 Comments
Oldest
Tags: Layers
Tags: Layers
