CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz]
Cesky English Deutsch
Login/Register:
 Visitors: 4251 

CAD tip CAD tip # 2063:

Question CAD 
 %  platform  category 
Q - question

How to open a drawing with write-protection (R/O)?

A - answer If you want to open a drawing (e.g. in LISP or in script) in a forced read-only (R/O) mode, you can use the following VLISP code:
(vl-load-com)
(defun openRO (fn)
 (vla-activate (vla-open (vla-get-documents (vlax-get-acad-object)) fn :VLAX-TRUE))
)
Then you can use e.g.:
(openRO "C:\documents\mydrawing.dwg")
or
(openRO (getfiled "Open R/O" "" "DWG" 0))
to open the drawing in ReadOnly mode (write-protected).

You can then also redefine the OPEN command to open all DWG files as read-only:

_UNDEFINE _OPEN
(defun C:OPEN()(openRO (getfiled "Open R/O" "" "DWG" 0))(princ))
and define a new command - "OPENEDIT" - to perform a "real" open:
(defun C:OPENEDIT()(command "._OPEN)(princ))
ACAD2010ACAD2008ACAD2004ACAD2000
100% *  CAD 
26.3.2002    20025×   FAQ  
Comments   Tell a friend

See also:
Tip 11502:How to detect DWG files created as an export from Autodesk Revit?
Tip 10926:Self-intersecting polylines and polylines with duplicate vertices.
Tip 10663:Automatic warning on DWG open.
Tip 10647:How to store macros inside DWG drawings?
Tip 9913:How to detect DWG files created in the drawing module in Autodesk Fusion 360?


Back   All CAD Tips All CAD tips&tricks

How to direct DesignCenter to a particular file or folder? « | » How to draw an arc with given start point, radius and arc length?

Have we helped you? If you want to support the CAD Forum web service, consider buying one of our CAD applications, or our custom software development offerings, or donating via PayPal (see above). You may also add a link to your web - like this "fan" link: CAD Forum - tips, utilities, blocks for Autodesk products
CAD:    OS:    Categ: 
Text:  FAQ glossary   



Featuring:
Publish interactive 3D PDF models from AutoCAD, Inventor or Revit with Share3D More info


Please use these tips at your own risk.
CAD Studio (Xanadu) is not responsible for possible problems that may occur as a result of using any of these tips.
TOPlist