CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] ARKANCE | CONTACT - CZ | SK | EN | DE

CAD tip CAD tip # 2063:

Question

CAD 
 %  platform  category 
A
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    28116×   FAQ  
this tip shared by ARKANCE experts applies to: AutoCAD 2010 · AutoCAD 2008 · AutoCAD 2004 · AutoCAD 2000 ·

See also:
Tip 14643:Easy insertion of arrows into MText content.
Tip 14604:QRcode - dynamically generated QR codes in AutoCAD.
Tip 14414:Link geo-tagged photos from your mobile phone to AutoCAD DWG maps.
Tip 14399:How can I find out which version of LISP freeware is loaded? (automatically opened CADforum page)
Tip 14361:Extended ATTOUT/ATTIN for block attribute management in Excel (also for LT).


Back    All CAD Tips



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
  



Featuring:
Take advantage of orthophotos, point clouds, and design files. Get better quality design changes faster with Pointscene More info


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