.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get All Opened Drawings

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Amremad
483 Views, 2 Replies

Get All Opened Drawings

hello all 

 

i need create an array with variable length and in DocumentCreated event add the new drawing to this array 

some thing like this but i can't complete all code 

 

Dim doc() As Autodesk.AutoCAD.ApplicationServices.Document
Dim WithEvents curDwg As Autodesk.AutoCAD.DatabaseServices.Database = Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.WorkingDatabase

Private Sub DocumentCreated(sender As Object, e As DocumentCollectionEventArgs) Handles DwgIO.DocumentCreated ReDim doc(doc.Count + 1) doc(doc.Length).Database = e.Document.Database End Sub

 thanks

2 REPLIES 2
Message 2 of 3
mzakiralam
in reply to: Amremad

Hi, you can not make array of a document object. If you want to get all the open drawing , you have to use following code:

 

  Dim docs As DocumentCollection = Application.DocumentManager

  You can also find the no of document are open with following code:

 

 Dim docNumber As Integer = docs .Count 

 

Message 3 of 3
Amremad
in reply to: Amremad

    Public Structure OpenedDocuments
        Dim cDocument As Autodesk.AutoCAD.DatabaseServices.Database
        Dim Duration As Integer
    End Structure

    Dim cDocuments(0) As OpenedDocuments
    Private Sub DocumentCreated(sender As Object, e As DocumentCollectionEventArgs) Handles DwgIO.DocumentCreated

        ' Append opened current drawing to the array
        cDocuments(cDocuments.Length - 1).cDocument = e.Document.Database
        ReDim Preserve cDocuments(cDocuments.Length)
    End Sub

 this is my solution and work good

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost