So I have this custom Open dialog that I've written in OpenDCL, all is working great.
(http://img98.imageshack.us/img98/541/tmaopencp3.th.png) (http://img98.imageshack.us/my.php?image=tmaopencp3.png)
The dialog gets all our active projects from our Office database & displayed them in my custom open.
Last night we ran into the problem where our web sever went down & of course the custom open wouldn't work because it couldn't find the database.
So I want to update my code to fall back to the standard AutoCAD Open dialog box & exit my code when this happens in the future.
As you know (command ".open") doesn't work with SDI=0, & I don't want to use (getfiled ...)
So does anyone else know of a way to call the standard AutoCAD Open dialog from inside Lsp or maybe VBA?
I guess my last resort would be to write a new OpenDCL "File Dialog Box" if I had to, but I'm hopping I don't have to...
One trick I do is use VL to send a command to the command line...
(vlax-invoke-method (vla-get-ActiveDocument (vlax-get-Acad-Object)) 'SendCommand ".open\n")
YES, you're the man, works perfectly.
That's exactly what I needed. :)
Barry, here's mine - it uses VBA so there's no flipping back to the calling document.
Also if the document is already opened it is set active.
;;; Sub to return the active documnet list
(defun jb:doclist (/ doc docs1)
(vlax-for doc (vla-get-documents (vlax-get-acad-object))
(if (=(vla-get-fullname doc) "")
(setq docs1 (cons (strcase (vla-get-name doc)) docs1)
docs1 (cons doc docs1)
)
(setq docs1 (cons (strcase (vla-get-fullname doc)) docs1)
docs1 (cons doc docs1)
))
)
(reverse docs1)
)
;;; Open a drawing
;;; Requires a full path - checks if file exists
(defun jb:OpenDrawing(name / docs)
(if(not(member "acvba.arx" (arx)))
(arxload (findfile "AcVBA.arx")))
(if (findfile name)
(if (not (setq docs (member (strcase name) (jb:doclist))))
(progn
(command "vbastmt"
(strcat "AcadApplication.Documents.Open "
(chr 34)
name
(chr 34)))
(vla-activate (cadr docs)))
(vla-activate (cadr docs))
)))
Thx JB,
But that only opens a given file: (jb:OpenDrawing "C:\\path\\name.dwg")
I'm trying to display the standard Acad Open Dialog box, so I don't have to open it programiclly.
P.S. on a side note. VBA stopped working on my Vista x64 PC.
I.E. If I try to open the VBA editor or run (arxload (findfile "AcVBA.arx")) it freezes Acad.
Any ideas?
I guess I can re-install Acad.
Ouch! that's right - there is no 64 bit VBA is there. I guess that's where Lisp & OpenDCL has everyone else beat! 8)
Well, I guess that means I'm going to have to find a solution for that one. (I'm still on 2006 BTW).
Ok, re-reading the original post -sorry.