Check if drawing is open

Discussion in 'AutoCAD' started by T.Willey, Nov 2, 2004.

  1. T.Willey

    T.Willey Guest

    I have a lisp that will open an x-ref. What happens is the person will pick the x-ref, then it will open and make it current. All works perfect, except if the drawing is open by someone else. If you have it open, it just switches to make it the current drawing in AutoCAD. I have seen some answers, but they require other programs. I was hoping that this could be done with just the tools AutoCAD gives, ie. lisp vlisp ActiveX.

    Any help is appreciated.
    Tim
     
    T.Willey, Nov 2, 2004
    #1
  2. T.Willey

    Jeff Mishler Guest

    Here's a quick 'n dirty method.....returns T if a drawing is open, nil
    otherwise

    (defun fileopen? (fname / temp)
    (if (setq temp (open fname "a"))
    (progn ;it's appendable so it's not open
    (close temp)
    nil
    )
    (progn ;else it's read only so it's open
    t
    )
    )
    )
     
    Jeff Mishler, Nov 3, 2004
    #2
  3. T.Willey

    T.Willey Guest

    Jeff,

    Thanks, I looked at that, and tried (open "filename" "w") and almost lost my work. Didn't think to try it with "a". Oh well, alls well that ends well, and this one ended well.

    Tim
     
    T.Willey, Nov 3, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.