获取文档集合。 支持的平台:仅窗口 言论集合允许您访问当前 AutoCAD 会话中的所有文档或图形。Documents 例子工 务 局: 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 Visual 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-1-8 19:22
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.