CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

AddCustomObject Method (ActiveX)

2023-1-4 13:28| 发布者: admin| 查看: 441| 评论: 0|来自: AutoCAD

摘要: 创建自定义对象。

创建自定义对象。

支持的平台:仅窗口

签名

工 务 局:

RetVal = object.AddCustomObject(ClassName)
对象

类型:模型空间,图纸空间

此方法适用的对象。

类名

访问:仅输入

类型:字符串

必须在 ObjectARX 应用程序 (ObjectARX®DLL) 中定义 rxClassName,否则该方法将失败。

返回值(RetVal)

类型:自定义对象

新创建的自定义对象。

言论

必须加载定义 rxClassName 自定义类的 ObjectARX DLL。在应用程序对象上使用 LoadARX 方法显式加载 ObjectARX 文件。

例子

工 务 局:

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"))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-11 21:19

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部