GetExtensionDictionary 方法 (ActiveX)
获取与对象关联的扩展字典。 支持的平台:仅限 Windows 签名VBA: RetVal = object.GetExtensionDictionary 言论如果对象没有扩展字典,此方法将为该对象创建一个新的扩展字典,并在返回值中返回它。 可以使用该属性查询对象以查看它是否具有扩展字典。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"))) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2024-12-15 11:28
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.