Open a .dwg and then converting to "read-only"

Open a .dwg and then converting to "read-only"

barry2104
Collaborator Collaborator
17,172 Views
12 Replies
Message 1 of 13

Open a .dwg and then converting to "read-only"

barry2104
Collaborator
Collaborator

I often find myself opening an Xref inside my drawing to check something in said Xref. I open the xref and then after playing around with it for 5 minutes, I realise that it's not read-only and that if i mistakenly save my play-around edits, someone is going to get angry.

 

Is it possible to open a file normally and then whilst the file is open, convert it to a "read only" status so that no changes can be saved? Perhaps by use of a lisp?

 

doesn't sound like it would be very difficult but then again I don't know much about how to write a lisp... Any help appreciated

Running AutoCAD Architecture 2020, in German
0 Likes
17,173 Views
12 Replies
Replies (12)
Message 2 of 13

wispoxy
Advisor
Advisor

One of these type of systems is DwgLock. Unfortunately not free, but most of these ARX addons wouldn't be free.

0 Likes
Message 3 of 13

drjohn
Advisor
Advisor

Another easy way would be to mark it as read-only in win explorer properties. But that only works before you open the file.

 

2 cents

 

 

HTH

 

Regards,

DJ

 

0 Likes
Message 4 of 13

dmfrazier
Advisor
Advisor

Is it possible to open a file normally and then whilst the file is open, convert it to a "read only" status so that no changes can be saved? Perhaps by use of a lisp?

 

This is certainly possible, but even with that, you still have the potential to accidentally save the file before the LISP is used, particularly if you are prone to losing track of what you are doing.  To avoid that, perhaps one could devise/define a replacement for the XOpen command which functions as you wish by transparently setting the read-only attribute on the file before opening it. You'd either train yourself to use it instead of the real XOpen command or XOpen could be re-defined to run the custom routine instead - depending on whether or not you ever have to use XOPen to actually modify an XRef.

 

I think a better strategy would be for your workgroup/office to define roles which include per-user (or per-group) modification rights and restrictions which can be applied to specific (presumably network) folders where the XRefs are stored.

0 Likes
Message 5 of 13

Anonymous
Not applicable

Opp never mind didnt read the question correctly

0 Likes
Message 6 of 13

barry2104
Collaborator
Collaborator

I'm aware of how to open a .dwg as "read only" via explorer or within autocad. I was hoping to simply save navigation time by using a lisp AFTER opening it normally to continue to stuff around as read-only

Running AutoCAD Architecture 2020, in German
0 Likes
Message 7 of 13

wispoxy
Advisor
Advisor

How to Save AutoCAD Drawing as Read Only is quite a difficult way to answer. The only way to answer this question is by giving different options for the user to Save AutoCAD Drawing as Read Only. Let’s see some of them below.


Save AutoCAD Drawing as Read Only
Some of the different methods are listed below please choose which is appropriate in your case.

Method 1 – Use Save As AutoCAD Drawing Files as DXF, by this method you actually prevent the user to make any changes to your drawing files. Making the Drawing as Read-Only Files

Method 2 – Ideally you could right click on the drawing file icon (once saved), go to properties and tick read only. Ahh, well that doesn’t “lock” the drawing or anything. they can still edit it, do a Save As, or simply uncheck the Read Only option for the file once they have it.

Method 3 – In case you are on a Network, you can request your Network Administrator to make a READ only Folder and put all the files into it – Eg., READ capabilities but not WRITE capabilities. that way it’ll never be altered, and the file can still be used for Inserting blocks. However, here if you use the explode blocks this will come back into action.

Method 4 – Although there are different ways to do a Read Only format, one simple method is to have your AutoCAD Drawing converted into a Pdf file, there by making all your AutoCAD Drawings Read-Only Mode as you cannot edit the Pdf files and can open in a standard acrobat reader.

0 Likes
Message 8 of 13

dmfrazier
Advisor
Advisor

OP stated: "I often find myself opening an Xref inside my drawing to check something in said Xref. I open the xref..."

 

Bear in mind that the question was whether or not it is possible to change the read-only status (preferably "automatically") of a file that has been opened using the XOpen function.

 

I hadn't thought of this before, but it would probably also be necessary to set the file attributes back to what they were when the user is done with the "play-around edits" (because apparently some in the workgroup are responsible for modifying the files).

 

Use of the XEDIT system drawing variable within the workgroup might be another option for the OP. 

0 Likes
Message 9 of 13

steve216586
Advisor
Advisor

The most simple way I can suggest is to open two sessions of the Xref. The first one is R/W accessible. The second session would show a warning at start-up that the drawing is open by you and if you would like to continue in Read-Only. Select "yes" and continue to work in the Read-Only session. When you close it will not allow you to save your changes and your Auto-Save will not save any edits to the original.

"No one can make you feel inferior without your consent. "-Eleanor Roosevelt
0 Likes
Message 10 of 13

Anonymous
Not applicable
0 Likes
Message 11 of 13

pendean
Community Legend
Community Legend
... which can be defeated the same way by simply reversing the process.
0 Likes
Message 12 of 13

RobDraw
Mentor
Mentor

@barry2104 wrote:

Is it possible to open a file normally and then whilst the file is open, convert it to a "read only" status so that no changes can be saved? Perhaps by use of a lisp?


No code necessary.

 

It's actually very simple.

 

At that moment of realization, instead of conversion, do a SAVEAS to a different file. That way, you are no longer in that file and when you are satisfied with your changes, you can SAVEAS again back to the original file.


Rob

Drafting is a breeze and Revit doesn't always work the way you think it should.
0 Likes
Message 13 of 13

Anonymous
Not applicable

As far as I am aware there is no easy way reset the read-only option after the file has been opened that is not rife with possibilities for problems that might be caused by inadvertent saves prior to the function execution.  You might wish to ask over in the Lisp Forum for something that triggers a reactor that copies the file to a local junk directory prior to opening with XOPEN

 

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/bd-p/130

 

or over at the Swamp

 

https://www.theswamp.org/

 

 

0 Likes