When I try to run this code:
(VLA-SAVE (VLA-ITEM (VLA-GET-DOCUMENTS (VLAX-GET-ACAD-OBJECT)) 1))
(VLA-CLOSE (VLA-ITEM (VLA-GET-DOCUMENTS (VLAX-GET-ACAD-OBJECT)) 1))
where the item returned from the vla-item routine is an inactive, but open drawing I get the following message:
INTERNAL ERROR: VL namespace mismatch
and I have to close AutoCAD using Windows Task Manager.
The VLA-SAVE and VLA-CLOSE commands work with an inactive, open, but empty drawing, so why doesn't it work with the ones that have data in them?
I don't recommend using lisp to close the current drawing anyway so it is probably a good thing the error happens. What are you trying to do? Are you scripting multiple drawings? If so, consider using objectdbx or scriptpro. Avoid closing the current drawing with lisp because the program has not finished its execution and loses its namespace.
No, I'm trying to save or close the inactive drawings, not the active one.
I have written routines that modify dictionary entries and Xdata in the inactive documents based on editing in the active drawing and I'm looking for a reliable way to save those edits. I could always take the long way around and visit each of the documents individually, but it would be so much more convenient to be able to save all the edits at once.
Express Tools has that capability, but I get the same error when I try to use it.
Are you sure that item 1 is not the current drawing? Are you sure that item 1 exists? It won't if AutoCAD only has 1 drawing open.
As you close drawings, the index number of a particular drawing may change. For instance, if you close item 1 of the docs collection, item 2 becomes item 1 but item 0 would not change.
No, the indices are all correct. That was one of the first things that I checked. I have a suspicion that the problem is drawing-specific, possible due to an error in the database. perhaps.