VIEWFRAME draws, in model space, the outline of what a paper space viewport is showing. It answers “what part of the model does this sheet actually cover?” without opening the viewport and guessing.
What ViewFrame does
Run it across a whole drawing set and you get a key plan — a rectangle in model space for every sheet, showing its extent.
VIEWFRAME outlines one selected viewport. VIEWFRAMELAYOUT outlines every viewport on the current layout. VIEWFRAMEALL outlines every viewport on every layout.
Rectangular, polygonal and clipped viewports are all handled, including clip boundaries containing arc segments.
How to use it
- Load the routine with
APPLOAD, or put it on your support file search path. - Set
ViewFrame:Propertiesso the outlines land on a layer of their own. - Set
ViewFrame:Offsetif the sheet border overlaps the viewport edge. - Type
VIEWFRAMEALLfor a whole-set key plan.
How it works
A viewport’s boundary is defined in paper space, but the outline must be drawn in model space. Converting between the two means undoing everything the viewport does to the view it shows: its zoom scale, its twist angle, its view direction, and the offset between its centre and the model point it is centred on.
That is what ViewFrame:ToModel computes. Miss any one of those four and the outline lands somewhere plausible and wrong — a twisted viewport in particular will produce a frame that looks reasonable until you compare it with the sheet.
ViewFrame:Offset draws the outline set in from the true edge by a number of paper space units, which is useful when the sheet border overlaps the viewport edge and the true extent is slightly more than what is actually visible.
Notes and limits
- The offset is in paper space units, so it stays consistent across viewports at different scales.
- Put the outlines on their own layer via
ViewFrame:Properties, or they will be hard to remove later. - Twisted and clipped viewports are handled, including arc segments in the clip boundary.
- One undo group covers the run.
Download and details
| Name | ViewFrame — draw the outline of what a viewport shows, in model space |
| Download | ViewFrame.lsp — 20.0 KB, plain AutoLISP source. Downloads directly; no zip to unpack. |
| Type | AutoCAD AutoLISP routine |
| Commands | VIEWFRAME, VIEWFRAMEALL, VIEWFRAMELAYOUT |
| Requires | the ActiveX layer (loaded automatically by the routine with vl-load-com). |
| Source size | 20.0 KB, 529 lines |
| Error handling | Yes — a *error* handler restores every system variable it changed, on cancel as well as on error. |
| Undo | The whole operation is wrapped in a single undo group, so one U reverses all of it. |
| Compatibility | AutoCAD (any release with AutoLISP), BricsCAD, ZWCAD, GstarCAD, ProgeCAD and other IntelliCAD-based platforms. AutoCAD LT needs a LISP enabler. No .NET, no ObjectARX, no installer. |
| Author | YZ, August 2026 |
| Licence | Free to use, supplied “as is” with no warranty. |
References
- PORTLOCK LISP — lock the viewports once the sheets are set up
- SHEETSHUFFLE LISP — managing the layouts the viewports sit on
- Drawing scale chart — the viewport scales this is reading
- More free AutoLISP routines on this site
- Wisey’s Steel Shapes — free structural steel section drawing program