Function Syntax: LockAllVp Version: 2 Date: 24.12.2025 AI+https://www.cadtutor.net/forum/topic/75876-unlocking-all-viewports-kent-cooper-kent1cooper/ Description This program displays a dialog that lets you Lock or Unlock all Paper Space viewports in the selected layouts, without using fragile ARX command calls from inside DCL callbacks. It is designed to be stable in AutoCAD and Civil 3D by using COM properties to change viewport lock state and by avoiding command-based locking during dialog actions. Commands LOCKALLVP run the dialog tool.LockAllVp run the dialog tool (same as above)._LOCKALLVP run the dialog tool (underscore alias). User Workflow Run LOCKALLVP to open the dialog. Optionally filter layouts using wildcard pattern * and ? then click Apply to rebuild the list. Select one or more layouts in the list (multi-select). Click Lock or Unlock The list immediately refreshes to show updated status per layout. Use Undo to revert the last Lock or Unlock operation, including multi-level undo frames. Use Copy to Clipboard to copy selected layout names plus their status. What the Dialog Shows • Each list row displays: Layout Name on the left and Status on the right. • Status values: Locked, Unlocked, Mixed, NoVP, Model. • The Selected counter updates based on the current multi-selection. Viewport Detection Logic • The program scans each chosen layout by reading the layout Block contents and collecting entities of type AcDbViewport. • It skips the overall Paper Space viewport when possible by ignoring viewport Number = 1 to avoid unintended global effects. • If no valid viewports are found in a layout, the status becomes NoVP. Functionalities Wildcard filtering of layouts using * and ? with an Apply button that rebuilds the visible list.Multi-select layouts with Select All and Select None controls.Lock all detected Paper Space viewports in the selected layouts by setting DisplayLocked to true via COM.Unlock all detected Paper Space viewports in the selected layouts by setting DisplayLocked to false via COM.Live status refresh after Lock or Unlock so the list updates immediately to Locked, Unlocked, Mixed, or NoVP.Safe Undo that stores changes as handle plus prior lock state and can revert multiple operations without calling AutoCAD UNDO from DCL.Copy to Clipboard for selected layouts, copying lines formatted as layout name then status (tab-separated), one per line. • Optional Include Model toggle to show Model in the list, but Model is not modified and is displayed as Model status. Important Technical Notes • The tool intentionally avoids calling command-based viewport locking from DCL callbacks to reduce the risk of ARX hard crashes and stack errors. • Lock and Unlock operations use COM property writes on AcDbViewport objects, which is typically more stable during UI interaction. • Undo is implemented as an internal stack of changes rather than using AutoCAD command undo inside the dialog callbacks. Result After running the tool, the selected layouts will have their Paper Space viewports set to Locked or Unlocked