Force Read-only open

Discussion in 'AutoCAD' started by dean_bourke, Feb 17, 2005.

  1. dean_bourke

    dean_bourke Guest

    I know there has been a lot of discussion already on this topic, but is there a way to force a drawing to be opened in read-only mode in SDI?

    Previous posts have supplied the code:
    (defun openRO (fna)
    (vla-activate (vla-open (vla-get-documents (vlax-get-acad-object)) fna :VLAX-TRUE))
    )
    Which is fine for MDI, but won't work in SDI.

    The option I am using at the moment is to use dos_attrib to set the read-only file attribute before opening and reset it after the file is open.

    If there is a more failsafe method, I would love to know.

    Dean
     
    dean_bourke, Feb 17, 2005
    #1
  2. dean_bourke

    mkaufhold Guest

    I have been using something very similar to the code below, and it has been working so far. It opens (or attempts to open) the file with lisp first, and then in AutoCAD.

    (setq r (open dwg "a"))
    (command "._open" dwg "y")
    (if (/= r nil) close r)

    If the drawing is already read-only, it cannot be opened with append and "r" is set to nil. If the drawing is not initially read-only, it will be after you open it with append first.

    Hope this helps. If anyone sees a problem with doing things this way, I'd be interested to hear.

    Thanks.
     
    mkaufhold, Feb 17, 2005
    #2
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.