DeleteConfiguration Method (ActiveX)

Deletes a viewport configuration.

Supported platforms: Windows only

Signature

VBA:

object.DeleteConfiguration Name
object

Type: Viewports

The object this method applies to.

Name

Access: Input-only

Type: String

The name of the viewport configuration to delete.

Return Value (RetVal)

No return value.

Remarks

A viewport configuration consists of a single viewport that has been split using the Split method. Once a viewport has been split, the resulting viewports are considered a viewport configuration. All the viewports in the configuration have the same name as the original viewport before the split.

Examples

VBA:

Sub Example_DeleteConfiguration()
    ' This example creates a new viewport and splits
    ' the viewport into 4 windows.
    ' It then deletes the viewport configuration
    Dim oldViewport As AcadViewport
    Set oldViewport = ThisDrawing.ActiveViewport
       
    ' Create a new viewport and make it active
    Dim newViewport As AcadViewport
    Set newViewport = ThisDrawing.Viewports.Add("TESTVIEWPORT")
    ThisDrawing.ActiveViewport = newViewport
    
    ' Split the viewport in 4 windows
    newViewport.Split acViewport4
    
    ' Make the newly split viewport active
    ThisDrawing.ActiveViewport = newViewport
    MsgBox "The viewport configuration split into 4 windows."

    ' Delete the viewport configuration
    ThisDrawing.ActiveViewport = oldViewport
    ThisDrawing.Viewports.DeleteConfiguration ("TESTVIEWPORT")
    ThisDrawing.Regen acAllViewports
    MsgBox "The viewport configuration has been deleted."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DeleteConfiguration()
    ;; This example creates a new viewport and splits
    ;; the viewport into 4 windows.
    ;; It then deletes the viewport configuration
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq oldViewport (vla-Add (vla-get-Viewports doc) "CurrentViewport"))
       
    ;; Create a new viewport and make it active
    (setq newViewport (vla-Add (vla-get-Viewports doc) "NewViewport"))
    (vla-put-ActiveViewport doc newViewport)
    
    ;; Split the viewport in 4 windows
    (vla-Split newViewport acViewport4)
    
    ;; Make the newly split viewport active
    (vla-put-ActiveViewport doc newViewport)
    (alert "The viewport configuration split into 4 windows.")

    ;; Delete the viewport configuration
    (vla-put-ActiveViewport doc oldViewport)
    (vla-DeleteConfiguration (vla-get-Viewports doc) "NewViewport")
    (vla-DeleteConfiguration (vla-get-Viewports doc) "CurrentViewport")
    (vla-Regen doc acAllViewports)
    (alert "The viewport configurations have been deleted and original viewport restored.")
)