Author Topic: Why this lisp not working in CAD2016  (Read 1823 times)

0 Members and 1 Guest are viewing this topic.

HasanCAD

  • Swamp Rat
  • Posts: 1421
Why this lisp not working in CAD2016
« 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

ChrisCarlson

  • Guest
Re: Why this lisp not working in CAD2016
« Reply #1 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"))

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Why this lisp not working in CAD2016
« Reply #2 on: March 09, 2016, 07:41:21 AM »
Thanks Chris - I recently updated those functions here: Add & Remove Support File Search Paths

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2132
  • class keyThumper<T>:ILazy<T>
Re: Why this lisp not working in CAD2016
« Reply #3 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.
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.