Documents コレクションを取得します。
サポートされているプラットフォーム: Windows のみ
Documents コレクションを使用すると、現在の AutoCAD セッションのすべてのドキュメントや図面にアクセスできます。
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
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!") ) )