.NET

.NET

Reply
Active Member
inner_es
Posts: 8
Registered: ‎02-03-2010
Message 1 of 3 (349 Views)
Accepted Solution

changes in DocumentCollectionEventArgs in 2013

349 Views, 2 Replies
10-04-2012 11:35 PM

this code used to work in AutoCAD 2007-2012, but not in 2013

 

    xAcad = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication
    ThisDrawing = xAcad.ActiveDocument

    Public Sub AddDocumentToBeDestroyedEvent()
        Try
            AddHandler Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.DocumentToBeDestroyed, AddressOf subDocumentToBeDestroyed
        Catch
        End Try
    End Sub

    Public Sub subDocumentToBeDestroyed(ByVal senderObj As Object, ByVal docColDocActEvtArgs As DocumentCollectionEventArgs)
        '::::::::::::::::::::::::::::::::::::::::
        Try

            If ThisDrawing Is docColDocActEvtArgs.Document.AcadDocument Then
                

            Else

            End If
        Catch ex As System.Exception
            MsgBox("Error en docColDocAct: " & ex.Message)
        End Try
    End Sub

 

it sends the error 'AcadDocument' is not a member of 'Autodesk.AutoCAD.ApplicationServices.Document'

 

anybody knows the new way to check in both documents are equal?

Hi,

 

>> it sends the error 'AcadDocument' is not a member of

>> 'Autodesk.AutoCAD.ApplicationServices.Document'

Use this code for 2013 the get the COM-object of the AutoCAD-document (im my snippet: AcadDoc)

Imports Autodesk.AutoCAD

...

CType(ApplicationServices.DocumentExtension.GetAcadDocument(AcadDoc), Interop.AcadDocument)

 

- alfred -

*Expert Elite*
Alfred.NESWADBA
Posts: 9,583
Registered: ‎06-29-2007
Message 2 of 3 (342 Views)

Hi,Re: changes in DocumentCollectionEventArgs in 2013

10-05-2012 12:22 AM in reply to: inner_es

Hi,

 

>> it sends the error 'AcadDocument' is not a member of

>> 'Autodesk.AutoCAD.ApplicationServices.Document'

Use this code for 2013 the get the COM-object of the AutoCAD-document (im my snippet: AcadDoc)

Imports Autodesk.AutoCAD

...

CType(ApplicationServices.DocumentExtension.GetAcadDocument(AcadDoc), Interop.AcadDocument)

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Active Member
inner_es
Posts: 8
Registered: ‎02-03-2010
Message 3 of 3 (330 Views)

Re: Hi,Re: changes in DocumentCollectionEventArgs in 2013

10-05-2012 08:30 AM in reply to: Alfred.NESWADBA

yep, this work

 

            If ThisDrawing Is CType(Autodesk.AutoCAD.ApplicationServices.DocumentExtension.GetAcadDocument(docColDocActEvtArgs.Document), Autodesk.AutoCAD.Interop.AcadDocument) Then

thanks a lot

 

regards

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.