Jump to content

Set default file path for "getfiled"


ynotrobits

Recommended Posts

I have the "getfiled" function installed in one of my Lisps. When the user needs to store a file location, it should always be in the same folder: H:\Job Specs. However, getfiled always defaults to: C:\Program Files\AutoCAD 2010 from which the user then has to navigate to the H drive.

 

Does anyone know if there is a method and/or registry location where I can set the H drive location as a default?

 

thank you for looking

ScreenShot001.jpg

Link to comment
Share on other sites

  • 3 months later...

Hi, I've been looking everywhere for how to do this and the answer was really helpful!

 

However, I would like to take this a step further and have it default to the directory that the current drawing is saved to, is this possible?

 

I'm exporting a Flat Pattern DWG from inventor into the directory with the AutoCAD drawing, and I am then running my LISP routine to insert that DWG into my current drawing, explode it, merge layers, etc. It would be perfect if I could just get GetFiled to open straight into the current directory.

 

I was starting to wonder if I could have the LISP routine define what the current directory is, save it as a variable and then use that variable as my dafault directory maybe that could work, but it's a little above me and I'm researching it now so any direction would be great!

 

Thanks!

Daniel

Link to comment
Share on other sites

I'm answering my own question because I found it pretty quick after posting and thought it would be helpful to someone else..

 

If you want the directory to default to the current directory of the current drawing use (getvar "dwgprefix").

 

Example: (setq fn (getfiled "Text Export File" (getvar "dwgprefix") "txt" 1))

 

Credit to T.Willey from AutoDesk's Forums.

 

http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Lisp-to-open-to-current-directory/td-p/.UObco2_7J8E

Link to comment
Share on other sites

(getvar 'Dwgprefix") for default argument :). is this a trick question?

 

EDIT:

Oops... wait a minute Lee, one minute your're not there, and then BAM!!! my reply is one post down. :D

Link to comment
Share on other sites

Hi thanks, I found it shortly after I posted, and I tried to reply again, but it wanted admin authorization.

 

And no, I don't ask trick questions, I ask obvious questions I don't know the answers to =)

 

I learned enough LISP in school to know I can do anything with it, and how to get started and then get stuck =)

Link to comment
Share on other sites

BIGAL that is true, but I would add, especially if you're doing this for a team of designers to work with, remove any changes you made to the support path when the LISP exits. Users are very territorial when it comes to making changes on their system.

Link to comment
Share on other sites

In my limited experience, the owner of one's system is relative... and depends on the group you're working for or with.

 

I used to work for a very large, multi-disciplinary group where one person controlled everything about our setup, where my needing to add a PC3 file to the network for the new printer in our building was a 45 minute phone call. The small group I work for now has absolutely no CAD standards whatsoever, and after nearly a year of pushing for some semblance for same has been discarded as not necessary... I couldn't even prit the plans for a specific project when that project's tech had a famil emergency... Until I got IT to export his profile only to find out that he was storing client-specific CTB, etc in the project folder instead of on the server with the rest of the clients data.

Link to comment
Share on other sites

  • 6 years later...

Taking this old thread a little further,  how can I use the (getvar 'dwgprefix) and set the save drawing name together?

 

 

(setq PreFileName (getfiled "Input name of PRE drawing to save" ( strcat File_PreName FileName) "dwg" 1))

 

how to add (getvar 'dwgprefix) so that the current drawing path is selected?

 

if I try to combine them I of course get a to many arguments error.

 

Thanks

P

 

This is the full function:
 

;SAVE_PRE = save copy of drawing as pre-state
(defun C:SAVE_PRE ()
  (setq File_PreName "PRE-")
  (setq FileName (getvar "DWGNAME"))
  (setq PreFileName (getfiled "Input name of PRE drawing to save" (strcat File_PreName FileName) "dwg" 1))
  (if (findfile PrefileName)
    (command-s "_SAVE" PreFileName "Y")
    (command-s "_SAVE" PreFileName)
  )
  (princ (strcat "\n" File_PreName "File saved as '" (vl-filename-base PreFileName) "'.\n"))
  (princ)
)

 

Link to comment
Share on other sites

16 hours ago, Least said:

ow to add (getvar 'dwgprefix) so that the current drawing path is selected?

 

if I try to combine them I of course get a to many arguments error.

 

@Least All you have to do is include the (getvar "dwgprefix") within the (strcat ..) part:

(getfiled "Input name of PRE drawing to save" (strcat File_PreName FileName) "dwg" 1)

to

(getfiled "Input name of PRE drawing to save" (strcat (getvar "dwgprefix") File_PreName FileName) "dwg" 1)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...