Jump to content
Espie79

Adding Folders to Support File Search Path

Recommended Posts

Espie79

Hi all,

I am looking at a way to automatically add folders to the support file search path. I used to use AcadInstall.exe but it is no longer supported for later versions of AutoCAD. Does anyone know where the Support File Search Path is located in the windows registry. I thouhgt I could write a program to add to the registry key.

 

On a similar idea, is it also possible to write to the registry .vlx files to the startup menu. If so where is it located in the registry and does anyone know a good way to add to the registry? Thanks

 

P.S I know I can automatically run a lisp routine to do this stuff inside AutoCAD but want to run a .exe or .bat file at the end of an installation program.

Share this post


Link to post
Share on other sites
BIGAL

It can be done directly add or remove

 

; This sets a reference to the install path of your product
; the gets are their for info maybe other use
(vl-load-com)
; make temp directory
;(vl-mkdir "c:\\ACADTEMP")
(setq *files*  (vla-get-files  (vla-get-preferences (vlax-get-acad-object))))
; savepath
;(vla-get-AutoSavepath *files*)
(vla-put-AutoSavepath *files* "C:\\ACADTemp")
; custom icons
;(vla-get-CustomIconPath *files*))
(vla-put-CustomIconPath *files* "P:\\Autodesk\\ICONS")
; printers config
;(vla-get-PrinterConfigPath *files*)
(vla-put-PrinterConfigPath *files* "P:\\AutoDESK\\Plotting\\Plot Styles 2011")
; printers style sheet
;(vla-get-PrinterStyleSheetPath *files*)
(vla-put-PrinterStyleSheetPath *files* "P:\\AutoDESK\\Plotting\\Plot Styles")
; printer drv's
;(vla-get-PrinterDescPath *files*)
(vla-put-PrinterDescPath *files* "P:\\AutoDESK\\Plotting\\Drv")
; print spooler
;(vla-get-PrintSpoolerPath *files*)
(vla-put-PrintSpoolerPath *files* "C:\\ACADTemp\\")
; template location
;(vla-get-QnewTemplateFile *files*)
(vla-put-QnewTemplateFile *files* "P:\\Autodesk\\c3d Templates\\cogg.dwt")
;make new support paths exist + new
(setq paths (vla-get-SupportPath *files*))

(setq newpaths 
 "P:\\autodesk\\supportfiles;
 P:\\autodesk\\lisp;
 P:\\autodesk\\fonts;
 P:\\autodesk\\hfs fonts;"
 )
(setq newpath (strcat newpaths paths))
(vla-put-SupportPath *files* newpath)
; Tempdirectory 
;(vla-get-TempFilePath *files*))
(vla-put-TempFilePath *files* "C:\\ACADTemp\\")
; template  path
;(vla-get-TemplateDwgPath *files*)
(vla-put-TemplateDwgPath *files* "P:\\Autodesk\\c3d Templates")
; xref temp path
;(vla-get-TempXrefPath *files*))
(vla-put-TempXrefPath *files* "C:\\ACADTemp\\")
; end use of *files*
(vlax-release-object *files*)
; exit quitely
(princ "All Done")

 

All most forgot you can use profiles and have different icons on your desktop to to run different menus and setups. You basicly need two things a ARG & a Cui they live together. Just use the lisp above to set the path structure and save a ARG the one missing is the main custom menu I will try to find variable.

Share this post


Link to post
Share on other sites
Keywordkid

I may be mistaken as I'm pretty new to AutoCAD lisping but the registry entry for the main cuix is

MenuFile
hope this helps.

Share this post


Link to post
Share on other sites
Keywordkid
It can be done directly add or remove

 

; This sets a reference to the install path of your product
; the gets are their for info maybe other use
(vl-load-com)
; make temp directory
;(vl-mkdir "c:\\ACADTEMP")
(setq *files*  (vla-get-files  (vla-get-preferences (vlax-get-acad-object))))
; savepath
;(vla-get-AutoSavepath *files*)
(vla-put-AutoSavepath *files* "C:\\ACADTemp")
; custom icons
;(vla-get-CustomIconPath *files*))
(vla-put-CustomIconPath *files* "P:\\Autodesk\\ICONS")
; printers config
;(vla-get-PrinterConfigPath *files*)
(vla-put-PrinterConfigPath *files* "P:\\AutoDESK\\Plotting\\Plot Styles 2011")
; printers style sheet
;(vla-get-PrinterStyleSheetPath *files*)
(vla-put-PrinterStyleSheetPath *files* "P:\\AutoDESK\\Plotting\\Plot Styles")
; printer drv's
;(vla-get-PrinterDescPath *files*)
(vla-put-PrinterDescPath *files* "P:\\AutoDESK\\Plotting\\Drv")
; print spooler
;(vla-get-PrintSpoolerPath *files*)
(vla-put-PrintSpoolerPath *files* "C:\\ACADTemp\\")
; template location
;(vla-get-QnewTemplateFile *files*)
(vla-put-QnewTemplateFile *files* "P:\\Autodesk\\c3d Templates\\cogg.dwt")
;make new support paths exist + new
(setq paths (vla-get-SupportPath *files*))

(setq newpaths 
 "P:\\autodesk\\supportfiles;
 P:\\autodesk\\lisp;
 P:\\autodesk\\fonts;
 P:\\autodesk\\hfs fonts;"
 )
(setq newpath (strcat newpaths paths))
(vla-put-SupportPath *files* newpath)
; Tempdirectory 
;(vla-get-TempFilePath *files*))
(vla-put-TempFilePath *files* "C:\\ACADTemp\\")
; template  path
;(vla-get-TemplateDwgPath *files*)
(vla-put-TemplateDwgPath *files* "P:\\Autodesk\\c3d Templates")
; xref temp path
;(vla-get-TempXrefPath *files*))
(vla-put-TempXrefPath *files* "C:\\ACADTemp\\")
; end use of *files*
(vlax-release-object *files*)
; exit quitely
(princ "All Done")

 

All most forgot you can use profiles and have different icons on your desktop to to run different menus and setups. You basicly need two things a ARG & a Cui they live together. Just use the lisp above to set the path structure and save a ARG the one missing is the main custom menu I will try to find variable.

 

BIGAL, using a combination of your information and some other advice on using the ACAD.lsp and ACADDOC.lsp I have got the support paths working as desired for my company standards, the problem I have now is these are also loading for my client configs. Cilents are fired from a /p shortcut switch to a different network location which loads the client arg.

 

I'm assuming this has something to do with local registry settings as most of the issues I encounter seem to end up that way.

 

Am I missing something here to keep seperate configs from being ignored?

 

Here is my company standards ACAD.lsp

; Set registry file search paths
(setenv "SaveFilePath" (strcat "C:\\ACAD\\"(getvar "loginname")))
(setenv "LogFilePath" (strcat "C:\\ACAD\\"(getvar "loginname")))
(setenv "ActRecPath" (strcat "C:\\ACAD\\"(getvar "loginname")))
(setenv "ActRecPath" (strcat "C:\\ACAD\\"(getvar "loginname")))
(setenv "PlotLogPath" (strcat "C:\\ACAD\\"(getvar "loginname")))
(setenv "ACADDRV" (strcat "C:\\Program Files\\Autodesk\\AutoCAD 2012 - English\\drv"))
(setenv "EnterpriseMenuFile" (strcat "c:\\acad\\ACAD-2012-LOCAL\\support\\SWD-Default.cuix"))
(setenv "QnewTemplate" (strcat "c:\\acad\\ACAD-2012-LOCAL\\template\\SWD2012.dwt"))
(princ)
(vl-load-com)
; This sets a reference to the files portion of the acad preferences
(setq *files* (vla-get-files
  (vla-get-preferences (vlax-get-acad-object))
))
; This builds the string of support file search paths
(setq sfsp
      (strcat
"C:\\ACAD\\"(getvar "loginname")"[url="file://\\support"]\\support[/url];"
"C:\\ACAD\\ACAD-2012-LOCAL\\03-Fonts;"
"C:\\ACAD\\ACAD-2012-LOCAL\\04-CTB-Files;"
"C:\\ACAD\\ACAD-2012-LOCAL\\05-AutoCAD Pattern Files;"
"C:\\ACAD\\ACAD-2012-LOCAL\\support;"
"C:\\ACAD\\ACAD-2012-LOCAL\\support\\color;"
)
)
; This actually applies the above string to the current session of AutoCAD.
(vla-put-SupportPath *files* sfsp)
; Release the object
(vlax-release-object *files*)

(command "Menu" (strcat "c:\\acad\\"(getvar "loginname")"[url="file://\\support\\mymenu.cuix"]\\support\\mymenu.cuix[/url]"))

(princ)

 

And the only relevant item in my ACADDOC is

;Load this just once
(SETVAR "acadlspdoc" 0)

Share this post


Link to post
Share on other sites
BlackBox

Perhaps this is a bit nit-picky of me, but you do not need to use STRCAT unless combining strings. :thumbsup:

 

 

Here is my company standards ACAD.lsp

; Set registry file search paths
(setenv "SaveFilePath" (strcat "C:\\ACAD\\"(getvar "loginname")))
(setenv "LogFilePath" (strcat "C:\\ACAD\\"(getvar "loginname")))
(setenv "ActRecPath" (strcat "C:\\ACAD\\"(getvar "loginname")))
(setenv "ActRecPath" (strcat "C:\\ACAD\\"(getvar "loginname")))
(setenv "PlotLogPath" (strcat "C:\\ACAD\\"(getvar "loginname")))
(setenv "ACADDRV" [color=red](strcat[/color] "C:\\Program Files\\Autodesk\\AutoCAD 2012 - English\\drv"[color=red])[/color])
(setenv "EnterpriseMenuFile" [color=red](strcat[/color] "c:\\acad\\ACAD-2012-LOCAL\\support\\SWD-Default.cuix"[color=red])[/color])
(setenv "QnewTemplate"[color=red] (strcat[/color] "c:\\acad\\ACAD-2012-LOCAL\\template\\SWD2012.dwt"[color=red])[/color])
(princ)

;; <snip>

 

 

Also...

 

(defun c:SFSP+  (/ *error*)
 (vl-load-com)

 (defun *error*  (msg)
   (if oShell
     (setq oShell (vlax-release-object oShell)))
   (cond ((not msg))                                                   ; Normal exit
         ((member msg '("Function cancelled" "quit / exit abort")))    ; <esc> or (quit)
         ((princ (strcat "\n** Error: " msg " ** "))))                 ; Fatal error, display it
   (princ))

 ((lambda (acApp / oShell oFolder acDoc acFiles path oldPath)
    (if
      (and
        (setq oShell
               (vlax-get-or-create-object "Shell.Application"))
        (setq oFolder
               (vlax-invoke
                 oShell
                 'BrowseForFolder
                 (vla-get-hwnd acApp)
                 "Select a folder to add to SFSP:"
                 0
                 17)))
       (if
         (not
           (vl-string-search
             (strcase
               (setq path
                      (strcat
                        (vlax-get-property
                          (vlax-get-property oFolder 'Self)
                          'Path)
                        ";")))
             (strcase
               (setq oldPath
                      (strcat
                        (vl-string-right-trim
                          ";"
                          (vla-get-supportpath
                            (setq acFiles
                                   (vla-get-files
                                     (vla-get-preferences
                                       acApp)))))
                        ";")))))

          (progn
            (vla-put-supportpath acFiles (strcat oldPath ";" path))
            (*error* nil))
          (*error* "Path already exists in SFSP"))
       (cond
         (oShell (*error* nil))
         ((*error* "Unable to create Shell.Application Object")))))
   (vlax-get-acad-object)))

Share this post


Link to post
Share on other sites
Keywordkid

Hi RenderMan,

 

Can you elborate on the functions of your second code example, as you identified with the unnecessary code I'd added in my posting I'm quite a newbie to AutoCAD coding, I have more experience in VBA for MicroStation, so descriptions are a really useful learning aid as I develop.

 

Thanks.

Share this post


Link to post
Share on other sites
BlackBox

 

Can you elborate on the functions of your second code example, as you identified with the unnecessary code I'd added in my posting I'm quite a newbie to AutoCAD coding, I have more experience in VBA for MicroStation, so descriptions are a really useful learning aid as I develop.

 

No worries; we all start somewhere... Welcome to the world of AutoCAD development! :beer:

 

The Support Files Search Path Plus (SFSP+) function I posted uses an IF statement with a test expression which prompts the user to select a Folder Object via the Shell.Application Object's BrowseForFolder Method.

 

Upon a valid Folder Object being identified, the Path Property is extracted from the Folder Objects's Self Property Object.

 

This Path Property is then searched for against the PreferencesFiles Object's SupportPath Property (as String).

 

If the SupportPath Property (as String) does not contain the new Path selected, then the new Path is added to the end of the SupportPath Property String, and the SupportPath Property is replaced.

 

Hope this helps! (HTH)

Edited by BlackBox

Share this post


Link to post
Share on other sites
PGH

Hi Blackbox,

 

 

The lisp "SFSP+" looks great, however, each folder can be only added individually.

Can you modify the lisp in a way that allows you select a folder and its all subfolders. This means the lisp routine be able to add all the subfolders to "support files search path" automatically.

 

 

Thanks

Share this post


Link to post
Share on other sites
sathalex

Hello. Tell me please, how to adding folder to support file search path at first level in list AutoCAD? I saw this code on this forum. But now I can not find him.

Thanks to everyone who will help )

Share this post


Link to post
Share on other sites
BIGAL

Try the method in the code above the order by using the strcat put your path 1st then add the existing.

 

(setq newpath (strcat newpaths paths))

Edited by BIGAL

Share this post


Link to post
Share on other sites
tombu

(defun AddSupportPath (dir / Cpath Uname)
; http://forums.augi.com/showthread.php?163327-Adding-support-file-search-path-as-the-first-(LISP)&p=1298948#post1298948
 (setq Cpath (getenv "ACAD") Uname (getenv "Username") dir (vl-string-subst Uname "%Username%" dir))
 (or (vl-string-search (strcase dir) (strcase Cpath)) (setenv "ACAD" (strcat Cpath ";" dir)))
 (princ)
)

Checks to see if dir is already in the path and adds it if not.

Ex.

(AddSupportPath "G:\\BeaufordT\\Autocad\\Application Data\\Customization")

Share this post


Link to post
Share on other sites
BIGAL

Something else that may work its un documented came across it somewhere here. You can add .. to the end of a directory and autocad interprets that as include all subdirectorys below. I have used it so know it works, will check 2016 & 2018.

 

eg G:\\acad_blocks..

v's

G:\\acad_blocks\\car

G:\\acad_blocks\\pipes

G:\\acad_blocks\\lisp

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×