Author Topic: Support File Search Path  (Read 1173 times)

0 Members and 1 Guest are viewing this topic.

b-rye guy

  • Guest
Support File Search Path
« on: March 31, 2016, 12:25:16 PM »
Hello -

I am wondering if there is a way to map the support file search path of autocad to a folder which contains all of the customizations (templates, sheet sets, plot styles, etc.) that have been set up for our firm.

We have 3 offices spread out around the country, and currently I am required to manually access each computer through a VPN and map out our standard settings to each new computer / user. It would be great if I could automate this into a routine.

Thanks in advance,
b

ChrisCarlson

  • Guest
Re: Support File Search Path
« Reply #1 on: March 31, 2016, 01:20:44 PM »
Here are some snippets

Code - Auto/Visual Lisp: [Select]
  1.         ;;Set TrustedPaths
  2.         (if
  3.                 (and (setq trusted (getvar 'trustedpaths))
  4.                         (not (vl-string-search "Path" trusted))
  5.                 )
  6.                 (setvar 'trustedpaths (strcat (vl-string-right-trim ";" trusted) ";" "Path"))
  7.         )

Code - Auto/Visual Lisp: [Select]
  1. (defun LM:sfsp+ ( lst / str )
  2. ;; Add Support File Search Paths  -  Lee Mac
  3. ;; Adds a list of Support File Search Paths, excluding duplicates and invalid paths.
  4. ;; lst - [lst] list of paths to add, e.g. '("C:\\Folder1" "C:\\Folder2" ... )
  5. ;; Returns: [str] "ACAD" Environment String following modification
  6.     (setenv "ACAD"
  7.         (strcat (setq str (vl-string-right-trim ";" (getenv "ACAD"))) ";"
  8.             (apply 'strcat
  9.                 (mapcar (function (lambda ( x ) (strcat x ";")))
  10.                     (vl-remove-if
  11.                         (function
  12.                             (lambda ( x )
  13.                                 (or (vl-string-search (strcase x) (strcase str))
  14.                                     (not (findfile x))
  15.                                 )
  16.                             )
  17.                         )
  18.                         (mapcar
  19.                             (function
  20.                                 (lambda ( x )
  21.                                     (vl-string-right-trim "\\" (vl-string-translate "/" "\\" x))
  22.                                 )
  23.                             )
  24.                             lst
  25.                         )
  26.                     )
  27.                 )
  28.             )
  29.         )
  30.     )
  31. )

Code - Auto/Visual Lisp: [Select]
  1.         (LM:sfsp+ '(
  2.                         "G:\\AutoCAD\\blocks"
  3.                         "G:\\AutoCAD\\blocks\\legend"
  4.                         "G:\\AutoCAD\\hatches" 
  5.                         "G:\\AutoCAD\\lisps"           
  6.                         )
  7.         )

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Support File Search Path
« Reply #2 on: March 31, 2016, 01:22:29 PM »
Thanks for the recommendation Chris - I'm pleased to see that you find those functions useful  :-)

I've actually updated the functions here to avoid modifying the registry value if all paths are already present.

ChrisCarlson

  • Guest
Re: Support File Search Path
« Reply #3 on: March 31, 2016, 01:48:49 PM »
Thanks for the recommendation Chris - I'm pleased to see that you find those functions useful  :-)

I've actually updated the functions here to avoid modifying the registry value if all paths are already present.

You should start including a check function in your routines to make sure it's the current version, this is the second one I use that you've since updated  :smitten: