Function Entry: VPORTS

← Prev | ↑ Chapter | Next → | Index | Symbols

Function Entry: VPORTS

Name

vports

Class

Function

Syntax

(vports)

Arguments and Values

None.

Description

Returns a list of viewport descriptors for the current viewport configuration. The shape of the result depends on the TILEMODE system variable: tiled viewports (VPORTS command) when TILEMODE is 1, floating viewports (MVIEW command) when TILEMODE is 0. When TILEMODE is off, viewport number 1 is always paper space.

Return Values

A list of viewport descriptors. Each descriptor is (viewport-id (lower-left) (upper-right)). With TILEMODE on, the corners are values in [0.0, 1.0] relative to the display screen. With TILEMODE off, the corners use paper-space coordinates. The current viewport's descriptor is always first in the list.

Side Effects

None.

Examples

  • A single viewport with TILEMODE on: ((1 (0.0 0.0) (1.0 1.0))).
  • Four equal tiled viewports:

    ((5 (0.5 0.0) (1.0 0.5))
     (2 (0.5 0.5) (1.0 1.0))
     (3 (0.0 0.5) (0.5 1.0))
     (4 (0.0 0.0) (0.5 0.5)))
    
  • The implementations do not match these examples (the vendor page's, kept as published; see Source Notes and Vendor Divergence). Measured on AutoCAD 2022 and BricsCAD V25/V26, a new drawing's only tiled viewport is number 2, so the single-viewport answer is ((2 (0.0 0.0) (1.0 1.0))); and -VPORTS 4 on it numbers the pieces differently on each product:

    AutoCAD 2022:  ((2 (0.5 0.0) (1.0 0.5)) (3 (0.5 0.5) (1.0 1.0))
                    (4 (0.0 0.5) (0.5 1.0)) (5 (0.0 0.0) (0.5 0.5)))
    BricsCAD:      ((2 (0.0 0.0) (0.5 0.5)) (3 (0.5 0.0) (1.0 0.5))
                    (4 (0.0 0.5) (0.5 1.0)) (5 (0.5 0.5) (1.0 1.0)))
    

Availability

  • AutoCAD 2026: documented.
  • BricsCAD V26: presumed compatible.
  • Status: AutoCAD documented; BricsCAD presumed-both pending Phase 4 verification.

Vendor Divergence

Measured 2026-10-05 by probes/sources/probe-viewports.lsp (AutoCAD 2022 job 16937174509, BricsCAD V25 Windows job 16937174513, BricsCAD V26 macOS job 16937174510). Both products agree on:

  • a new drawing's only tiled viewport is number 2, and CVPORT is 2: ((2 (0.0 0.0) (1.0 1.0))) – not the 1 of the example above;
  • the current viewport comes first;
  • with TILEMODE 0, CVPORT is 1 and the list is the sheet, viewport 1, then the layout's floating viewport, (2 (25.7 19.5) (231.3 175.5)).

They differ on:

  • -VPORTS 2 Vertical: the current viewport keeps the right half under AutoCAD (((2 (0.5 0.0) (1.0 1.0)) (3 (0.0 0.0) (0.5 1.0)))), the left one under BricsCAD (((2 (0.0 0.0) (0.5 1.0)) (3 (0.5 0.0) (1.0 1.0))));
  • -VPORTS SIngle: AutoCAD keeps the lowest-numbered viewport other than the current one (after the split above: 3, and CVPORT becomes 3), BricsCAD the lowest-numbered one (2);
  • the other -VPORTS options (suite vports-options, jobs 16941077236 / 16941077240 / 16941077237) divide the current viewport the same way on both, the current one keeping a different piece, and new viewports take the smallest unused numbers; (vports) lists the current one, then the others by number. Pieces, current one first:

    option AutoCAD 2022 BricsCAD V25 / V26
    2 V right, left left, right
    2 H top, bottom bottom, top
    3 V right, left, middle left, middle, right
    3 H top, bottom, middle bottom, middle, top
    3 Above top, BL, BR top, BL, BR
    3 Below bottom, TR, TL bottom, TL, TR
    3 Left left, RT, RB left, RB, RT
    3 Right right, LT, LB right, LB, LT
    4 BR, TR, TL, BL BL, BR, TL, TR

    The default orientation is Vertical for 2 and Right for 3. Toggle maximises the current viewport and a second Toggle restores the layout; (setvar "CVPORT" n) makes viewport n current; Save NAME adds a VPORT table record NAME, Restore NAME rebuilds the layout (the current number on the saved current piece, the smallest unused ones on the rest), Delete NAME removes the record;

  • the sheet's corners with TILEMODE 0 (display extents): AutoCAD (0.0 0.0) (15.8893 9.0), BricsCAD (-28.613 -13.59) (285.613 208.59).

clautolisp

cador keeps each drawing's tiled viewports and implements every measured -VPORTS option: 2, 3 and 4 with each orientation, SIngle, Toggle, Save, Restore and Delete, and (setvar "CVPORT" n); the probe's answers are a regression test (multidocument-tests). Join was not measured (it picks viewports) and changes nothing. The BricsCAD dialects follow BricsCAD; every other dialect follows AutoCAD. CVPORT is derived (1 in paper space, else the current tiled viewport). The host nihil has no viewports: (vports) signals :host-not-supported there.