Once a solution and project
are created, a namespace and class are defined, and one or more
command or AutoLISP® function
structures are implemented, you can use the NETLOAD command to load
a .NET assembly into AutoCAD.
Use the Debug Environment
Prior to loading a .NET
assembly, you should determine if you need to use the Debug environment
of Microsoft Visual Studio to test any logic defined in the procedures
and functions you might have created. The Debug environment allows
you to step through the code in the .NET assembly as it is being executed
in real-time. As the code is being executed, you are able to check
the values of variables and watch which logic paths of the program
are executed.
For more information
on using the Debug environment, see the documentation that comes
with your development environment.
Procedures
To load a .NET Assembly through Debug
Mode in AutoCAD
- In Microsoft Visual Studio, Solution
Explorer, right-click the project you want to load into AutoCAD.
Click Properties.
- In the <Project> Properties tab,
click the Debug tab.
- On the Debug tab, under Start Action,
click Start External Program and then click the ellipsis button
to the right of the text box.
- In the Select File dialog box, browse
to C:\Program Files\Autodesk\AutoCAD 2012 and
select acad.exe. Click Open.
- With the project selected in the Solution
Explorer, click Debug menu > Start Debugging.
- In AutoCAD, at the Command prompt,
enter netload and press Enter.
- In the Choose .NET Assembly dialog box,
browse to the debug version of the assembly file. Click Open.
TipThe location of the
built assembly file is in the Output pane in Microsoft Visual Studio.
- At the Command prompt, enter the name
of the command or AutoLISP function and any required parameters.
To load a .NET assembly in AutoCAD with
NETLOAD
- In Microsoft Visual Studio, with a solution
or project open, click Build menu
Build Solution or Build <Project name>.
- In AutoCAD, at the Command prompt,
enter netload and press Enter.
- In the Choose .NET Assembly dialog box,
browse to the built assembly file. Click Open.
TipThe location of the
built assembly file is in the Output pane in Microsoft Visual Studio.
- At the Command prompt, enter the name
of the command or AutoLISP function and any required parameters.