Jump to content

Lisp Command For Setting The Auto File Save Location


ReinierMeyer

Recommended Posts

Does anybody know what the command is to set the Auto save file location using a lisp routine

 

like the following sets the Template path,

 

(vla-put-TemplateDwgPath *files* "\\\\Server\\Data\\Cad_Programs\\Autocad\\Drawing Templates")

 

I need to set the Autosave file location.

 

Please Help!!!!

Link to comment
Share on other sites

Do you happen to be dutch?

 

 
; MarcoW 09-11-2009
;
; first create the function
; and localise the variables used
(defun c:asf ( / asfloc oldloc)
; then set some variables that will be used
(setq asfloc (getstring T "\nPlease enter the automatic Save File Location as desired:  ")
 oldloc (getvar "savefilepath")
); end of setq
; put the new path into the systemvariable
(setvar "savefilepath" asfloc)
; show the old location once more, you might want to write down its location for you never know if you want it back
(alert (strcat "The old path was: " oldloc))
; clean exit
 (princ)
; end of defun
)

 

Just wrote it but I guess it works.

 

Someone might help you along getting the right folder by selecting it in a dialog box.

Link to comment
Share on other sites

I wrote this a while back to run on new machines for complete setup.

Obviously, you will have to make changes to the specifics, but it will have what you are looking for. :)

 

(defun c:CES-Setup (/ #Files #Layout #Flag)
 (vl-load-com)
 (and
   (not
     (vl-catch-all-error-p
       (vl-catch-all-apply
         '(lambda ()
            (setq #Files  (vla-get-files
                            (vla-get-preferences (vlax-get-acad-object))
                          ) ;_ vla-get-files
                  #Layout (vla-get-activelayout
                            (vla-get-activedocument (vlax-get-acad-object))
                          ) ;_ vla-get-activelayout
            ) ;_ setq
            ;; *********************
            ;; **  AutoSave Path  **
            ;; *********************
            (mapcar 'vl-mkdir (list "c:\\TEMP" "c:\\TEMP\\ACAD"))
            (vla-put-autosavepath #Files "c:\\TEMP\\ACAD")
            ;; ***************************
            ;; **  Printer Config Path  **
            ;; ***************************
            (vla-put-PrinterConfigPath
              #Files
              "s:\\cadd standards\\Plotters"
            ) ;_ vla-put-PrinterConfigPath
            (vla-refreshplotdeviceinfo #Layout)
            ;; ***********************
            ;; **  Plotstyles Path  **
            ;; ***********************
            (vla-put-printerstylesheetpath
              #Files
              "s:\\cadd standards\\Plotstyles"
            ) ;_ vla-put-printerstylesheetpath
            (vla-refreshplotdeviceinfo #Layout)
            ;; *********************
            ;; **  Template Path  **
            ;; *********************
            (vla-put-TemplateDwgPath
              #Files
              "s:\\cadd standards\\Template"
            ) ;_ vla-put-TemplateDwgPath
            ;; *********************
            ;; **  QNew Template  **
            ;; *********************
            (vla-put-QNewTemplateFile
              #Files
              "s:\\cadd standards\\Template\\CES_Template.dwt"
            ) ;_ vla-put-QNewTemplateFile
            ;; *********************
            ;; **  Support Paths  **
            ;; *********************
            (vla-put-supportpath
              #Files
              (strcat ";s:\\cadd standards\\startup"
                      ";s:\\cadd standards\\lisp"
                      ";s:\\cadd standards\\linetypes"
                      ";s:\\cadd standards\\fonts"
                      ";s:\\cadd standards\\ces layers"
                      ";"
                      (vla-get-supportpath #Files)
              ) ;_ strcat
            ) ;_ vla-put-supportpath
            ;; ***************************
            ;; **  Tool Palettes Paths  **
            ;; ***************************
            (vla-put-ToolPalettePath
              #Files
              (strcat "S:\\CADD Standards\\Toolpalette\\Palettes;"
                      (vla-get-ToolPalettePath #Files)
              ) ;_ strcat
            ) ;_ vla-put-ToolPalettePath
          ) ;_ lambda
       ) ;_ vl-catch-all-apply
     ) ;_ vl-catch-all-error-p
   ) ;_ not
   (alert
     (strcat
       "AutoCAD has been setup for Capital Engineering & Surveying, Inc. Standards.\n\n"
       "                      Please restart AutoCAD."
     ) ;_ strcat
   ) ;_ alert
 ) ;_ and
 (princ)
) ;_ defun
(alert "Type: \"CES-SETUP\" to run setup.")
(princ)

Link to comment
Share on other sites

  • 4 years later...
I wrote this a while back to run on new machines for complete setup.

Obviously, you will have to make changes to the specifics, but it will have what you are looking for. :)

 

(defun c:CES-Setup (/ #Files #Layout #Flag)
 (vl-load-com)
 (and
   (not
     (vl-catch-all-error-p
       (vl-catch-all-apply
         '(lambda ()
            (setq #Files  (vla-get-files
                            (vla-get-preferences (vlax-get-acad-object))
                          ) ;_ vla-get-files
                  #Layout (vla-get-activelayout
                            (vla-get-activedocument (vlax-get-acad-object))
                          ) ;_ vla-get-activelayout
            ) ;_ setq
            ;; *********************
            ;; **  AutoSave Path  **
            ;; *********************
            (mapcar 'vl-mkdir (list "c:\\TEMP" "c:\\TEMP\\ACAD"))
            (vla-put-autosavepath #Files "c:\\TEMP\\ACAD")
            ;; ***************************
            ;; **  Printer Config Path  **
            ;; ***************************
            (vla-put-PrinterConfigPath
              #Files
              "s:\\cadd standards\\Plotters"
            ) ;_ vla-put-PrinterConfigPath
            (vla-refreshplotdeviceinfo #Layout)
            ;; ***********************
            ;; **  Plotstyles Path  **
            ;; ***********************
            (vla-put-printerstylesheetpath
              #Files
              "s:\\cadd standards\\Plotstyles"
            ) ;_ vla-put-printerstylesheetpath
            (vla-refreshplotdeviceinfo #Layout)
            ;; *********************
            ;; **  Template Path  **
            ;; *********************
            (vla-put-TemplateDwgPath
              #Files
              "s:\\cadd standards\\Template"
            ) ;_ vla-put-TemplateDwgPath
            ;; *********************
            ;; **  QNew Template  **
            ;; *********************
            (vla-put-QNewTemplateFile
              #Files
              "s:\\cadd standards\\Template\\CES_Template.dwt"
            ) ;_ vla-put-QNewTemplateFile
            ;; *********************
            ;; **  Support Paths  **
            ;; *********************
            (vla-put-supportpath
              #Files
              (strcat ";s:\\cadd standards\\startup"
                      ";s:\\cadd standards\\lisp"
                      ";s:\\cadd standards\\linetypes"
                      ";s:\\cadd standards\\fonts"
                      ";s:\\cadd standards\\ces layers"
                      ";"
                      (vla-get-supportpath #Files)
              ) ;_ strcat
            ) ;_ vla-put-supportpath
            ;; ***************************
            ;; **  Tool Palettes Paths  **
            ;; ***************************
            (vla-put-ToolPalettePath
              #Files
              (strcat "S:\\CADD Standards\\Toolpalette\\Palettes;"
                      (vla-get-ToolPalettePath #Files)
              ) ;_ strcat
            ) ;_ vla-put-ToolPalettePath
          ) ;_ lambda
       ) ;_ vl-catch-all-apply
     ) ;_ vl-catch-all-error-p
   ) ;_ not
   (alert
     (strcat
       "AutoCAD has been setup for Capital Engineering & Surveying, Inc. Standards.\n\n"
       "                      Please restart AutoCAD."
     ) ;_ strcat
   ) ;_ alert
 ) ;_ and
 (princ)
) ;_ defun
(alert "Type: \"CES-SETUP\" to run setup.")
(princ)

 

bit of a thread bump, I have tried the code I have quoted and it does nothing...

 

i'm using AutoCAD2013 full,

 

I have copied the full code into an open lisp box, saved it as CES-SETUP

loaded it like I have many other LISP's and a warning box appears saying "type CES-SETUP to run"

 

I do that and nothing, the command line shows no error, but just moves on like something happened. and just says command:

 

in options, nothing has changed.

 

I have also amended all the paths to suit my setup and still nothing...

 

what am I doing wrong?

Link to comment
Share on other sites

Did you make any changes to the code as recommend by alanjt?

 

yes, here is my modified code. I also tried he code exactly, to see what would happen, and nothing happened with both codes

 

(defun c:setup (/ #Files #Layout #Flag)
 (vl-load-com)
 (and
   (not
     (vl-catch-all-error-p
       (vl-catch-all-apply
         '(lambda ()
            (setq #Files  (vla-get-files
                            (vla-get-preferences (vlax-get-acad-object))
                          ) ;_ vla-get-files
                  #Layout (vla-get-activelayout
                            (vla-get-activedocument (vlax-get-acad-object))
                          ) ;_ vla-get-activelayout
            ) ;_ setq
            ;; *********************
            ;; **  AutoSave Path  **
            ;; *********************
            (mapcar 'vl-mkdir (list "c:\\TEMP" "c:\\TEMP\\ACAD"))
            (vla-put-autosavepath #Files "c:\\TEMP\\ACAD")
            ;; ***************************
            ;; **  Printer Config Path  **
            ;; ***************************
            (vla-put-PrinterConfigPath
              #Files
              "c:\\AutoCAD Setup\\Plotter files"
            ) ;_ vla-put-PrinterConfigPath
            (vla-refreshplotdeviceinfo #Layout)
            ;; ***********************
            ;; **  Plotstyles Path  **
            ;; ***********************
            (vla-put-printerstylesheetpath
              #Filesls
              "c:\\AutoCAD Setup\\Plot Styles"
            ) ;_ vla-put-printerstylesheetpath
            (vla-refreshplotdeviceinfo #Layout)
            ;; *********************
            ;; **  Template Path  **
            ;; *********************
            (vla-put-TemplateDwgPath
              #Files
              "c:\\AutoCAD Setup\\Template"
            ) ;_ vla-put-TemplateDwgPath
            ;; *********************
            ;; **  QNew Template  **
            ;; *********************
            (vla-put-QNewTemplateFile
              #Files
              "=c:\\AutoCAD Setup\\Template\\PROJECT TEMPLATE.dwt"
            ) ;_ vla-put-QNewTemplateFile
            ;; *********************
            ;; **  Support Paths  **
            ;; *********************
            (vla-put-supportpath
              #Files
              (strcat ";c:\\AutoCAD Setup\\Startup"
                      ";c:\\AutoCAD Setup\\lisp"
                      ";c:\\AutoCAD Setup\\Line Types"
                      ";c:\\AutoCAD Setup\\Fonts"
                      ";c:\\AutoCAD Setup\\Layers"
        ";c:\\AutoCAD Setup\\Hatch Patterns"
                      ";"
                      (vla-get-supportpath #Files)
              ) ;_ strcat
            ) ;_ vla-put-supportpath
            ;; ***************************
            ;; **  Tool Palettes Paths  **
            ;; ***************************
            (vla-put-ToolPalettePath
              #Files
              (strcat "c:\\AutoCAD Setup\\CAD_Blocks\\;"
                      (vla-get-ToolPalettePath #Files)
              ) ;_ strcat
            ) ;_ vla-put-ToolPalettePath
          ) ;_ lambda
       ) ;_ vl-catch-all-apply
     ) ;_ vl-catch-all-error-p
   ) ;_ not
   (alert
     (strcat
       "AutoCAD has been setup Standards.\n\n"
       "                   Please restart AutoCAD."
     ) ;_ strcat
   ) ;_ alert
 ) ;_ and
 (princ)
) ;defun
(alert "Type: \"SETUP\" to run setup.")
(princ)

Link to comment
Share on other sites

You're interested in the entire code not just the portion that specifies the AutoSave file location?

 

Yes the full code, i want it as a first setup for new machines, so i can just run the LISP

Link to comment
Share on other sites

Man, this is an old thread.

 

I'm sure this is a stupid question, but the paths being specified valid paths?

 

If you are not receiving the final popup window, then an error is being thrown. I would step through the code in vlide and see where it errors. That should give you a better idea of what/where to make your correction(s).

Link to comment
Share on other sites

Right, went over the code with a fine tooth comb, and found 2 spelling mistakes, one of the #files was #filesls and templates folder was not plural.

 

a couple of more folder tweaks and its sorted. but it works!!

 

one think though, how do I delete a standard folder path, as I want to remove from the support path, path I no longer need, like Fonts etc. its no biggie

Link to comment
Share on other sites

it now works, trying to work out how to delete paths still, but I have added in a "hide system printers" variable, so it only shows the printers in plotter files folder.

 

            ;; ***************************
            ;; **  Printer Config Path  **
            ;; ***************************
            (vla-put-PrinterConfigPath
              #Files
              "c:\\AutoCAD Setup\\Plotter files"
            ) ;_ vla-put-PrinterConfigPath
            ;;************************
            ;;**Hide System Printers**
            ;;************************
            (setenv "HideSystemPrinters" "1")
            (vla-refreshplotdeviceinfo #Layout)

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...