FreezeLayersInVP

Short description

  • Shows a DCL dialog to filter and multi-select layers, then freezes the selected layers in the current viewport using VPLAYER.
  • Supports filtering by Current layers, Xref layers, or Current_and_Xref, with an optional Xref picker and a fixed-width “faux columns” layer list.
freezelayersinvp 000

Command:

  • Commands: FreezeLayersInVP and alias FLVP

Description:

  • Builds an embedded DCL file at runtime and displays a dialog titled Freeze Layers in Current Viewport.
  • Collects all layers from the active document and optionally restricts matches to Current layers, Xref layers, or both, with an additional Xref-name selector when Xref filtering is enabled.
  • Uses an accent-insensitive filter: if the filter text contains no wildcards, it is treated as a contains search by wrapping it with * on both sides; if it contains * or ?, it is treated as a wildcard pattern.
  • Displays matching layers in a fixed-width list with a sticky header and “faux columns” that show key layer properties (On/Freeze/Lock/Plot/Color/Linetype/Description).
  • On Freeze, runs VPLAYER to freeze each selected layer for the active viewport context.

Helper function: (if any)​

  • str-join joins a list of strings using a separator for persistence messages and environment storage.
  • split splits a string by a delimiter and drops empty parts (used for env parsing and index parsing).
  • parse-indexes safely converts list-box selection strings like “0 2 5” into index lists.
  • deaccent normalizes text by translating common accented Latin characters to ASCII and uppercasing for accent-insensitive matching.
  • has-wildcards detects whether the filter contains * or ? to decide between wildcard and contains filtering.
  • make-spaces and fmt-pad create fixed-width padding for faux column formatting.
  • bool->yn converts boolean flags into Yes or No for the display row.
  • aci->name converts common ACI color indices into readable color names for the display row.
  • get-layer-props queries the layer object via ActiveX to retrieve On/Freeze/Lock/Plot/Color/Linetype/Description and determines whether it is an Xref layer by the presence of | in the name.
  • fmt-row builds one fixed-width display line with faux columns: Src, Name, On, Frz, Lck, Plt, Color, LT, Desc.
  • get-all-xrefs collects attached, resolved Xrefs by scanning block references in ModelSpace and PaperSpace and checking Xref properties and paths.
  • layer-xref-name extracts the Xref name prefix from an Xref layer name of form XREFNAME|LAYER.
  • get-all-layers gathers all layer names from the document’s Layers collection and sorts them.
  • filter-layers applies the accent-insensitive pattern match plus Current/Xref scope rules and optional Xref-name restriction to produce filteredLayers.
  • fill-layers-list fills the list box with formatted rows and maintains a row-to-layer-name mapping for index resolution.
  • update-ui refreshes the Xref list, applies remembered Xref preselection, enables or disables the Xref picker, and repopulates the matching layer list.
  • c:FreezeLayersInVP is the main command routine; c:FLVP calls it as an alias.

Functionalities:

  • Runtime DCL generation writes the dialog to a temp file each run, loads it, then deletes it after closing.
  • Sticky header shows the faux-column titles in a fixed-width text control above the layer list.
  • Faux columns display: Src, Name, On, Frz, Lck, Plt, Color, LT, Desc using fixed-width padding.
  • Accent-insensitive filtering normalizes both filter text and layer names before matching, improving usability with localized naming.
  • Scope toggles to include Current_Layers, Current_and_Xref_Layers, and Xref_Layers when filtering the layer list.
  • Xref picker becomes enabled only when Xref_Layers is on and can restrict results to layers belonging to selected Xrefs.
  • Persistent settings remembers last filter text, toggle states, and chosen Xrefs using environment variables for the next session.
  • Multi-select layer freeze freezes each selected layer using VPLAYER with the freeze option and the _A scope as implemented in the routine.
  • Note the routine freezes with VPLAYER _A as coded, and the comment indicates _C could be used to target only the current viewport if desired.

Result:

  • If the user clicks Freeze, each selected layer is frozen via VPLAYER and a summary line prints listing frozen layer names.
  • If no layers are selected, prints No layers selected.
  • If the dialog cannot be loaded, shows an alert and exits without changes.
  • After the dialog closes, restores CMDECHO, unloads the dialog, and deletes the generated DCL file.

Images, animations etc.

freezelayersinvp 000
freezelayersinvp 001
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: General_AutoCAD, Layers, Lisp, Paper Space, Viewports, Xrefs
0
Would love your thoughts, please comment.x
()
x