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

Visual Basic.net dll

4 REPLIES 4
Reply
Message 1 of 5
marcelogarcia3251
668 Views, 4 Replies

Visual Basic.net dll

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

4 REPLIES 4
Message 2 of 5

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 ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 3 of 5

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

Message 4 of 5

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 ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 5 of 5

Obrigado. por respomder as minhas dúvidas

Thank you. By respomder my doubts

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