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
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.

3 comments (add your comment):

Jan 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'

JTB World said...

Thanks for the workaround!

JTB World said...

This problem is solved in AutoCAD 2006 SP1

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner

Contact Us | About JTB World | Subscribe to this blog | JTB World's website
^ Top of page

© 2004-2008 JTB World. All rights reserved.