I am admittingly new to vb.net but was fiarly versed in VB6
I wrote much in lisp and vb (within ACAD) and am now trying my first external app (external to AUtocad) and just want to send a simple command and then build upon it from there.
I am using vb.net 2005 ide.
Autocad 2007
I have added references to:
Autocad 2007 Type Library
AutoCAD/ObjectDBX Common 17.0 Type Library
in Project > Add Refence
I have a simple form with 2 buttons and the entire code is below. Here is the problem, with the code below I get
"error: Autodesk.AutoCAD.ApplicationServices is not a member of AutoCAD" so I found somewhere I should add to references to acmgd.dll and acdbmgd.dll (copying local) and that error goes away, BUT when I click either button I get a program error that closes the app (running in VB IDE) that says "The specified module could not be found. (Exception from HRESULT: 0x8007007E)" and "A first chance exception of type 'system.io.filenotfoundexception' occurred in acadtest.exe"
I know this is prob. my lack of knowledge but I am really trying and spent all day yesterday researching it with no success. The 2 dlls I reference I have tried referencing them as local=true and false with same result. I have added IMPORTS statements at top until all were named with no success. The error points to the TestSendCommand sub. I try it with acad running and not running with same result. Please please please at least point me in correct direction.
Imports Autodesk
Imports Autodesk.AutoCAD
Imports Autodesk.AutoCAD.Interop
Imports Autodesk.AutoCAD.Interop.Common
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.DatabaseServices
Public Class frmMain
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Public Sub TestSendCommand(ByVal cmd As String)
Dim app As AcadApplication = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication
cmd = "ORTHO " & cmd & " "
app.ActiveDocument.SendCommand(cmd)
End Sub
Private Sub btnOrthoOn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOrthoOn.Click
TestSendCommand("ON")
End Sub
Private Sub btnOrthoOff_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOrthoOff.Click
TestSendCommand("OFF")
End Sub
End Class