LockAllVp

Short description

🔒 AutoCAD layout viewport lock manager for locking or unlocking PaperSpace viewports in selected layouts from a DCL dialog.

Image 000 24

Command:

LOCKALLVP, LockAllVp, _LOCKALLVP

Description:

🔒 LockAllVp is an AutoLISP / Visual LISP utility for batch locking and unlocking PaperSpace viewports across selected AutoCAD layouts.
🧭 It is designed for sheet-production workflows where plotted layouts must keep their viewport scale, pan, and orientation protected.
📋 The routine builds a custom DCL dialog, lists layouts in tab order, shows viewport status per layout, and lets the user lock or unlock selected layouts without repeatedly switching tabs.
🛡️ It uses ActiveX DisplayLocked on AcDbViewport objects and avoids calling -VPORTS directly inside DCL, reducing command-context instability.

Helper function: (if any)​

LV:GetLayoutsTabOrder lists layouts by tab order.
LV:GetLayoutViewports traverses each layout block and collects AcDbViewport entities.
LV:_IsOverallPSViewport skips the overall PaperSpace viewport when Number = 1.
LV:LayoutStatus reports Locked, Unlocked, Mixed, NoVP, or Model.
LV:_SetLockedForLayouts applies DisplayLocked values and stores undo frames.
LV:CopyClipboard sends selected layout/status rows to the Windows clipboard using MSHTML or PowerShell/clip fallback.

Functionalities:

🔍 Wildcard layout filter using * and ? for fast layout searching.
📑 Multi-select layout list with Select All and Select None.
👁️ Status display for Locked, Unlocked, Mixed, NoVP, and Model.
🔒 Lock selected layouts in one operation.
🔓 Unlock selected layouts in one operation.
↩️ Manual multi-level undo stack for viewport lock changes.
📋 Copy selected layout names and statuses to the clipboard.
🧩 Optional Include Model toggle, while Model is reported safely and not treated like a PaperSpace viewport workflow.

Result:

✅ Faster control of viewport lock states across many layout tabs.
✅ Reduced risk of accidental viewport scale or pan changes before plotting.
✅ Clear QA overview of which layouts are fully locked, unlocked, mixed, or have no viewports.
✅ Clipboard-friendly layout/status report for checking or documenting sheet readiness.

Images, animations etc.

Image 000 24
Image 001 14
Image 002 10
Image 003 7
Image 004 4
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="LockAllVp">
<src:RibbonToolTip.ExpandedContent>
<StackPanel>
<TextBlock Background="AntiqueWhite" TextAlignment="Left">
<Bold>Function Syntax: LOCKALLVP / LockAllVp / _LOCKALLVP</Bold>
<LineBreak/>
<Bold>Version: 1.1 Date: 20.06.2026 6:38:55PM</Bold>
<LineBreak/>
<Hyperlink>AI+https://www.cadtutor.net/forum/topic/75876-unlocking-all-viewports-kent-cooper-kent1cooper/</Hyperlink>
<LineBreak/>
<Bold>Description</Bold><LineBreak/>


<Bold><Run Foreground="DodgerBlue">🔒 Command name</Run></Bold><LineBreak/>
<Run>LOCKALLVP / LockAllVp / _LOCKALLVP</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">🚀 Description</Run></Bold><LineBreak/>
<Run>LockAllVp is an AutoCAD AutoLISP utility that batch locks or unlocks PaperSpace viewports in selected layouts. It is useful when preparing sheets for plotting, checking layout viewport states, or protecting viewport scales from accidental edits.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">🧩 Dialog workflow</Run></Bold><LineBreak/>
<Run>The command opens a custom DCL interface with layout filtering, multi-selection, viewport status display, lock/unlock actions, selected count, clipboard copy, and manual undo.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">📋 Key features</Run></Bold><LineBreak/>
<Run>Wildcard filter with * and ?, Select All, Select None, Include Model toggle, Locked/Unlocked/Mixed/NoVP status, clipboard export, and multi-level undo inside the dialog.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">🛠️ Technical behavior</Run></Bold><LineBreak/>
<Run>The code reads AutoCAD layouts in tab order, traverses PaperSpace layout blocks, detects AcDbViewport objects, skips the overall PaperSpace viewport, and applies the ActiveX DisplayLocked property.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">✅ Result</Run></Bold><LineBreak/>
<Run>The drawing manager can quickly make many layouts plot-safe by locking viewport display without opening each layout manually.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">⚠️ Important notes</Run></Bold><LineBreak/>
<Run>This routine modifies viewport lock states. It avoids -VPORTS inside DCL and uses a manual undo stack while the dialog is open.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="Orange">🔎 SEO keywords</Run></Bold><LineBreak/>
<Run>AutoCAD AutoLISP tool for Civil 3D productivity, drawing management, layout automation, viewport control, layer workflows, DCL dialogs, and CAD production QA: LockAllVp.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="Yellow">🏷️ Tags</Run></Bold><LineBreak/>
<Run Foreground="Yellow">🏷️ AutoCAD, 🏷️ AutoLISP, 🏷️ Visual LISP, 🏷️ Civil 3D, 🏷️ Layouts, 🏷️ PaperSpace, 🏷️ Viewports, 🏷️ Viewport Lock, 🏷️ DCL Dialog, 🏷️ Sheet Production, 🏷️ CAD Automation, 🏷️ LOCKALLVP</Run><LineBreak/>







This program displays a dialog that lets you <Span Foreground="Red">Lock</Span> or <Span Foreground="Red">Unlock</Span> all Paper Space viewports in the <Span Foreground="DarkRed">selected layouts</Span>, without using fragile ARX command calls from inside DCL callbacks.<LineBreak/>
It is designed to be stable in AutoCAD and Civil 3D by using <Span Foreground="DarkRed">COM properties</Span> to change viewport lock state and by avoiding command-based locking during dialog actions.<LineBreak/>
<Bold>Commands</Bold>
<LineBreak/>
• <Span Foreground="DarkRed">LOCKALLVP</Span> run the dialog tool.<LineBreak/>
• <Span Foreground="DarkRed">LockAllVp</Span> run the dialog tool (same as above).<LineBreak/>
• <Span Foreground="DarkRed">_LOCKALLVP</Span> run the dialog tool (underscore alias).<LineBreak/>
<Bold>User Workflow</Bold>
<LineBreak/>

Run <Span Foreground="DarkRed">LOCKALLVP</Span> to open the dialog.<LineBreak/>

Optionally filter layouts using wildcard pattern <Span Foreground="DarkRed">*</Span> and <Span Foreground="DarkRed">?</Span> then click <Span Foreground="DarkRed">Apply</Span> to rebuild the list.<LineBreak/>

Select one or more layouts in the list (multi-select).<LineBreak/>

Click <Span Foreground="Red">Lock</Span> or <Span Foreground="Red">Unlock</Span>
<LineBreak/>

The list immediately refreshes to show updated status per layout.<LineBreak/>

Use <Span Foreground="DarkRed">Undo</Span> to revert the last Lock or Unlock operation, including multi-level undo frames.<LineBreak/>

Use <Span Foreground="DarkRed">Copy to Clipboard</Span> to copy selected layout names plus their status.<LineBreak/>
<Bold>What the Dialog Shows</Bold>
<LineBreak/>
• Each list row displays: <Span Foreground="DarkRed">Layout Name</Span> on the left and <Span Foreground="DarkRed">Status</Span> on the right.<LineBreak/>
• Status values: <Span Foreground="DarkRed">Locked</Span>, <Span Foreground="DarkRed">Unlocked</Span>, <Span Foreground="DarkRed">Mixed</Span>, <Span Foreground="DarkRed">NoVP</Span>, <Span Foreground="DarkRed">Model</Span>.<LineBreak/>
• The <Span Foreground="DarkRed">Selected</Span> counter updates based on the current multi-selection.<LineBreak/>
<Bold>Viewport Detection Logic</Bold>
<LineBreak/>
• The program scans each chosen layout by reading the layout <Span Foreground="DarkRed">Block</Span> contents and collecting entities of type <Span Foreground="DarkRed">AcDbViewport</Span>.<LineBreak/>
• It skips the overall Paper Space viewport when possible by ignoring viewport <Span Foreground="DarkRed">Number = 1</Span> to avoid unintended global effects.<LineBreak/>
• If no valid viewports are found in a layout, the status becomes <Span Foreground="DarkRed">NoVP</Span>.<LineBreak/>
<Bold>Functionalities</Bold>
<LineBreak/>
• <Span Foreground="DarkRed">Wildcard filtering</Span> of layouts using <Span Foreground="DarkRed">*</Span> and <Span Foreground="DarkRed">?</Span> with an Apply button that rebuilds the visible list.<LineBreak/>
• <Span Foreground="DarkRed">Multi-select layouts</Span> with <Span Foreground="DarkRed">Select All</Span> and <Span Foreground="DarkRed">Select None</Span> controls.<LineBreak/>
• <Span Foreground="Red">Lock</Span> all detected Paper Space viewports in the selected layouts by setting <Span Foreground="DarkRed">DisplayLocked</Span> to true via COM.<LineBreak/>
• <Span Foreground="Red">Unlock</Span> all detected Paper Space viewports in the selected layouts by setting <Span Foreground="DarkRed">DisplayLocked</Span> to false via COM.<LineBreak/>
• <Span Foreground="DarkRed">Live status refresh</Span> after Lock or Unlock so the list updates immediately to Locked, Unlocked, Mixed, or NoVP.<LineBreak/>
• <Span Foreground="DarkRed">Safe Undo</Span> that stores changes as handle plus prior lock state and can revert multiple operations without calling AutoCAD UNDO from DCL.<LineBreak/>
• <Span Foreground="DarkRed">Copy to Clipboard</Span> for selected layouts, copying lines formatted as layout name then status (tab-separated), one per line.<LineBreak/>
• Optional <Span Foreground="DarkRed">Include Model</Span> toggle to show Model in the list, but Model is not modified and is displayed as <Span Foreground="DarkRed">Model</Span> status.<LineBreak/>
<Bold>Important Technical Notes</Bold>
<LineBreak/>
• The tool intentionally avoids calling command-based viewport locking from DCL callbacks to reduce the risk of <Span Foreground="Red">ARX hard crashes</Span> and stack errors.<LineBreak/>
• Lock and Unlock operations use COM property writes on <Span Foreground="DarkRed">AcDbViewport</Span> objects, which is typically more stable during UI interaction.<LineBreak/>
• Undo is implemented as an internal stack of changes rather than using AutoCAD command undo inside the dialog callbacks.<LineBreak/>
<Bold>Result</Bold>
<LineBreak/>
After running the tool, the selected layouts will have their Paper Space viewports set to <Span Foreground="Red">Locked</Span> or <Span Foreground="Red">Unlocked</Span>
<LineBreak/>






</TextBlock>
            
<Grid>
<Image Source="Image_000.jpg" Stretch="Uniform"/>
</Grid>

<Grid>
<Image Source="Image_001.jpg" Stretch="Uniform"/>
</Grid>

<Grid>
<Image Source="Image_002.jpg" Stretch="Uniform"/>
</Grid>

<Grid>
<Image Source="Image_003.jpg" Stretch="Uniform"/>
</Grid>

<Grid>
<Image Source="Image_004.jpg" Stretch="Uniform"/>
</Grid>

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

Share this page:

Leave a Reply

Page Tag: 🏷️ AutoCAD

  • LockAllVp

    Short description🔒 AutoCAD layout viewport lock manager for locking or unlocking PaperSpace viewports in selected layouts from a DCL dialog. Command:LOCKALLVP, LockAllVp, _LOCKALLVP Description:🔒 LockAllVp is an AutoLISP / Visual LISP utility for batch locking and unlocking PaperSpace viewports across selected AutoCAD layouts. 🧭 It is designed for sheet-production workflows where plotted layouts must keep…

  • Zoom Extend

    Short description🔎 Zoom_Extend is an AutoCAD and Civil 3D AutoLISP utility for running Zoom Extents on selected layout tabs from a DCL interface. 📑 It helps clean up paper space view display across multiple sheets without manually opening every layout. Command:🚀 Main command: LZE 🔎 Opens a DCL layout selector to run Zoom Extents on…

  • Zoom Window

    Short description🔎 ZEZW is an AutoCAD and Civil 3D AutoLISP layout zoom tool for running Zoom Extents or Zoom Window on selected paper space layouts. 📑 It includes wildcard layout filtering, multi-select, select all/none, and clipboard support. Command:🚀 Main command: ZEZW ⚡ Alias command: _ZEZW 🔎 Opens a DCL dialog for Zoom Extents or Zoom…

  • All_Layouts_list

    Short description📋 AutoCAD layout list dialog for filtering, multi-selecting, and copying layout names from a drawing. Command:All_Layouts_list, ALL_LAYOUTS_LIST Description:📋 All_Layouts_list is an AutoLISP DCL utility that lists all AutoCAD layouts in tab order and helps users copy selected layout names to the Windows clipboard. 🔍 It is built for sheet-management tasks where layout names must…

  • FreezeLayersInVP

    FreezeLayersInVP

    Short description❄️ FreezeLayersInVP is an AutoCAD and Civil 3D AutoLISP layer-control utility for freezing selected current and xref layers in viewport workflows. 🧊 It provides a DCL layer browser with filters, xref selection, layer-status columns, and VPLAYER-based freezing for selected layer names. Command:🚀 Main command: FreezeLayersInVP 🔁 Alias command: FLVP 🧰 Load the LSP file…

  • RenameLayer

    Short description🧱 RenameLayer is an SEO-friendly AutoCAD and Civil 3D AutoLISP utility for batch renaming local drawing layers through a custom DCL dialog. 🔎 It combines layer filtering, multi-select layer processing, prefix and suffix insertion, string removal, find-and-replace logic, optional ALL CAPS conversion, and Auto Merge handling in one production-ready layer management workflow. 🛠️ The…

  • LayersNameToClipboard

    Short description📋 LayersNameToClipboard is an AutoCAD AutoLISP clipboard utility that reads the Layer property from selected objects and copies unique cleaned layer names. 🧹 It includes a simple formatting-code stripping helper and is useful for preparing layer-name lists for documentation, filters, Excel, and CAD QA workflows. Command:🚀 Main command: LayersNameToClipboard 🧩 Load the LSP in…

  • Import_Layer_Filter

    Short description📥 Import_Layer_Filter is an AutoCAD AutoLISP layer filter transfer tool for exporting and importing property layer filters through .lft, DWG, and DWT sources. 🗂️ It adds predefined project-folder management, multi-filter export and import, and xref-style prefix/suffix handling for NAME== filter patterns. Command:🚀 Export command: ExpFltr 📥 Import command: ImpFltr 🗂️ Folder manager command: LfPredefinedFolders…

  • FreezeLayersInMS

    Short description❄️ FreezeLayersInMS is an AutoCAD and Civil 3D DCL layer manager for filtering current and xref layers, then freezing, thawing, locking, plotting, or switching them on and off. 🔍 It displays matching layer status in a fixed-width table and hides xref prefixes for readability while preserving the true layer names for operations. Command:🚀 Main…

  • Export_Layer_Filter

    Short description📤 Export_Layer_Filter is an AutoCAD AutoLISP tool for exporting layer property filters to reusable .lft files. 🗂️ It adds a DCL interface for multi-filter selection, xref prefix handling, predefined project folders, and folder management. Command:🚀 Export command: ExpFltr 📥 Import command included: ImpFltr 🧪 Debug command: ExpFltrDebug 🗂️ The DCL workflow supports Select All,…