名前の付いたディクショナリにオブジェクトを追加します。
サポートされているプラットフォーム: Windows のみ
VBA:
RetVal = object.AddObject(Keyword, ObjectName)
タイプ: Dictionary
このメソッドが適用されるオブジェクト。
アクセス: 入力のみ
タイプ: 文字列
このオブジェクトのディクショナリにリストされるキーワード。
アクセス: 入力のみ
タイプ: 文字列
ディクショナリに作成されるオブジェクトの rxClassName。
このメソッドは、ObjectName で指定された新しいエントリをディクショナリに追加します。エントリが既に存在している場合、そのエントリが新しいオブジェクトに置き換えられます。オブジェクトの名前は、KeyWord で指定します。
たとえば、ThirdKeyword という Keyword で、オブジェクト タイプが Object3 であるオブジェクトは、次のようにすることで MyDictionary に追加できます。
MyDictionary
Keyword オブジェクト
FirstKeyword Object1
SecondKeyword Object2
ThirdKeyword Object3
VBA:
Sub Example_AddObject()
' This example creates a dictionary and adds
' a custom object to that dictionary.
Dim dictObj As AcadDictionary
Set dictObj = ThisDrawing.Dictionaries.Add("TEST_DICTIONARY")
' Load the ObjectARX application that defines the custom object.
' Note: The application listed here does not exist and
' will cause an error when run. Change the application name
' to the path and name of your ObjectARX application.
ThisDrawing.Application.LoadArx "MyARXApp.dll"
' Create the custom object in the dictionary
Dim keyName As String
Dim className As String
Dim customObj As AcadObject
keyName = "OBJ1"
className = "CAsdkDictObject"
Set customObj = dictObj.AddObject(keyName, className)
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_AddObject()
;; This example creates a dictionary and adds
;; a custom object to that dictionary.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(setq dictionaries (vla-get-Dictionaries doc))
(setq dictObj (vla-Add dictionaries "TEST_DICTIONARY"))
;; Load the ObjectARX application that defines the custom object.
;; Note: The application listed here does not exist and
;; will cause an error when run. Change the application name
;; to the path and name of your ObjectARX application.
(vla-LoadArx acadObj "MyARXApp.dll")
;; Create the custom object in the dictionary
(setq keyName "OBJ1")
(setq className "CAsdkDictObject")
(setq customObj (vla-AddObject dictObj keyName className))
)