MaxActiveViewports Property (ActiveX)

Specifies the maximum number of active viewports.

Supported platforms: Windows only

Signature

VBA:

object.MaxActiveViewports
object

Type: DatabasePreferences

The object this property applies to.

Property Value

Read-only: No

Type: Integer

The maximum number of active viewports; 2 <= MaxActiveViewports <= 48

Remarks

Inactive viewports are blank, so their contents are not regenerated. You can, therefore, improve performance by specifying a low value. The initial value is 48.

Note: The value of this property is stored in the MAXACTVP system variable.

Examples

VBA:

Sub Example_MaxActiveViewports()
    ' This example returns the current setting of
    ' MaxActiveViewports. It then changes the value, and finally
    ' it resets the value back to the original setting.
    
    Dim currMaxActiveViewports As Integer
    Dim newMaxActiveViewports As Integer
    
    ' Retrieve the current MaxActiveViewports value
    currMaxActiveViewports = ThisDrawing.preferences.MaxActiveViewports
    MsgBox "The current value for MaxActiveViewports is " & currMaxActiveViewports, vbInformation, "MaxActiveViewports Example"
    
    ' Change the value for MaxActiveViewports
    newMaxActiveViewports = 20
    ThisDrawing.preferences.MaxActiveViewports = newMaxActiveViewports
    MsgBox "The new value for MaxActiveViewports is " & newMaxActiveViewports, vbInformation, "MaxActiveViewports Example"
    
    ' Reset MaxActiveViewports to its original value
    ThisDrawing.preferences.MaxActiveViewports = currMaxActiveViewports
    MsgBox "The MaxActiveViewports value is reset to " & currMaxActiveViewports, vbInformation, "MaxActiveViewports Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MaxActiveViewports()
    ;; This example returns the current setting of
    ;; MaxActiveViewports. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))  
    (setq preferences (vla-get-Preferences doc))
    
    ;; Retrieve the current MaxActiveViewports value
    (setq currMaxActiveViewports (vla-get-MaxActiveViewports preferences))
    (alert (strcat "The current value for MaxActiveViewports is " (itoa currMaxActiveViewports)))
    
    ;; Change the value for MaxActiveViewports
    (setq newMaxActiveViewports 20)
    (vla-put-MaxActiveViewports preferences newMaxActiveViewports)
    (alert (strcat "The new value for MaxActiveViewports is " (itoa newMaxActiveViewports)))
    
    ;; Reset MaxActiveViewports to its original value
    (vla-put-MaxActiveViewports preferences currMaxActiveViewports)
    (alert (strcat "The MaxActiveViewports value is reset to " (itoa currMaxActiveViewports)))
)