| Get Started With AutoCad and VB.NET |
|
|
|
| Tutorials | |
|
Using Visual Basic 2008 Express Edition you can create applications that can communicate with AutoCad. Download Visual Basic 2008 Express from the microsoft site for free (here). NOTE you do need the ObjectArx to complete this tutorial. 1. OPEN VISUAL BASIC .NETOpen .NET and select Class Library. ![]() "Impression of the New Project Window" 2. SELECT SHOW ALLOn the right in the Solution Explorer select the Show All button. (If the Solution Explorer is not visible then hit CTRL+ALT+L). ![]() "Show All Button"
This will make the Reference tab visible. 3. SHOW REFERENCE WINDOWRight Click the Reference tab and select "Add Reference".
4. SELECT AUTOCAD REFERENCEIn the reference window goto the BROWSE tab and browse to your AutoCad installation folder and add acdbmgd.dll and acmgd.dll. Both files are located in the C:\Program Files\AutoCad XXXX\ directory)
"Reference Window" 5. IMPORT NAMESPACESIf you do not want to fully qualify everything then you can import the namespaces. Add the namespaces below to your class. Imports Autodesk.AutoCAD.Runtime
6. READY FOR PROGRAMMING Now that all references are set and namespaces are imported you can use VB.NET to communicate with AutoCad. Add the code below to a class or Form with commandbutton to test the application. Imports Autodesk.AutoCAD.Runtime
tarted With Autocad If this window appears then the tutorial has been succesfull! Well Done...
Public Class Class2 Public Function StartAutoCADSession() As Object '********************************************* On Error Resume Next Dim AcadApp As Object If Err.Number <> 0 Then 'if successful set visibility status End Function Sub TestNETprogram() Dim AcadApp As Object AcadDoc = AcadApp.Activedocument prompt1 = vbCrLf & "Enter block insert point: " MsgBox("You have selected the folowing coordinates:" _ End Class
![]() "Set Reference"
|








Comments
RSS feed for comments to this post