カスタム オブジェクトを作成します。
サポートされているプラットフォーム: Windows のみ
VBA:
RetVal = object.AddCustomObject(ClassName)
タイプ: Block、ModelSpace、PaperSpace
このメソッドが適用されるオブジェクト。
アクセス: 入力のみ
タイプ: 文字列
rxClassName を ObjectARX® アプリケーション(ObjectARX DLL)で定義しなかった場合、メソッドは異常終了します。
タイプ: Custom オブジェクト
新しく作成されるカスタム オブジェクト
rxClassName カスタム クラスを定義する ObjectARX DLL をロードしなければなりません。Application オブジェクトで LoadARX メソッドを使用して、ObjectARX ファイルを明示的にロードします。
VBA:
Sub Example_AddCustomObject()
' This example adds a custom object to model space.
' 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"
' Once the application has been loaded successfully,
' add the custom object to model space.
Dim customObj As AcadObject
Set customObj = ThisDrawing.ModelSpace.AddCustomObject("MyNewObject")
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_AddCustomObject()
;; This example adds a custom object to model space.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; 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")
;; Once the application has been loaded successfully,
;; add the custom object to model space.
(setq customObj (vla-AddCustomObject (vla-get-ModelSpace doc) "MyNewObject"))
)