AddCustomObject 方法 (ActiveX)
创建自定义对象。 支持的平台:仅限 Windows 签名VBA: RetVal = object.AddCustomObject(ClassName) 返回值 (RetVal)类型:自定义对象 新创建的 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
可视化 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"))
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 12:28
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.