CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2021 开发者帮助

Documents 属性 (ActiveX)

2024-5-18 18:33| 发布者: admin| 查看: 27| 评论: 0|原作者: admin|来自: AutoCAD

Documents 属性 (ActiveX)

获取 Documents 集合。

支持的平台:仅限 Windows

签名

VBA:

object.Documents
对象

类型: 应用

此属性应用于的对象。

属性值

只读:是的

类别: 文档

当前 AutoCAD 进程的集合。Documents

言论

该集合允许您访问当前 AutoCAD 任务中的所有文档或图形。Documents

例子

VBA:

Sub Example_Documents()
    ' This example obtains a reference to the Documents collection
    ' and displays information about the loaded documents.

    Dim Document As AcadDocument
    Dim msg As String
    msg = vbCrLf
    
    ' Cycle through the Documents collection and retrieve the names
    ' of the loaded documents
    For Each Document In Documents
        msg = msg & Document.Name & vbCrLf
    Next
    
    ' Display loaded document information
    If Documents.Count > 0 Then
        MsgBox "The loaded documents are: " & msg
    Else
        MsgBox "There are no loaded documents!"
    End If
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_Documents()
    ;; This example obtains a reference to the Documents collection
    ;; and displays information about the loaded documents.
    (setq acadObj (vlax-get-acad-object))
 
    ;; Cycle through the Documents collection and retrieve the names
    ;; of the loaded documents
    (setq msg "")
    (vlax-for Document (vla-get-Documents acadObj)
        (setq msg (strcat msg "\n" (vla-get-Name Document)))
    )
    
    ;; Display loaded document information
    (if (> (vla-get-Count (vla-get-Documents acadObj)))
        (alert (strcat "The loaded documents are: " msg))
        (alert "There are no loaded documents!")
    )
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-6-27 16:13

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部