VLisp hopping between active docs.

-BMC-

Usenet Archive
Joined
Sep 8, 2003
Messages
5
Reaction score
0
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
 
.... note, that for sake of brevity I wrote:
(defun-q test
(<do whatever>)
(vla-activate *doc1*))<-- when in practise this would be:

(vla-activate (vla-item (vla-get-documents (vlax-get-acad-object)) 0)))

BMC
 

Member Recommended

The Humanoids: A Novel
Price
$12
Change
0%
Humbled by a Humanoid Cliff ·
Data Converters
Price
$103
Change
0%
QuickCAD 8
Price
–
Change
–
Autocad "Lite" RobbieB ·
Back
Top