LayerFilterFreezeThawOnPlotVPFreeze

Short description

❄️ LayerFilterFreezeThawOnPlotVPFreeze is an advanced AutoCAD DCL layer filter manager for Freeze, Thaw, On, Off, Lock, Unlock, Plot, No Plot, VP Freeze, and VP Thaw.
🖼️ It reads AutoCAD layer filter xrecords, supports inverted filter logic, remembers last settings, and applies viewport freeze or thaw through ACAD XDATA.

Command:

🚀 Main command: LayerFilterFreezeThawOnPlotVPFreeze
🧰 Dialog workflow label: Layer Filters
🖼️ Viewport actions: VP Freeze and VP Thaw require selecting a paper-space floating viewport.

Description:

❄️ LayerFilterFreezeThawOnPlotVPFreeze is an SEO-friendly AutoCAD layer filter manager for applying multiple layer-state, plot-state, and viewport-state actions from one DCL dialog.
🧱 The tool reads layer filter definitions from AutoCAD’s layer filter dictionaries and resolves useful layer-name patterns into actual drawing layers.
🎛️ Standard actions include Freeze, Thaw, On, Off, Lock, Unlock, Plot, and No Plot, with paired exclusive toggles to prevent contradictory settings.
🖼️ Viewport actions support VP Freeze and VP Thaw by selecting a paper-space viewport, temporarily unlocking it if necessary, editing ACAD XDATA layer entries, and refreshing the viewport.
📌 This is useful for Civil 3D sheet preparation, viewport-specific layer visibility, xref plotting control, layer filter execution, and CAD production layout management.

Helper function: (if any)​

🧩 lfm:DclText creates the DCL interface with standard action groups, plot controls, viewport controls, invert, Select All, and Select None.
🧩 lf:filterNames reads available AutoCAD layer filters.
🧩 lf:layersFromXrecord extracts layer-name rules from filter xrecords.
🧩 lfm:chooseXrecForFilterIndex resolves the selected filter to a usable xrecord rule set.
🧩 lf:applyActions applies standard, plot, and viewport actions to the resolved layer list.
🧩 lf:plottable-activex changes the layer plottable flag using ActiveX, with command fallback.
🧩 lf:vpFreezeThaw handles viewport-specific freeze and thaw via ACAD XDATA.
🧩 lfm:saveLastSettings and lfm:restoreLastSettings preserve the last selected filter, invert flag, and toggles.

Functionalities:

✅ Select an existing AutoCAD layer filter from a DCL list.
✅ Apply multiple non-conflicting layer actions in one run.
✅ Freeze or thaw layers globally.
✅ Turn layers on or off.
✅ Lock or unlock layers.
✅ Enable or disable plotting for matching layers.
✅ VP Freeze or VP Thaw matching layers in a selected layout viewport.
✅ Invert the filter to apply actions to all layers except the filtered set.
✅ Remember the last dialog settings during the session.
✅ Regenerate the drawing after applying actions.

Result:

🎯 The result is a fast, repeatable layer-filter execution workflow for both model-wide and viewport-specific layer management.
🟢 The tool reduces manual work in the Layer Properties Manager and improves consistency for plotting and layout viewport setup.

Images, animations etc.

Pixel

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="LayerFilterFreezeThawOnPlotVPFreeze">
<src:RibbonToolTip.ExpandedContent>
<StackPanel>
<TextBlock Background="AntiqueWhite" TextAlignment="Left">
<Bold>Function Syntax: LayerFilterFreezeThawOnPlotVPFreeze</Bold>
<LineBreak/>
<Bold>Version: 1.1 Date: 20.06.2026 6:38:54PM</Bold>
<LineBreak/>
<Hyperlink>N/A</Hyperlink>
<LineBreak/>
<Bold>Program name and command</Bold><LineBreak/>
This LISP loads a DCL dialog named <Foreground="DarkRed"><Bold>LFM</Bold></Foreground> for managing layer filters and applying layer actions in bulk.<LineBreak/>
Primary command entry point is <Foreground="DarkRed"><Bold>LFM</Bold></Foreground> style workflow implemented by the function <Foreground="DarkRed"><Bold>c:LayerFilterFreezeThawOnPlotVPFreeze</Bold></Foreground>.<LineBreak/>

<Bold>What the user must do</Bold><LineBreak/>
User runs the command, then:<LineBreak/>
• Selects a layer filter from the dropdown list.<LineBreak/>
• Chooses one or more actions via checkboxes.<LineBreak/>
• Optionally enables <Foreground="DarkRed"><Bold>Invert filter</Bold></Foreground> to apply actions to all layers except those in the selected filter.<LineBreak/>
• Clicks <Foreground="DarkRed"><Bold>Apply</Bold></Foreground> to execute, or <Foreground="DarkRed"><Bold>Cancel</Bold></Foreground> to exit.<LineBreak/>
Special case for viewport actions:<LineBreak/>
• If <Foreground="DarkRed"><Bold>VP Freeze</Bold></Foreground> or <Foreground="DarkRed"><Bold>VP Thaw</Bold></Foreground> is selected, the program will prompt the user to <Foreground="DarkRed"><Bold>select a floating paper space viewport</Bold></Foreground> before applying viewport-specific layer changes.<LineBreak/>

<Bold>Dialog layout and controls</Bold><LineBreak/>
Dialog title is Layer Filters and includes:<LineBreak/>
• Filter dropdown list: key <Foreground="DarkRed"><Bold>flt</Bold></Foreground>.<LineBreak/>
• Action toggles grouped in Standard Actions:<LineBreak/>
  • Freeze group: <Foreground="DarkRed"><Bold>FRZ</Bold></Foreground> Freeze, <Foreground="DarkRed"><Bold>THW</Bold></Foreground> Thaw.<LineBreak/>
  • On Off group: <Foreground="DarkRed"><Bold>ON</Bold></Foreground> On, <Foreground="DarkRed"><Bold>OFF</Bold></Foreground> Off.<LineBreak/>
  • Lock group: <Foreground="DarkRed"><Bold>LCK</Bold></Foreground> Lock, <Foreground="DarkRed"><Bold>ULK</Bold></Foreground> Unlock.<LineBreak/>
  • Plot group: <Foreground="DarkRed"><Bold>PLT</Bold></Foreground> Plot, <Foreground="DarkRed"><Bold>NPL</Bold></Foreground> No Plot.<LineBreak/>
  • Viewport group: <Foreground="DarkRed"><Bold>VPF</Bold></Foreground> VP Freeze, <Foreground="DarkRed"><Bold>VPT</Bold></Foreground> VP Thaw.<LineBreak/>
• Invert toggle: key <Foreground="DarkRed"><Bold>invert</Bold></Foreground> with label Invert filter apply to all except selected.<LineBreak/>
• Info text: key <Foreground="DarkRed"><Bold>info</Bold></Foreground> shows selected filter name and estimated layer count.<LineBreak/>
• Buttons: <Foreground="DarkRed"><Bold>Check All</Bold></Foreground>, <Foreground="DarkRed"><Bold>Check None</Bold></Foreground>, <Foreground="DarkRed"><Bold>Apply</Bold></Foreground>, <Foreground="DarkRed"><Bold>Cancel</Bold></Foreground>.<LineBreak/>

<Bold>Functionalities</Bold><LineBreak/>
• <Foreground="DarkRed"><Bold>Reads AutoCAD layer filters</Bold></Foreground> from the layers extension dictionary entry <Foreground="DarkRed"><Bold>ACAD_LAYERFILTERS</Bold></Foreground> and lists available filter names in the dialog.<LineBreak/>
• <Foreground="DarkRed"><Bold>Resolves the selected filter to an XRECORD</Bold></Foreground> and extracts layer membership by parsing stored strings and wildcard patterns.<LineBreak/>
• <Foreground="DarkRed"><Bold>Supports wildcard based layer matching</Bold></Foreground> using patterns containing star, question mark, or bracket expressions and expands them against all drawing layers.<LineBreak/>
• <Foreground="DarkRed"><Bold>Supports invert mode</Bold></Foreground> to target all layers not included in the selected filter.<LineBreak/>
• <Foreground="DarkRed"><Bold>Applies bulk layer actions</Bold></Foreground> to the computed layer list.<LineBreak/>
• <Foreground="DarkRed"><Bold>Remembers last settings</Bold></Foreground> including last chosen filter index, invert flag, and all toggle states for the next run.<LineBreak/>
• <Foreground="DarkRed"><Bold>Enforces mutual exclusivity</Bold></Foreground> in each action pair so contradictory options cannot be checked together, for example Freeze versus Thaw, On versus Off, Lock versus Unlock, Plot versus No Plot, VP Freeze versus VP Thaw.<LineBreak/>
• <Foreground="DarkRed"><Bold>Provides quick presets</Bold></Foreground> via Check All and Check None.<LineBreak/>

<Bold>Actions applied to layers</Bold><LineBreak/>
The program issues AutoCAD layer operations primarily through the command line interface <Foreground="DarkRed"><Bold>_.-LAYER</Bold></Foreground> and through ActiveX where available.<LineBreak/>
• Freeze: <Foreground="DarkRed"><Bold>FRZ</Bold></Foreground> uses <Foreground="DarkRed"><Bold>_.-LAYER _F</Bold></Foreground> for each target layer.<LineBreak/>
  • Safety behavior: the current layer from <Foreground="DarkRed"><Bold>CLAYER</Bold></Foreground> is skipped for Freeze to avoid freezing the active layer.<LineBreak/>
• Thaw: <Foreground="DarkRed"><Bold>THW</Bold></Foreground> uses <Foreground="DarkRed"><Bold>_.-LAYER _T</Bold></Foreground> for each target layer.<LineBreak/>
• On: <Foreground="DarkRed"><Bold>ON</Bold></Foreground> uses <Foreground="DarkRed"><Bold>_.-LAYER _ON</Bold></Foreground> for each target layer.<LineBreak/>
• Off: <Foreground="DarkRed"><Bold>OFF</Bold></Foreground> uses <Foreground="DarkRed"><Bold>_.-LAYER _OFF</Bold></Foreground> for each target layer.<LineBreak/>
• Lock: <Foreground="DarkRed"><Bold>LCK</Bold></Foreground> uses <Foreground="DarkRed"><Bold>_.-LAYER _LO</Bold></Foreground> for each target layer.<LineBreak/>
• Unlock: <Foreground="DarkRed"><Bold>ULK</Bold></Foreground> uses <Foreground="DarkRed"><Bold>_.-LAYER _UN</Bold></Foreground> for each target layer.<LineBreak/>
• Plot or No Plot:<LineBreak/>
  • Primary method uses ActiveX property update: <Foreground="DarkRed"><Bold>vla-put-Plottable</Bold></Foreground>.<LineBreak/>
  • Fallback method uses layer command: <Foreground="DarkRed"><Bold>_.-LAYER _P _Y</Bold></Foreground> or <Foreground="DarkRed"><Bold>_.-LAYER _P _N</Bold></Foreground> if ActiveX fails.<LineBreak/>

<Bold>Viewport Freeze and Thaw behavior</Bold><LineBreak/>
Viewport actions are implemented using an <Foreground="DarkRed"><Bold>ACAD XDATA</Bold></Foreground> method and apply only after the user selects a valid viewport entity.<LineBreak/>
Viewport selection rules:<LineBreak/>
• The selected entity must be a <Foreground="DarkRed"><Bold>VIEWPORT</Bold></Foreground> and must be a floating viewport, identified by viewport number greater than 1.<LineBreak/>
If the selection is invalid:<LineBreak/>
• The routine prints an error indicating no viewport was selected or it was not a floating viewport, and counts those operations as skipped.<LineBreak/>
Viewport lock handling:<LineBreak/>
• If the viewport is locked, the routine temporarily unlocks it using <Foreground="DarkRed"><Bold>vla-put-DisplayLocked</Bold></Foreground>, performs the XDATA operations, then restores the original lock state.<LineBreak/>
VP Freeze operation:<LineBreak/>
• For each target layer, it writes a <Foreground="DarkRed"><Bold>1003</Bold></Foreground> string entry into the viewport ACAD XDATA list, effectively registering the layer as frozen for that viewport.<LineBreak/>
VP Thaw operation:<LineBreak/>
• For each target layer, it scans the viewport ACAD XDATA and removes any matching <Foreground="DarkRed"><Bold>1003</Bold></Foreground> layer name entries.<LineBreak/>
Viewport refresh:<LineBreak/>
• After VP operations, it forces a viewport display refresh by toggling display off then on via <Foreground="DarkRed"><Bold>vla-display</Bold></Foreground> calls.<LineBreak/>

<Bold>Filter parsing and layer resolution logic</Bold><LineBreak/>
• The routine extracts filter definitions from XRECORD content by collecting all string values and tokenizing them into candidate layer names, then matching those tokens against existing layers.<LineBreak/>
• It also extracts wildcard patterns from XRECORD strings and expands them using <Foreground="DarkRed"><Bold>wcmatch</Bold></Foreground> against all layer names.<LineBreak/>
• When a filter root resolves to a dictionary, it may contain multiple XRECORDs; the routine selects an XRECORD using the chosen filter index, and if that yields zero layers it automatically picks the XRECORD with the highest resolved layer count.<LineBreak/>

<Bold>Execution flow and outputs</Bold><LineBreak/>
• After Apply, the routine prints a summary to the command line showing filter name, number of layers in the filter, whether invert is enabled, how many layers are processed, and the action codes selected.<LineBreak/>
• It then applies the chosen actions and prints totals: issued actions count and skipped count.<LineBreak/>
• At the end it triggers <Foreground="DarkRed"><Bold>REGENALL</Bold></Foreground> to refresh the drawing display after changes.<LineBreak/>

<Bold>Cancel and cleanup behavior</Bold><LineBreak/>
• The dialog Cancel button ends the dialog and prints Cancelled.<LineBreak/>
• Temporary DCL is written to a temp file and is deleted after dialog use.<LineBreak/>
• The routine includes a hard cancel helper <Foreground="DarkRed"><Bold>lf:hardCancel</Bold></Foreground> which sends ENTER and ESC sequences to terminate active commands because the build does not support the AutoCAD CANCEL command.<LineBreak/>

<Bold><Run Foreground="DodgerBlue">Description</Run></Bold><LineBreak/>
<Run Foreground="White">❄️ LayerFilterFreezeThaw is an AutoCAD DCL layer filter manager for applying Freeze, Thaw, On, Off, Lock, and Unlock actions to predefined layer sets.</Run><LineBreak/>
<Run Foreground="White">🚆 It includes a dedicated Kable filter with 30 exact railway or utility layer names plus quick commands for normal and inverted actions.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">Function Syntax</Run></Bold><LineBreak/>
<Run Foreground="White">🚀 Main dialog command: </Run><Bold><Run Foreground="Orange">LFM</Run></Bold><LineBreak/>
<Run Foreground="White">⚡ Quick Kable commands: </Run><Bold><Run Foreground="Orange">FKABLE, TKABLE, OKABLE, XFABLE, FKABLEI, TKABLEI</Run></Bold><LineBreak/>
<Run Foreground="White">🧪 Verification command: </Run><Bold><Run Foreground="Orange">VERIFYKABLE</Run></Bold><LineBreak/>
<Run Foreground="White">🧰 Helper command: </Run><Bold><Run Foreground="Orange">LFM-Kable</Run></Bold><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">SEO Optimized Overview</Run></Bold><LineBreak/>
<Run Foreground="White">❄️ LayerFilterFreezeThaw is an SEO-friendly AutoCAD layer filter action tool for applying layer state changes to predefined layer groups.</Run><LineBreak/>
<Run Foreground="White">🧱 The DCL dialog presents a filter list and radio-button action set, allowing the user to freeze, thaw, turn on, turn off, lock, or unlock matching layers.</Run><LineBreak/>
<Run Foreground="White">🚆 The Kable filter contains 30 exact layer names for Hartingstecker, 30 kV K1 and K2, OSE, Ortsnetz, and 750 V layer groups, making the routine highly targeted for repeated project standards.</Run><LineBreak/>
<Run Foreground="White">🔁 The invert option applies the chosen action to all layers except the selected filter, supporting quick isolation workflows.</Run><LineBreak/>
<Run Foreground="White">📌 This is useful for Civil 3D production drawings, railway electrical layers, project layer visibility control, quick cable-layer isolation, and CAD layer cleanup.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="LimeGreen">Primary Workflow</Run></Bold><LineBreak/>
<Run Foreground="White">1️⃣ Load the AutoLISP file in AutoCAD or Civil 3D with APPLOAD or your menu loader.</Run><LineBreak/>
<Run Foreground="White">2️⃣ Run the command shown above from the AutoCAD command line.</Run><LineBreak/>
<Run Foreground="White">3️⃣ Follow the dialog, selection prompts, or file prompts used by LayerFilterFreezeThaw.</Run><LineBreak/>
<Run Foreground="White">4️⃣ Review the command-line report and drawing result before continuing production work.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="LimeGreen">Functionalities</Run></Bold><LineBreak/>
<Run Foreground="White">✅ Select a predefined layer filter from a DCL popup.</Run><LineBreak/>
<Run Foreground="White">✅ Apply Freeze, Thaw, On, Off, Lock, or Unlock.</Run><LineBreak/>
<Run Foreground="White">✅ Invert the selected filter to process all layers except the chosen group.</Run><LineBreak/>
<Run Foreground="White">✅ Use quick commands for Kable freeze, thaw, on, off, and inverted variants.</Run><LineBreak/>
<Run Foreground="White">✅ Verify whether the expected Kable layer list exists in the drawing.</Run><LineBreak/>
<Run Foreground="White">✅ Print action-by-action feedback and final changed/skipped counts.</Run><LineBreak/>
<Run Foreground="White">✅ Regenerate the drawing after successful layer state changes.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">Important Functions and AutoCAD API</Run></Bold><LineBreak/>
<Run Foreground="White">🧩 _lf:DclText builds the Layer Filters dialog as embedded DCL text.</Run><LineBreak/>
<Run Foreground="White">🧩 _lf:GetAllFilterNames returns the available standard filter names.</Run><LineBreak/>
<Run Foreground="White">🧩 _lf:GetLayersByFilter resolves filter names to actual layer names or hardcoded project layer sets.</Run><LineBreak/>
<Run Foreground="White">🧩 _lf:SetLayerState applies Freeze, Thaw, On, Off, Lock, or Unlock to one layer object.</Run><LineBreak/>
<Run Foreground="White">🧩 _lf:ApplyToLayerNames processes the layer list and reports changed versus skipped layers.</Run><LineBreak/>
<Run Foreground="White">🧩 LFM-Kable provides command-line shortcut execution for the Kable group.</Run><LineBreak/>
<Run Foreground="White">🧩 VERIFYKABLE checks whether all 30 Kable layers exist in the current drawing.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="LimeGreen">Result</Run></Bold><LineBreak/>
<Run Foreground="White">🎯 The result is a controlled layer-state update for a chosen filter group or its inverse.</Run><LineBreak/>
<Run Foreground="White">🟢 The tool saves time when repeatedly isolating, hiding, thawing, or locking known project layer groups.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DarkOrange">Operational Notes and Limitations</Run></Bold><LineBreak/>
<Run Foreground="White">⚠️ The Kable filter is hardcoded to exact layer names; missing layers are skipped and can be checked with VERIFYKABLE.</Run><LineBreak/>
<Run Foreground="White">⚠️ The command changes layer state properties in the active drawing.</Run><LineBreak/>
<Run Foreground="White">🧠 Use the inverted mode carefully because it affects all layers outside the selected filter.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="Yellow">Tags</Run></Bold><LineBreak/>
<Run Foreground="Yellow">🏷️ AutoCAD, 🏷️ AutoLISP, 🏷️ Civil 3D, 🏷️ Layer Filters, 🏷️ Freeze Thaw, 🏷️ Kable Layers, 🏷️ Railway CAD, 🏷️ DCL Dialog, 🏷️ Layer Visibility</Run><LineBreak/>

</TextBlock>
            
<Grid>
<Image Source="PNG" Stretch="Uniform"/>
</Grid>

<Grid>
<MediaElement
 Source="GIF"
 Stretch="Uniform"
 Visibility="Visible"/>
 </Grid>

</StackPanel>
</src:RibbonToolTip.ExpandedContent>
</src:RibbonToolTip>
</ResourceDictionary>

Additional info:

Share this page: