CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2019 开发者帮助

GetExtensionDictionary 方法 (ActiveX)

2024-5-18 17:51| 发布者: admin| 查看: 100| 评论: 0|原作者: admin|来自: AutoCAD

GetExtensionDictionary 方法 (ActiveX)

获取与对象关联的扩展字典。

支持的平台:仅限 Windows

签名

VBA:

RetVal = object.GetExtensionDictionary
对象

类型:所有图形对象AttributeReferenceBlockDictionaryDimensionDimStyleGroupLayerLayoutLinetypeMaterialMLeaderStylePlotConfigurationRegisteredApplicationTableStyleTextStyleUCSViewViewportXRecord

此方法应用到的对象。

返回值 (RetVal)

类型: 字典

对象的扩展字典。

言论

如果对象没有扩展字典,此方法将为该对象创建一个新的扩展字典,并在返回值中返回它。

可以使用该属性查询对象以查看它是否具有扩展字典。HasExtensionDictionary

例子

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

可视化 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")))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1   苏公网安备32011402011833)

GMT+8, 2024-12-15 11:28

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部