Author Topic: Support file Search path problem  (Read 7836 times)

0 Members and 1 Guest are viewing this topic.

trogg

  • Bull Frog
  • Posts: 255
Re: Support file Search path problem
« Reply #15 on: July 12, 2013, 03:32:39 PM »
Alan,
Do you know of a way to load files if they are in a sub folder of the folder that is defined in the support path?
This function worked fine in the folder that I defined in the support path. Thanks
~Greg

Just because a lisp "file" resides in a path that is in the Support File Seach Path, does not mean the functions in the file are loaded automagically.

Unless you pen a function do do precisely that. :wink:

Quick and dirty:

Code: [Select]
(defun _loadSupportPathLisps (/ str)
  (setq str (vla-get-supportpath (vla-get-files (vla-get-preferences (vlax-get-acad-object)))))
  (while (setq i (vl-string-search ";" str))
    (foreach file (vl-directory-files (substr str 1 i) nil 1)
      (if (wcmatch (strcase file) "*.FAS,*.LSP,*.VLX")
        (load file nil)
      )
    )
    (setq str (substr str (+ i 2)))
  )
  (princ)
)

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Support file Search path problem
« Reply #16 on: July 12, 2013, 04:40:55 PM »
Alan,
Do you know of a way to load files if they are in a sub folder of the folder that is defined in the support path?
Perhaps
Code - Auto/Visual Lisp: [Select]
  1. (load ".\\SubFolder\\FileName")
Or even just
Code - Auto/Visual Lisp: [Select]
  1. (load "SubFolder\\FileName")
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: Support file Search path problem
« Reply #17 on: July 29, 2013, 12:58:37 PM »
@ Coder:
Note: acad has some "special" filenames it searches for. If it finds such file(s) it loads them automatically. ........ things like acad.lin

Correct me if I'm wrong, but AutoCAD does not search for "acad.lin" at any time except when you run the Linetype command, Load option, and even then it's only a suggested file from which to load linetype definitions.

My point is that you can have multiple acad.lin files (or none at all) and it has no effect on the operation of AutoCAD with respect to linetypes in drawings that you open, because linetypes used by drawings are stored in the drawing file, not in external files. Having said that, complex linetypes in drawing files that reference shapes or fonts do require that those shapes or fonts reside in a path that is in the current SFSP, or possibly contain a hard-coded path to the shape/font.

I know this is a bit off-topic, but I thought it was worth mentioning. Thanks!

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Support file Search path problem
« Reply #18 on: July 30, 2013, 06:39:45 AM »
Correct me if I'm wrong, but AutoCAD does not search for "acad.lin" at any time except when you run the Linetype command, Load option, and even then it's only a suggested file from which to load linetype definitions.
You're absolutely correct. It was probably a bad example.  :?
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.