Is there a way to debug my code using AutoCAD without having to exit and re-launch it again?
if you demand load you can avoid the netload process
And for debugging you better not demand load it. Else it points to the debug version and never will load the release version.
It is possible to start AutoCAD in the debug process and you can give a parameter /b with a script file. So AutoCAD loads the script file after starting up. In that script file you put the lines NETLOAD and the file name of your dll.
That case you can stop debugging and start again without typing the NETLOAD command all the time.
I found a class in ADN examples that auto register the app, but I think it would not update the path if the dll file is registered yet. Personally I use this class but don't call this class if in debug mode, but on the other hand it is better to change the path if it is netloaded again. Your solution is better (but you knew that ;-) )
On the other hand, I am slightly changing my mind about auto register apps, since the new autoload system of AutoCAD also updates the registry all the time. I now register dlls when someone installs my app. Then I don't need to call the class when running.
I believe my ExtensionApplicationInfo has been posted here. If not and someone would like it, I can post it.
... another one of Tony's which I'll reference since he hasn't visited here much recently.
ExtensionApplicationInfo.zip
in this thread :
http://forums.autodesk.com/t5/NET/Netload-help/m-p/2736243/highlight/true#M20202
I believe my ExtensionApplicationInfo has been posted here. If not and someone would like it, I can post it.... another one of Tony's which I'll reference since he hasn't visited here much recently.
ExtensionApplicationInfo.zip
in this thread :
http://forums.autodesk.com/t5/NET/Netload-help/m-p/2736243/highlight/true#M20202
I will save you the trouble Tony,
Attached is Tony's ExtensionApplicationInfo
Methinks 'the best way' of loading one's assembly should depend on the nature of the code... You don't want to NETLOAD an assembly that hooks RibbonServices.RibbonPaletteSetCreated Event to fully initialize, as by the time you're able to enter NETLOAD that event has already come and gone.
Methinks 'the best way' of loading one's assembly should depend on the nature of the code... You don't want to NETLOAD an assembly that hooks RibbonServices.RibbonPaletteSetCreated Event to fully initialize, as by the time you're able to enter NETLOAD that event has already come and gone.
There seems to be a lot of confusion about ribbon initialization. It's pretty simple, and you don't have to concern yourself with how/when your app is loaded.
If when your app is loaded, the ribbon exists, then you add a handler to the Application.Idle event, and the first time the event fires, you remove the Idle event handler so it doesn't fire again, and you initialize your ribbon components.
If upon loading of your app the ribbon doesn't exist, then you hook the RibbonPalleteSetCreated event. If/when that event fires, you add a handler to the Application.Idle event, and when that event fires, remove that handler from the Idle event and initialize your ribbon components.
So, in all cases, you are doing initialization in a handler for the Idle event, and the only question is when to add the Idle event handler, which depends on whether the ribbon exists when your app is loaded.
I haven't seen a case where that fails, including when the ribbon exists but is not visible. If there is some issue with the initializing your ribbon components when the ribbon isn't visible, I'd like to know about it, as that would seem to be the only possible gotcha in this case.
either the Script (/b switch), or dropping an Acad.lsp in your ..\Debug\ folder should do the trick...
netload "C:\---Path to Codez---\$projectname$\$projectname$\bin\Debug\ACAD2013\$projectname$Acad2013.dll"
Note you need a new-line at the end of the .scr file.