GetExtensionDictionary Method (ActiveX)

Gets the extension dictionary associated with an object.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetExtensionDictionary
object

Type: All drawing objects, AttributeReference, Block, Dictionary, Dimension, DimStyle, Group, Layer, Layout, Linetype, Material, MLeaderStyle, PlotConfiguration, RegisteredApplication, TableStyle, TextStyle, UCS, View, Viewport, XRecord

The objects this method applies to.

Return Value (RetVal)

Type: Dictionary

The extension dictionary for the object.

Remarks

If an object does not have an extension dictionary, this method will create a new extension dictionary for that object and return it in the return value.

You can query an object to see if it has an extension dictionary by using the HasExtensionDictionary property.

Examples

VBA:

Sub Example_GetExtensionDictionary()
    ' This example creates a Circle object in model space and
    ' adds a new Extension Dictionary to the Circle object
    
    Dim EDictionary As AcadDictionary
    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    
    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius = 5#
    
    ' Create the Circle object in model space
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)

    ThisDrawing.Application.ZoomAll
    
    MsgBox "Circle object Extension Dictionary state before: " & circleObj.HasExtensionDictionary
    
    ' Create an Extension Dictionary for the new Circle
    Set EDictionary = circleObj.GetExtensionDictionary
    
    MsgBox "Circle object Extension Dictionary state after: " & circleObj.HasExtensionDictionary
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetExtensionDictionary()
    ;; This example creates a Circle object in model space and
    ;; adds a new Extension Dictionary to the Circle object
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Define the Circle object
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius 5)
    
    ;; Create the Circle object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))

    (vla-ZoomAll acadObj)
    
    (alert (strcat "Circle object Extension Dictionary state before: " (if (= (vla-get-HasExtensionDictionary circleObj) :vlax-true) "True" "False")))
    
    ;; Create an Extension Dictionary for the new Circle
    (setq EDictionary (vla-GetExtensionDictionary circleObj))

    (alert (strcat "Circle object Extension Dictionary state after: " (if (= (vla-get-HasExtensionDictionary circleObj) :vlax-true) "True" "False")))
)