Autocad lisp endless line loop
Static TCHAR szCmdLine = _T(" /nologo /b C:\Test\quit.scr") ĬreateProcess ( _T("C:\Program Files\Autodesk\AutoCAD 2014\acad.exe"), szCmdLine, NULL, NULL, FALSE, DEBUG_ONLY_THIS_PROCESS, NULL,NULL, &si, &pi )
#Autocad lisp endless line loop code#
I decided to share the code in case someone else runs into a similar debugging scenario. I don’t claim to know anything about writing debuggers this is just something I cobbled together after doing a bit of searching on the web. I made this debugger a console app, but it could just as well be a window app. I then used a batch file to run the custom debugger in a loop, thereby starting and quitting AutoCAD each time through the loop. In the end I never got around to trying the debugger switch because I discovered the problem by simply displaying some relevant details in a simple message box when the target exception occurred.Īs you can see, I hardcoded the application path and command line, which includes a script file that simply quit AutoCAD after it started. I had also planned to see if I could suspend the main thread, detach my custom debugger, and manually attach the Visual Studio debugger when my target exception was triggered so that I could utilize the more advanced VS debugger UI. The exception I was interested in always occurred while accessing a memory location that ended in 0x30, so my custom debugger ignores access violations that don’t fit the pattern. With my own custom debugger, I could easily write code to decide at runtime which exceptions to ignore and which were of interest. I needed a way to script the task of starting AutoCAD under the debugger hundreds of times in a row until the exception finally occurred.Īfter some futile attempts to script the Visual Studio debugger, I decided to just write my own custom debugger. If I started AutoCAD manually under the Visual Studio debugger, I had to dismiss those shutdown exceptions manually every time. To make matters worse, AutoCAD was throwing exceptions on shutdown that had nothing to do with my code. Unfortunately, sometimes it took several hundred runs before the exception occurred.
![autocad lisp endless line loop autocad lisp endless line loop](https://i0.wp.com/www.gpslandsurveying.com/wp-content/uploads/2018/01/DISTO3.png)
![autocad lisp endless line loop autocad lisp endless line loop](https://image.slidesharecdn.com/autocadlisp-150315084056-conversion-gate01/95/autocad-lisp-3-638.jpg)
I needed to get the exception while the debugger was attached so I could break the process and analyze the state of memory before AutoCAD’s global exception handler got control. Recently I had to debug an intermittent access violation exception in one of my AutoCAD plug-ins.