HasExtensionDictionary Property (ActiveX)

Determines whether the object has an extension dictionary associated with it.

Supported platforms: Windows only

Signature

VBA:

object.HasExtensionDictionary
object

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

The objects this property applies to.

Property Value

Read-only: Yes

Type: Boolean

Remarks

You can create an extension dictionary for an object, or query an existing extension dictionary by using the GetExtensionDictionary method.

Examples

VBA:

Sub Example_HasExtensionDictionary()
    ' This example will iterate through each object in the current drawing and
    ' determine whether that object has an associated Extension Dictionary
    
    Dim DrawingObject As AcadObject
    Dim ExtensionDictionaryResults As String
    
    ' Make sure this drawing contains objects before continuing
    If ThisDrawing.ModelSpace.count = 0 Then
        MsgBox "There are no objects in the current drawing."
        Exit Sub
    End If
    
    For Each DrawingObject In ThisDrawing.ModelSpace
        ' Determine whether object contains Extension Dictionary
        Select Case DrawingObject.HasExtensionDictionary
            Case True
                ExtensionDictionaryResults = ExtensionDictionaryResults & _
                                             DrawingObject.ObjectName & _
                                             " has an associated Extension Dictionary" & vbCrLf
            Case False
                ExtensionDictionaryResults = ExtensionDictionaryResults _
                                             & DrawingObject.ObjectName & _
                                             " does not have an associated Extension Dictionary" & vbCrLf
        End Select
    Next
    
    MsgBox ExtensionDictionaryResults
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_HasExtensionDictionary()
    ;; This example will iterate through each object in the current drawing and
    ;; determine whether that object has an associated Extension Dictionary
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))
    
    ;; Make sure this drawing contains objects before continuing
    (if (= (vla-get-Count modelSpace) 0)
        (alert "There are no objects in the current drawing.")
        (progn
            (setq ExtensionDictionaryResults "")
	           (vlax-for DrawingObject modelSpace
	               ;; Determine whether object contains Extension Dictionary
	               (cond
                    ((= (vla-get-HasExtensionDictionary DrawingObject) :vlax-true)
                        (setq ExtensionDictionaryResults (strcat ExtensionDictionaryResults
                                                                 (vla-get-ObjectName DrawingObject)
                                                                 " has an associated Extension Dictionary.\n")))
                    ((= (vla-get-HasExtensionDictionary DrawingObject) :vlax-false)
                        (setq ExtensionDictionaryResults (strcat ExtensionDictionaryResults
                                                                 (vla-get-ObjectName DrawingObject)
                                                                 " does not have an associated Extension Dictionary.\n")))
                )
	    )
	    
	    (alert ExtensionDictionaryResults)
        )
    )
)