You are here:

AutoCAD/OPEN READ ONLY FILE IN A LOCATION

Advertisement


Question
QUESTION: (defun C:OPR (/ fname sd)
(or (vl-load-com))
(setq sd (getvar "sdi"))
(setvar "sdi" 0)
(setq fname (getfiled "Standard details"
      (getvar "dwgprefix")
         "dwg"
         4)
     )
(if (vl-catch-all-error-p
         (vl-catch-all-apply
         (function (lambda()
         (vla-activate
         (vla-open
         (vla-get-documents
         (vlax-get-acad-object))
         fname
         :vlax-true)
         )
         )
         )
         )
         )
   (alert "Unable to open in read-only mode")
   )
   (setvar "sdi" sd)
   (princ)
   )

this lsp works but i want to set the file folder location specifically to C:\CustomProg\database\Stnd_block hope u could help me figure this out. Thanks

ANSWER: Mich:

Try replacing:
(getvar "dwgprefix")
with
"C:\\CustomProg\\database\\Stnd_block"
and include the quotes.

Keep in touch
Bill DeShawn
http://my.sterling.net/bdeshawn


---------- FOLLOW-UP ----------

QUESTION: Sir, Ive tried replacing it but it doesn't seem to work. i might be missing something. Again appreciate your help.

Answer
Mich:

Paste the following into Windows Explorer Address Window:

C:\CustomProg\database\Stnd_block

If Windows Explorer doesn't go there, then perhaps you've misspelled something or you entered the path incorrectly.  Make sure the path is correctly entered.

Bill DeShawn
http://my.sterling.net/~bdeshawn

AutoCAD

All Answers


Answers by Expert:


Ask Experts

Volunteer


Bill DeShawn

Expertise

I can address all 2-D questions and some 3-D questions. I do programming in AutoLISP if it doesn`t involve solid modeling. I can also address menu customization issues and can help you find answers to questions I can`t answer by taking your question directly to Autodesk via their newsgroups.

Experience

I used to do electronic and mechanical design for a flat panel monitor manufacturer, and now I do architectural drafting for an architect. I did and do AutoLISP and menu customization and take pride in making my lisp routines to do the work exactly the way the client likes them done.

Publications
I had a routine published in CADENCE magazine (no longer in publication and taken over by CADALYST). Some of my routines are published on my website at http://my.sterling.net/~bdeshawn

©2012 About.com, a part of The New York Times Company. All rights reserved.