Documents 属性 (ActiveX) 
获取 Documents 集合。 支持的平台:仅限 Windows 言论该集合允许您访问当前 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!")
    )
)
 | 
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
GMT+8, 2025-11-4 23:56
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.