RenameLayer

Short description

  • LRN — DCL-driven batch layer renamer with search filter, add prefix/suffix, remove substring, replace text, optional ALL CAPS, and optional auto-merge after remove
  • Builds a matching layer list (excluding layer 0), then renames each layer via command-line -RENAME and optionally merges via -LAYMRG
  • Wraps operation in an Undo mark and shows an Express Tools progress meter
renamelayer

Command:

  • LRN

Description:

  • Opens a temporary DCL dialog Layer Rename (Case Sensitive) that lets the user: filter layers by a substring, add prefix/suffix, remove a substring, replace one string with another, apply ALL CAPS, and optionally auto-merge layers after a “Remove”.
  • After the dialog closes with OK, gathers all layer names from the layer table, filters them by the search string (or includes all if search is blank), and excludes layer 0.
  • For each matching layer, computes a new name by applying Remove, Replace, Prefix, and Suffix in sequence, then renames the layer via -RENAME; if the Merge toggle is enabled and the target name already exists, it merges layers using -LAYMRG instead of a straight rename.
  • Shows a progress indicator during processing, cleans up the temporary DCL file, restores CMDECHO, and closes the Undo mark at the end (or on error/cancel).

Helper function: (if any)​

  • LRN_dialog — writes the DCL definition to a temporary LayerRename.dcl file and sets fname for loading.
  • *error* handler — restores environment (CMDECHO, progress UI), deletes the temp DCL file, ends Undo mark, and reports non-cancel errors.
  • ai_table — used to retrieve a list of layer names from the drawing’s layer table.
  • acet-ui-progress — Express Tools progress meter used to show progress while iterating matching layers.
  • acet-str-replace — performs replace operation for the “Replace/With” fields when both are provided.
  • vl-string-subst — removes a substring by substituting it with an empty string for the “Remove” field.
  • -RENAME / -LAYMRG — command-line operations used to rename or merge layers as needed.

Functionalities:

  • Undo safety — starts an Undo mark at the beginning and ends it at completion so the full batch can be undone as one unit.
  • Dialog inputs — captures: Search substring, New Prefix, New Suffix, Remove substring, Replace-from (OSTR), Replace-to (NSTR), Apply All Caps toggle, and Auto Merge toggle.
  • Replace validation — enforces that Replace fields must be provided as a pair (both filled or both blank); otherwise alerts and re-runs the command.
  • Matching layer set — if Search is blank, targets all layers except 0; if Search is provided, targets layers containing the Search string; avoids duplicates via vl-position checks.
  • Name transformation order — for each layer: Remove substring → Replace substring → Add prefix → Add suffix → optional ALL CAPS conversion.
  • Merge vs rename — when Merge is enabled and the computed new name already exists, uses -LAYMRG to merge the old layer into the existing target; otherwise uses -RENAME to rename.
  • Progress reporting — shows “Modifying Layers” progress and advances per processed layer; alerts and restarts if no matches were found.
  • Session cleanup — restores CMDECHO, closes the progress UI, deletes the temp DCL file, and restores the prior error handler.

Result:

  • Running LRN opens a dialog to batch-rename layers matching a search substring (or all layers except 0) by removing, replacing, and/or adding prefix/suffix, with an optional ALL CAPS conversion.
  • If the Merge option is enabled and a computed target name already exists, the routine merges layers instead of failing a rename, then continues processing remaining matches.
  • The operation runs with a progress meter and is wrapped in a single Undo mark; temporary DCL files are deleted and settings are restored on completion or cancel.

Images, animations etc.

renamelayer
Pixel

Additional info:

Share this page:

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Tags: Layers
Tags: Layers
0
Would love your thoughts, please comment.x
()
x