VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Autocad 2014 / VB.NET ModelSpace error

1 REPLY 1
SOLVED
Reply
Message 1 of 2
rafal.watroba
911 Views, 1 Reply

Autocad 2014 / VB.NET ModelSpace error

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".

 

 

 

1 REPLY 1
Message 2 of 2

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.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost