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 Property
End Class
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.
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.
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 -
Can't find what you're looking for? Ask the community or share your knowledge.