• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
blog.draftsperson.net

blog.draftsperson.net

the art of technical drawing

blog.draftsperson.net

VIEWFRAME LISP: Draw Viewport Extents Into Model Space

August 3, 2026

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

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Set ViewFrame:Properties so the outlines land on a layer of their own.
  3. Set ViewFrame:Offset if the sheet border overlaps the viewport edge.
  4. Type VIEWFRAMEALL for 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

NameViewFrame — draw the outline of what a viewport shows, in model space
DownloadViewFrame.lsp — 20.0 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandsVIEWFRAME, VIEWFRAMEALL, VIEWFRAMELAYOUT
Requiresthe ActiveX layer (loaded automatically by the routine with vl-load-com).
Source size20.0 KB, 529 lines
Error handlingYes — a *error* handler restores every system variable it changed, on cancel as well as on error.
UndoThe whole operation is wrapped in a single undo group, so one U reverses all of it.
CompatibilityAutoCAD (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.
AuthorYZ, August 2026
LicenceFree 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

Filed Under: AutoLISP Routines

Primary Sidebar

Subscribe to our Youtube Channel

Post CAD drafting jobs on Freelancer.com. and get some free money to do this.

Categories

  • American Steel Industry (4)
  • AutoCAD Articles & Reference (30)
  • AutoCAD Bugs & Problems (19)
  • AutoCAD Tips (29)
  • AutoCAD Tutorials (54)
  • AutoLISP Routines (328)
  • AutoLISP Tutorials (15)
  • CAD Standards (7)
  • Civil 3D (7)
  • Civil Drafting (4)
  • Dimensions (2)
  • Drafting Funnies (71)
  • Drafting History (9)
  • Drafting Standards (84)
  • Electrical Drafting (2)
  • General IT reference (7)
  • Geometry (15)
  • GIS (2)
  • Hatch Patterns (12)
  • Office Life Hacks (3)
  • PT (1)
  • Revit Tutorials (54)
  • Steel Detailing (14)
  • Structural Drafting (26)
  • Technical Dictionary (61)
  • Useful Website Links (19)

Footer

Free downloads

  • Free AutoLISP routines
  • Free hatch patterns
  • SHX fonts & text styles
  • Numbering LISP collection
  • ISO 3098B font

Reference charts

  • AWS weld symbols chart
  • Steel detailing chart
  • Hole & slot sizes
  • Bolt edge distance
  • ANSI & ARCH paper sizes
  • How to fold an A1 drawing

Useful links

  • CAD blocks (DWG)
  • Revit families
  • structuraldrafter.com
  • cad-corner.com
  • About
  • Privacy policy

Provided for free with no warranty · Log in