- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
We have a problem where the font folders in the support files search path keep disappearing. Our fonts folders are important enough that I'd like a lisp that adds them every time someone starts AutoCad. So I started looking for a lisp to add them, but the one I created adds them to the top of the list and there are duplicates. Having them at the top of the list created some problems so I want them placed in the correct order. I found this http://lee-mac.com/addremovesupportpaths.html and have tried to use it. I want it to first remove the font folders and then add them back in the correct location. I'm not great with coding so I'm not sure where I'm going wrong here. We have two font folders that we use. The one that comes with AutoCad "C:\\program files\\autodesk\\autocad 2016\\fonts" and one on our server "Y:\\Library\\CAD Support Files\\Fonts"
;; Remove Support File Search Paths - Lee Mac ;; Removes a list of Support File Search Paths if present. ;; lst - [lst] list of paths to remove (case-insensitive), e.g. '("C:\\Folder1" "C:\\Folder2" ... ) ;; Returns: [str] "ACAD" Environment String following modification (defun LM:sfsp- '("C:\\program files\\autodesk\\autocad 2016\\fonts" "Y:\\Library\\CAD Support Files\\Fonts" / pos str tmp ) (setq str (strcat (vl-string-right-trim ";" (getenv "ACAD")) ";") tmp str ) (foreach pth lst (if (/= "" pth) (while (setq pos (vl-string-search (strcase (strcat pth ";")) (strcase str))) (setq str (strcat (substr str 1 pos) (substr str (+ pos (strlen pth) 2)))) ) ) ) (if (/= tmp str) (setenv "ACAD" str)) ) ;; Add Support File Search Paths at 'n' - Lee Mac ;; Adds a list of Support File Search Paths, excluding duplicates and invalid paths. ;; lst - [lst] list of paths to add, e.g. '("C:\\Folder1" "C:\\Folder2" ... ) ;; idx - [int] [optional] zero-based index at which to add new paths ;; Returns: [str] "ACAD" Environment String following modification (defun LM:sfsp+n '("C:\\program files\\autodesk\\autocad 2016\\fonts" "Y:\\Library\\CAD Support Files\\Fonts" 30 / add ) (defun add ( str new idx / pos ) (if (< 0 idx) (if (setq pos (vl-string-position 59 str)) (strcat (substr str 1 (1+ pos)) (add (substr str (+ pos 2)) new (1- idx))) (strcat ";" new) ) (strcat new str ";") ) ) ( (lambda ( str lst ) (if (setq lst (vl-remove-if '(lambda ( x ) (or (vl-string-search (strcase x) (strcase str)) (not (findfile x)) ) ) lst ) ) (setenv "ACAD" (add str (apply 'strcat (mapcar '(lambda ( x ) (strcat x ";")) lst)) idx)) ) ) (vl-string-right-trim ";" (getenv "ACAD")) (mapcar '(lambda ( x ) (vl-string-right-trim "\\" (vl-string-translate "/" "\\" x))) lst) ) )
Solved! Go to Solution.