Gets the Viewports collection for the document.
Supported platforms: Windows only
VBA:
object.Viewports
No additional remarks.
VBA:
Sub Example_Viewports()
' This example finds the current Viewports collection and
' adds a new viewport to that collection.
Dim viewportColl As AcadViewports
Set viewportColl = ThisDrawing.Viewports
' Create a viewport named "TEST" in the current drawing
Dim viewportObj As AcadViewport
Set viewportObj = viewportColl.Add("TEST")
MsgBox "A new viewport called " & viewportObj.name & " has been added to the Viewports collection.", vbInformation, "Viewports Example"
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_Viewports()
;; This example finds the current Viewports collection and
;; adds a new viewport to that collection.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(setq viewportColl (vla-get-Viewports doc))
;; Create a viewport named "TEST" in the current drawing
(setq viewportObj (vla-Add viewportColl "TEST"))
(alert (strcat "A new viewport called " (vla-get-Name viewportObj) " has been added to the Viewports collection."))
)