Jump to content

Adding Folders to Support File Search Path


Espie79

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 5 weeks later...

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.
Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

 

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
Link to comment
Share on other sites

  • 1 year later...

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

Link to comment
Share on other sites

  • 3 years later...

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 )

Link to comment
Share on other sites

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
Link to comment
Share on other sites

(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")

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 1 year later...

We're setting up our Support File Paths in SharePoint, which syncs to a local folder under the user name in C:\users\username\...

The problem I'm having is adding multiple support file paths that each have to use getvar to set the 'username' into each path.

Under the 2018 folder will be a series of folders. How do I restructure this to make a list and then add those paths to the existing OLDPATH locations?

 

;Set up the SharePoint Support Paths
(setq NEWPATH (strcat ";"  ";" "C:\\Users\\" (getvar "loginname") "\\Company Name\\Division\\Synced Support Files\\BIM-CAD\\Autodesk\\AutoCAD\\2018\\"))
        OLDPATH (getenv "ACAD"))
(setenv "ACAD" (strcat OLDPATH NEWPATH))
 

Link to comment
Share on other sites

Take a look at Lee Mac's code: http://lee-mac.com/addremovesupportpaths.html

and http://forums.augi.com/showthread.php?163327-Adding-support-file-search-path-as-the-first-(LISP)&amp;p=1298948

or try 

(defun AddTrustedPath (dir / trusted Uname)
  (setq trusted (getvar 'trustedpaths) Uname (getenv "Username") dir (vl-string-subst Uname "%Username%" dir))
  (or (vl-string-search dir trusted) (setvar 'trustedpaths (strcat trusted ";" dir)))
  (princ)
)

You're gonna need code for Trusted Paths as well like:

(defun AddTrustedPath (dir / trusted Uname)
  (setq trusted (getvar 'trustedpaths) Uname (getenv "Username") dir (vl-string-subst Uname "%Username%" dir))
  (or (vl-string-search dir trusted) (setvar 'trustedpaths (strcat trusted ";" dir)))
  (princ)
)

 

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