We have a program that basically prints drawings to 11x17. It worked perfectly in AutoCAD 2011. I made the changes to how it opens the drawings as per the documentation for upgrading the program to 2013. It works fine for the first two drawings but then AutoCAD just completely shuts down with no error message or anything. I have tried to determine where the close happens by inserting messageboxes but have had no luck.
Some background on the program:
It is just a basic form with a timer. When the timer reaches 0, it reads the drawing name from a file. AutoCAD opens the drawing and prints it. Then it closes the drawing, restets the timer and waits until it reaches 0. SDI is set to 0 so closing the drawing should not affect it. As I said, it has worked perfectly for years under 2011. It is written in C#.
Well, I spoke to soon. That worked great on my 64bit machine but when I recompiled it, after changing the references, for my 32 bit machine it is still crashing after just 2 drawings. Anyone have any thoughts? (besideds just use the 64 bit because my plot servers are 32 bit)
Sorry for the delay.
It is hard to say what might be causing it to crash after two drawings.
If you still have the issue, can you please provide a trimmed down version of your sample project to reproduce the issue ?
Thanks for the reply. The routine uses the simple plot from through-th-interface (http://through-the-interface.typepad.com/through_t
For some reason it does not like me attaching either the .cs files or a zip file so I printed them to PDF.
I was reviewing the code that you shared. I couldnt find any obvious issues, but here are few things to check :
1) Calling the "run_autocad()" that command inside the "Timer_Loop" can be problematic if you are not using the "System.Windows.Forms.Timer". Can you please try using a hidden form as explained in this blog post ?
2) Can you please try looping through a set of drawings in a "for" loop instead without the use of the timer and then call the "SimplePlot" method to do the plotting ? Does it crash after looping through two drawings ? This can help identify whether the issue is related with the timer or something to do with the actual plotting itself.
Thank you for the response. As I said, this program was/is currently working for AutoCAD 2011 with no problems. These problems did not start until I updated it to AutoCAD 2013 and the new core stuff.
The timer is a System.Windows.Forms.Timer.
I tested with the for loop. I had it run through 4 drawings a few times. Once the for loop finishes, AutoCAD completely shuts down and disappears. It does that in both the debugger and when AutoCAD is run on its own. I changed the program so that the loop is controlled by a button click. I changed the loop to only do 2 drawings and it did fine the first time but crashed when I clicked the button a second time. If I took the loop out and just had the button click do the "run_autocad" it crashed after the second drawing was printed.
In the debugger, it shows "A first chance exception of type 'System.NotImplementedException' occured and that is has excited with code 0 (0x0).
I am sorry, it is difficult to say what might be causing it without reproducing it on my system.
If possible, can you please share a non-confidential buildable sample project for me to try and reproduce the same behavior ?
Sorry it took me so long to get back to you. There isn't anything confidential it is just very tailored for the way we work. I will see what I can do and gladly upload it. Thanks for your help.