.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Debugging C# with AutoCAD 2006

10 REPLIES 10
Reply
Message 1 of 11
Anonymous
607 Views, 10 Replies

Debugging C# with AutoCAD 2006

Hi everyone,

I'm writing code in VS2005 (C#) and would like to know if there is a better
why to debug than my current method. Currently, I wrote the code and compile
in VS. Then, I start AutoCAD and use NETLOAD to load the DLL and test my
application. If I find a problem, I go back to VS, change the code,
recompile, restart AutoCAD, etc. This is, to say the least, a rather long
process when I just want to see the results of some "what if" scenarios that
are just part of the process of learning a new programming language.

1) Any suggestions for debugging inside VS with AutoCAD?
2) Can I unload .NET assemblies in AutoCAD 2006 without restarting AutoCAD?
This would save me steps / time involved with restarting AutoCAD / Civil 3D.

Thanks,
Scott
10 REPLIES 10
Message 2 of 11
Anonymous
in reply to: Anonymous

This is the technique I use. There's nothing better. There's no way to
unload .net assemblies that are loaded.

Albert

"Homer Simpson" wrote in message
news:4893081@discussion.autodesk.com...
Hi everyone,

I'm writing code in VS2005 (C#) and would like to know if there is a better
why to debug than my current method. Currently, I wrote the code and compile
in VS. Then, I start AutoCAD and use NETLOAD to load the DLL and test my
application. If I find a problem, I go back to VS, change the code,
recompile, restart AutoCAD, etc. This is, to say the least, a rather long
process when I just want to see the results of some "what if" scenarios that
are just part of the process of learning a new programming language.

1) Any suggestions for debugging inside VS with AutoCAD?
2) Can I unload .NET assemblies in AutoCAD 2006 without restarting AutoCAD?
This would save me steps / time involved with restarting AutoCAD / Civil 3D.

Thanks,
Scott
Message 3 of 11
Anonymous
in reply to: Anonymous

The only step I was able to elimanate was manually typing the he "netLoad" command.
I did this by including a script in my ADT short cut, where in the scipt file, I used the command "_NETLOAD"
Message 4 of 11
Anonymous
in reply to: Anonymous

under the project properties you could eliminate the start AutoCAD step by
setting the "Start external program" to the location of autocad. this
setting is under the debugging properties in that dialog.

Matthew

wrote in message news:4893631@discussion.autodesk.com...
The only step I was able to elimanate was manually typing the he "netLoad"
command.
I did this by including a script in my ADT short cut, where in the scipt
file, I used the command "_NETLOAD"
Message 5 of 11
Anonymous
in reply to: Anonymous

In the Script file you could use an autolisp function. I have not tested
this but you could try it. You can use autolisp in a script file.

(command "netload" "c:/mypath/myfile.dll")

hth
Matthew

"Homer Simpson" wrote in message
news:4893081@discussion.autodesk.com...
Hi everyone,

I'm writing code in VS2005 (C#) and would like to know if there is a better
why to debug than my current method. Currently, I wrote the code and compile
in VS. Then, I start AutoCAD and use NETLOAD to load the DLL and test my
application. If I find a problem, I go back to VS, change the code,
recompile, restart AutoCAD, etc. This is, to say the least, a rather long
process when I just want to see the results of some "what if" scenarios that
are just part of the process of learning a new programming language.

1) Any suggestions for debugging inside VS with AutoCAD?
2) Can I unload .NET assemblies in AutoCAD 2006 without restarting AutoCAD?
This would save me steps / time involved with restarting AutoCAD / Civil 3D.

Thanks,
Scott
Message 6 of 11
Anonymous
in reply to: Anonymous

worked great, thanks!
Message 7 of 11
Anonymous
in reply to: Anonymous

Then set 'startin' to your debug directory, and have an acaddoc.lsp in this
director to netload your app and anything else you need
Message 8 of 11
Anonymous
in reply to: Anonymous

How about using assemblies late binding method. You create a loader class and binding your object class into AutoCAD. I'm just thinking, haven't try. Hope it works!
Message 9 of 11
cgay
in reply to: Anonymous

Here is the method I use.

1.) I create an AutoCAD Script File in my programs source directory.
(i.e. "C:\Projects\TestProj\Load.scr")

2.) I open this file in notepad and add the text to load the dll.
(i.e. _netload C:\Projects\TestProj\bin\TestProj.dll)

3.) In the "Configuration Properties" section of the projects Property Pages, I change the "Start Action" to "Start External Program" and add path to AutoCAD exe, then add the "Command Line arguments" to load the script file.
(i.e. /nologo /b "C:\Projects\TestProj\Load.scr")

This seems to work well for me. You could also add the name of a drawing to open so you don't have to open one up each time you debug.
(i.e. "C:\Drawings\Test.dwg" /nologo /b "C:\Projects\TestProj\Load.scr")

Note that I add the /nologo switch, which seems to load AutoCAD faster.

There are several other command line switches for AutoCAD. Find them in the AutoCAD Help Files, search for "Customize Startup - Concepts".

Good Luck,
C Message was edited by: CougerAC
Message 10 of 11
rtejada
in reply to: Anonymous

Yes, it worked, I manage to add your code, and it is now working fine.

I look that I was missing the CommandFlags.Session part. I was wondering what does it do.

Thanks you very much Couger and Tony.
Message 11 of 11
rtejada
in reply to: Anonymous

Yes, it worked, I manage to add your code, and it is now working fine.

I look that I was missing the CommandFlags.Session part. I was wondering what does it do.

Thanks you very much Couger and Tony.

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost