What you are trying to do is generally considered
unsound. Are you expecting your code to pause
and wait for the script to complete?
The call to acedPostCommand() passes the
input to the command line, and returns before
AutoCAD executes the command input. Hence
your code continues to run asynchronously, it
does not stop and wait for the script to finish.
One obvious problem you have is that opening
and closing documents are things that cannot be
done from the document execution context.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com
wrote in message news:5338535@discussion.autodesk.com...
VB.net 2005 exe and AutoCAD 2006
I need to open a drawing, run a lisp script, and close AutoCAD without saving the drawing. The lisp script runs anywhere from 30 seconds to several hours.
The problem I'm having is that AutoCAD is not closing after the script has completed. If I remove the call to start the script, AutoCAD exits, but not after running the script. Must be a timing issue. Can someone help me? Here's the code I'm using:
Application.DocumentManager.Open("C:\myDrawing.dwg")
Application.SetSystemVariable("filedia", 0)
acedPostCommand("(load ""\\script"") ")
Application.SetSystemVariable("filedia", 0)
Application.DocumentManager.MdiActiveDocument.CloseAndDiscard()
Application.Quit()