Hit a snag while experimenting. The intent was to start from document1, open document2, run a procedure in doc2, return focus to doc1, then close doc2 without saving.
Assuming that we have a pointer *doc1* to the first document, next:
(setq *doc2* (vla-add (vla-get-documents (vlax-get-acad-object)))) to get hold of the second document.
Then a procedure which will be called from *doc2*:
(defun-q test
(<do whatever>)
(vla-activate *doc1*))...which concludes by re-activating *doc1*.
Now a dash of: (vl-propagate 'test)
From *doc1* is invoked:
(command "vbastmt" "documents.item(documents.count-1).sendcommand \"(test) \" ") ....which appears to work fine and return focus to the first document.
But closing from the first document:
(vla-close *doc2* :vlax-false) produces a fatal exception and Acad tanks.
Aside from the obvious lack of error trapping evident in this thumbnail code, how are the two document objects still entwined to produce the fatal error??
Right now I'm toying with more "vbastmt" to try to work around this little hurdle.
Your comments are appreciated.
B.Connoy
Assuming that we have a pointer *doc1* to the first document, next:
(setq *doc2* (vla-add (vla-get-documents (vlax-get-acad-object)))) to get hold of the second document.
Then a procedure which will be called from *doc2*:
(defun-q test
(<do whatever>)
(vla-activate *doc1*))...which concludes by re-activating *doc1*.
Now a dash of: (vl-propagate 'test)
From *doc1* is invoked:
(command "vbastmt" "documents.item(documents.count-1).sendcommand \"(test) \" ") ....which appears to work fine and return focus to the first document.
But closing from the first document:
(vla-close *doc2* :vlax-false) produces a fatal exception and Acad tanks.
Aside from the obvious lack of error trapping evident in this thumbnail code, how are the two document objects still entwined to produce the fatal error??
Right now I'm toying with more "vbastmt" to try to work around this little hurdle.
Your comments are appreciated.
B.Connoy