Tracking currently opened drawings

  • Thread starter Thread starter sdaze
  • Start date Start date
S

sdaze

Is there a variable that stores the drawings that are concurrently opened? I wrote a batch plotting routine that opens a predefined list of drawings, but it crashes if one of the drawings is already open. I need to be able to close specific drawings, or select a drawing if it is already open.

TIA,
Shaye.
 
Shaye,

This might help.

;; return a list of open files with full name
(defun ListOpenDocs (/ documents fname namelst)
(setq documents
(vla-get-documents
(vlax-get-acad-object)))
(vlax-for x documents
(setq fname (vlax-get x 'FullName))
(setq namelst (cons fname namelst))
)
)

Joe Burke

sdaze said:
Is there a variable that stores the drawings that are concurrently opened? I wrote
a batch plotting routine that opens a predefined list of drawings, but it crashes if
one of the drawings is already open. I need to be able to close specific drawings, or
select a drawing if it is already open.
 
Joe,

That worked great! Is there a way to close a specific drawing, or set focus to a drawing that is concurrently opened?

Thanks again,
Shaye.


Reply From: Joe Burke
Date: Sep/09/04 - 09:00 (EDT)

Re: Tracking currently opened drawings
Shaye,

This might help.

;; return a list of open files with full name
(defun ListOpenDocs (/ documents fname namelst)
(setq documents
(vla-get-documents
(vlax-get-acad-object)))
(vlax-for x documents
(setq fname (vlax-get x 'FullName))
(setq namelst (cons fname namelst))
)
)

Joe Burke

br>> Is there a variable that stores the drawings that are concurrently opened? I wrote
a batch plotting routine that opens a predefined list of drawings, but it crashes if
one of the drawings is already open. I need to be able to close specific drawings, or
select a drawing if it is already open.
 
Why don't you open it as read-only. We have a batch plotting routine here.
It checks whether the file is open/read-only then opens it accordingly.

CJ

sdaze said:
Joe,

That worked great! Is there a way to close a specific drawing, or set
focus to a drawing that is concurrently opened?
Thanks again,
Shaye.


Reply From: Joe Burke
Date: Sep/09/04 - 09:00 (EDT)

Re: Tracking currently opened drawings
Shaye,

This might help.

;; return a list of open files with full name
(defun ListOpenDocs (/ documents fname namelst)
(setq documents
(vla-get-documents
(vlax-get-acad-object)))
(vlax-for x documents
(setq fname (vlax-get x 'FullName))
(setq namelst (cons fname namelst))
)
)

Joe Burke

news:[email protected]...< br>>
Is there a variable that stores the drawings that are concurrently opened? I
wrote
 
Shaye,

Both things you mentioned can be done, but they can be a bit tricky. For instance,
take a look at developer help regarding the Close method. You would need to consider
whether the file should be saved, if there are changes. Switching focus from the
active drawing to some other open file is also messy when done programmatically.
Frankly, I'm in over my head here. The issue is the fact the code which does the
switch (makes some open file the active file) is initiated within the namespace of
the currently active file. So the code can't terminate until that file is made the
active file again. Or at least, that's how I understand it.

How you would use the list returned by what I posted depends on your code. You'd have
to post it, if you want to pursue this further.

Joe Burke
Joe,

That worked great! Is there a way to close a specific drawing, or set focus to a
drawing that is concurrently opened?
 
Back
Top