Short description
- ChangeLayer — DCL layer picker with wildcard filter and “pick from drawing” option
- Lists only visible layers (not off, not frozen) and supports * / ? pattern matching
- Remembers the last filter via environment variable and can auto-filter based on an object’s layer

Command:
- • ChangeLayer
Description:
- Opens a temporary DCL dialog titled Select Layer with a filter edit box and a single-select list of layers.
- Builds the layer list from the drawing’s layer table, including only layers that are not Off and not Frozen, then sorts them alphabetically.
- Allows filtering the list using wildcard patterns (* and ?) and updates the list live as the filter changes.
- Provides a Pick Layer from Drawing button that lets the user select an object and automatically uses that object’s layer as the filter pattern, then reopens the dialog.
- On OK, returns the chosen layer name; the command then sets CLAYER to that layer and prints confirmation; on cancel, prints a cancel message.
Helper function: (if any)
- • Drawing-Visible-Layers-lst — scans the LAYER table and returns a sorted list of layer names that are not Off (bit 1) and not Frozen (bit 4).
- • Update-List — applies wcmatch filtering to the full layer list and repopulates the DCL list_box.
- • Highlight-Layer — finds a layer name within the currently filtered list and selects/highlights it in the list box.
- • Show-Dialog — loads the generated DCL file, initializes the filter field, wires action_tile handlers, runs the dialog, unloads it, and returns the dialog result code.
- • LayerList-popup — orchestrates the DCL creation, dialog loop (including “pick from drawing”), persistence of last filter, and returns the selected layer name.
Functionalities:
- • Visible layer enumeration — uses tblnext over LAYER and filters by flags in group code 70 to exclude Off/Frozen layers.
- • Last filter persistence — reads CHLAY-LAST-FILTER from environment; defaults to * if none; saves it back on exit.
- • Temporary DCL generation — writes a layerfilter.dcl-style file to a temp path using vl-filename-mktemp and open/write-line.
- • Wildcard filtering — uses wcmatch against the filter pattern; treats an empty filter as *.
- • Live list refresh — filter edit_box action updates filter-pat and repopulates the list box immediately.
- • Single selection tracking — list_box action stores the selected index so the chosen layer can be returned on OK.
- • Pick layer from drawing — dialog button exits with a special code (2), prompts entsel, extracts group code 8 (layer), sets filter to that layer, then reopens dialog.
- • Cleanup — unloads the dialog, deletes the temporary DCL file, and writes the last-used filter to the environment.
- • Apply current layer — c:ChangeLayer sets CLAYER to the returned layer name and prints confirmation, otherwise prints cancel/no-selection message.
Result:
- If the user clicks OK after selecting a layer from the filtered list, the routine returns that layer name and the command sets it as the current layer (CLAYER).
- If the user clicks Pick Layer from Drawing, the filter is replaced with the picked object’s layer and the dialog reopens to streamline selection.
- If canceled or no valid list selection is made, the current layer is unchanged and a cancel/no-selection message is printed; the last filter pattern is still saved for next time.
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
