Community
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
Solved! Go to Solution.
Solved by Amremad. Go to Solution.
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
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.