.NET

Reply
Member
Posts: 4
Registered: ‎05-19-2013
Message 1 of 5 (214 Views)

Visual Basic.net dll

214 Views, 4 Replies
11-23-2013 09:05 AM

Good afternoon everyone, I am working with microsoft visual basic 2010 and create aPlugIM Tries to AutoCAD 2013 I can not recreate the ThisDrawing variable, put the reference as attached image, the problem occurs on the line that is red in color soon afterMdiActiveDocument not appear to AcadDocument option to terminate the line I believe it should be missing some dll if anyone else has experienced this and can help me.

 

Public Class AdskCommads
Public ReadOnly Property ThisDrawing() As AcadDocuments
Get
Return Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
End Get
End PropertyDoc1.pdf
End Class

*Expert Elite*
Alfred.NESWADBA
Posts: 8,565
Registered: ‎06-29-2007
Message 2 of 5 (202 Views)

Re: Visual Basic.net dll

11-23-2013 10:53 AM in reply to: marcelogarcia3251

Hi,

 

Public ReadOnly Property ThisDrawing() As AcadDocuments
Get
Return Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
End Get

 

You can only return an object that matches the type of the property, and MdiActiveDocument is completly different to the AcadDocuments type.

So assuming you want to have the COM/ActiveX type that describes your drawing-document (singular! not AcadDocuments) you should change the code to:

 

Public ReadOnly Property ThisDrawing() As AcadDocument
Get
Return CType(Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.AcadDocument, AcadDocument)
End Get

 

HTH, - alfred -

PS: set your property "copy-local" for your reference to AcCoreMgd.dll to false, in your screenshot it looks like it's set to true.

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Member
Posts: 4
Registered: ‎05-19-2013
Message 3 of 5 (186 Views)

Re: Visual Basic.net dll

11-23-2013 01:03 PM in reply to: marcelogarcia3251

Hi,

      thanks for replying worked perfectly for creating the variable ThisDrawing.
          When I run in AutoCAD, it shows me the following message that is in the picture, do not know how to proceed, if you can give me any other tips as I am new to. NET. (See the program code attached)
           Sorry for any errors in English because I live in Brazil.

Mensagem.jpg

*Expert Elite*
Alfred.NESWADBA
Posts: 8,565
Registered: ‎06-29-2007
Message 4 of 5 (181 Views)

Re: Visual Basic.net dll

11-23-2013 01:09 PM in reply to: marcelogarcia3251

Hi,

 

you try to cast an object from type Document (managed) to an AcadDocument (COM/ActiveX object), that does not work that way.

So the next step is to tell the debugger to stop at exceptions ... you can see then in debug-mode what line of code raises that exception.

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Member
Posts: 4
Registered: ‎05-19-2013
Message 5 of 5 (118 Views)

Re: Visual Basic.net dll

11-26-2013 03:35 PM in reply to: marcelogarcia3251

Obrigado. por respomder as minhas dúvidas

Thank you. By respomder my doubts

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
Are you interested in helping shape the Autodesk Community?
We’re looking at a few different ways to improve the “All Forums” landing page and need your feedback! If interested, please take a few minutes to fill out the following Usability Study. Thank you for your time!

Need installation help?

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

Ask the Community