The problem seems to be elementary, but I can't find solution.
After migratting my program (VB.NET using COM) to AutoCAD 2014 (from 2012) I get an error when access Document.ModelSpace (Element not found. (Exception from HRESULT: 0x8002802B (TYPE_E_ELEMENTNOTFOUND)).
I started new, clear solution, added references to:
Autodesk.AutoCAD.Interop.dll
Autodesk.AutoCAD.Interop.Common.dll
I wrote this simple code:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim acad As Autodesk.AutoCAD.Interop.AcadApplication acad = CType(Marshal.GetActiveObject("AutoCAD.Application"), Autodesk.AutoCAD.Interop.AcadApplication) Dim d As Autodesk.AutoCAD.Interop.AcadDocument = acad.ActiveDocument Dim m As Autodesk.AutoCAD.Interop.Common.AcadModelSpace = d.ModelSpace ... End Sub
I still get an error at line "Dim m As Autodesk.AutoCAD.Interop.Common.AcadModelSpace = d.ModelSpace".
Solved! Go to Solution.
Solved by rafal.watroba. Go to Solution.
I found solution.
I needed to change active platform from x86 to AnyCPU.
I don't know why my vb.net started new project with x86 platform.