Wednesday, April 27, 2005

AutoCAD 2006 script bug

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
OPEN "drawing2"

If you find a bug make sure to notify Autodesk of it so it can get fixed.
One way is:

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)")
(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.

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner