The original "AutoCAD Managed application wizard" is very simple. Only the "Autodesk.AutoCAD.Runtime
" namespace is imported, but the ObjectARX application often needs other namespaces such as "Autodesk.AutoCAD.DatabaseSevices
" and "Autodesk.AutoCAD.ApplicationSevices
". Furthermore, you must type "netload" to load the built assembly.
So, I decided to rewrite the wizard to solve these problems.
Note:There are different versions for Visual Studio 2005/2008 and C#/VB 2008 express edition.In the following demonstration,I will select Visual Studio 2008.
1.Download the suitable version from http://www.codeplex.com/dotnetarx,then unzip it.Double click the .msi setup file,and install the wizard.
2.Invoke Visual Studio 2008 IDE then start a new project. Select the node "ObjectARX" under "Visual C# Projects" and click on the template "AutoCAD Managed CS Project Application" as shown below:
3.Type in a project name, here we enter "Test". Set the location where you want the project to be created. Select OK. The "Managed C# Application Wizard For AutoCAD2008" dialog will then appear.
4.You can select the AutoCAD version,open a drawing when AutoCAD is launched,add the AutoCAD COM reference to your program, and enable Unmaged debugging.
5.Select the tab "Assemblies&Namespaces" and check the checkbox before the name of the assembly and namespace you want to include in your application. Note: "Autodesk.AutoCAD.Runtime
" ,"Autodesk.AutoCAD.DatabaseServices
" ,"Autodesk.AutoCAD.ApplicationServices
", "Autodesk.AutoCAD.EditorInput
" are checked by default because they are often included in the ObjectArx applications, you can uncheck them if your application does not need these namespaces.
6.Select the tab "Class" to add summary description for your application and the common used variables such as db,ed,and trans.
7.Click "Finish" to accept the settings you have selected.
8.Press F5 to debug your application,the correct version of AutoCAD will be launched.You don't need to type "netload",just type the command name you will get the result!