TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: HasanCAD on March 09, 2016, 04:55:18 AM

Title: Why this lisp not working in CAD2016
Post by: HasanCAD on March 09, 2016, 04:55:18 AM
I am wondering why this lisp is working fine in CAD2014 but not working in 2016

Code - Auto/Visual Lisp: [Select]
  1. (SETQ ORIGPATH (vla-get-SupportPath *files*))
  2. (SETQ ONEPATH   (setq w         ";B:\\Fonts"))
  3. (if (not (vl-string-search w ORIGPATH))
  4.   (progn
  5.     (SETQ MYENV (STRCAT ORIGPATH ONEPATH))
  6.     (if (< (strlen myenv) 1000); <- not sure why you are checking the length
  7.                                          ; I've seen something referring to 800 chars
  8.                                          ; but my normal path is over 900 and I have no problems
  9.       (vla-put-SupportPath *files* myenv)
  10.     )
  11.   )
  12. )

Thanks
Title: Re: Why this lisp not working in CAD2016
Post by: ChrisCarlson on March 09, 2016, 07:38:56 AM
Apparently I'm a repository for Lee  :2funny:

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+ '("B:\\Fonts"))
Title: Re: Why this lisp not working in CAD2016
Post by: Lee Mac on March 09, 2016, 07:41:21 AM
Thanks Chris - I recently updated those functions here: Add & Remove Support File Search Paths (http://www.lee-mac.com/addremovesupportpaths.html)
Title: Re: Why this lisp not working in CAD2016
Post by: kdub_nz on March 10, 2016, 02:09:45 AM
I am wondering why this lisp is working fine in CAD2014 but not working in 2016

Code - Auto/Visual Lisp: [Select]
  1. (SETQ ORIGPATH (vla-get-SupportPath *files*))
  2. (SETQ ONEPATH   (setq w         ";B:\\Fonts"))
  3. (if (not (vl-string-search w ORIGPATH))
  4.   (progn
  5.     (SETQ MYENV (STRCAT ORIGPATH ONEPATH))
  6.     (if (< (strlen myenv) 1000); <- not sure why you are checking the length
  7.                                          ; I've seen something referring to 800 chars
  8.                                          ; but my normal path is over 900 and I have no problems
  9.       (vla-put-SupportPath *files* myenv)
  10.     )
  11.   )
  12. )

Thanks

Since no-one else has asked :
What is not working with the code you posted ?

//=============

FYI: I just checked my AC2016

_$ (strlen myenv)
1608


so I don't understand the 1000 check conditional.