I run into an introduced bug in AutoCAD 2006 today. When using the command Close in a script the execution stops. This didn't happen in AutoCAD 2005.
The below script will stop after running the first close:
OPEN "drawing1"
dosomething here
CLOSE
OPEN "drawing2"
etc.
If you find a bug make sure to notify Autodesk of it so it can get fixed.
One way is: http://www.autodesk.com/submitbug
Update 2005-05-02:
One workaround is to use is to add a space after the CLOSE command so it becomes "CLOSE " instead of "CLOSE". This only works for 2006 so you have to have separate scripts for 2006 and older versions.
Another workaround that works for all versions is to use the code below instead of CLOSE
(command "VBASTMT" "Application.ActiveDocument.Close(False)")
or
(command "VBASTMT" "Application.ActiveDocument.Close(True)")
The first one is if you want to close and don't save the drawing.
The other one is if you want to save the drawing.
Restored comments
ReplyDeleteJan Back said...
Micha wrote an answer in a diskussion group: http://discussion.autodesk.com/thread.jspa?messageID=4814569
The solution does not work correctly that he suggest. You have to know the AutoCAD version and make different scripts:
For AutoCAD 2006: '_close y '
other versions '_close y'
April 29, 2005
JTB World said...
Thanks for the workaround!
April 29, 2005
JTB World said...
This problem is solved in AutoCAD 2006 SP1
November 04, 2005