PDA

View Full Version : Where does AutoCAD store open file list?


jhoffman.203303
2008-12-11, 11:59 PM
Does anyone know where AutoCAD stores the list of open files in single AutoCAD session when multiple files are open? I am sure it is in there somewhere but have not been able to locate it. I want to access the list from within an autolisp program.

Thank you in advance for your help.

irneb
2008-12-12, 08:36 AM
You could try to use the ActiveX objects, e.g.:(setq acad (vlax-get-acad-object)) ;Get AutoCAD ActiveX object
(setq docs (vla-get-Documents acad)) ;Get collection of open documents
(vla-get-Count docs) ;Gets number of open docs
(setq doc1 (vla-Item docs 0)) ;Gets 1st document open
(setq doc2 (vla-Item docs 1)) ;Gets 2nd document open
;; ........

;; Then to get the DWG's filename
(vla-get-Name doc1) ;Get 1st dwg's filename

jhoffman.203303
2008-12-12, 07:25 PM
Thank you so much!!! I knew it was there somewhere but could not put all of the pieces together.

Again THANKS!!

kennet.sjoberg
2008-12-12, 08:50 PM
To get the drawing files in a list, you can use this code

(defun MCDL ( / DrLi FileName ) ; My Curent Drawing List
(vlax-for IAcadDoc (vla-get-documents (vlax-get-acad-object ) )
(setq DrLi (cons (if (/= (setq FileName (vla-get-fullname IAcadDoc )) "" ) FileName (vla-get-name IAcadDoc ) ) DrLi ) )
)
DrLi
)

Usage:
(MCDL)


: ) Happy Computing !

kennet

devitg.89838
2008-12-14, 05:03 PM
Nice routine.
thanks