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.

1 comment:

  1. Restored comments

    Jan Back said...

    Micha wrote an answer in a diskussion group:

    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


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 | Website General Terms of Use | Privacy Policy
^ Top of page

© 2004- JTB World. All rights reserved.