.NET

Reply
Mentor
Amremad
Posts: 209
Registered: ‎08-24-2010
Message 1 of 3 (115 Views)
Accepted Solution

Get All Opened Drawings

115 Views, 2 Replies
02-11-2014 05:01 AM

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

Mentor
mzakiralam
Posts: 221
Registered: ‎11-09-2012
Message 2 of 3 (108 Views)

Re: Get All Opened Drawings

02-11-2014 05:59 AM 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 

 

Mentor
Amremad
Posts: 209
Registered: ‎08-24-2010
Message 3 of 3 (70 Views)

Re: Get All Opened Drawings

02-12-2014 04:03 AM 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community