TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: domenicomaria on August 31, 2022, 09:11:25 AM
-
is it possible via LISP to change the order of the paths in the support file search path?
-
Yes it is possible, but what's the benefit of that new sorting / order since paths will be the same ?
-
I suppose that the files found in the folders at the top are found first ...
...
and if there are two files with the same name, the one in the topmost folder is found first
-
Try something like this.
(vla-put-supportpath
(vla-get-files (vla-get-preferences (vlax-get-acad-object)))
(strcat
"\\\\1\\designdata\\cadd\\dc acad\\default\\general\\support\\2021 lsp;"
"\\\\1\\designdata\\cadd\\dc acad\\default\\general\\support\\;"
"\\\\1\\designdata\\cadd\\dc acad\\default\\general\\symbols;"
"\\\\1\\designdata\\cadd\\dc acad\\default\\general\\fonts;"
"\\\\1\\designdata\\cadd\\dc acad\\default\\mech;"
"\\\\1\\designdata\\cadd\\dc acad\\default\\mech\\support;"
"\\\\1\\designdata\\cadd\\dc acad\\default\\elec\\support\\symbols;"
"\\\\1\\designdata\\cadd\\dc acad\\default\\elec\\anno\\job setup;"
(getenv "appdata")"\\Autodesk\\AutoCAD 2021\\R24.0\\enu\\support;"
"C:\\program files\\autodesk\\autocad 2021\\support;"
"C:\\program files\\autodesk\\autocad 2021\\support\\en-us;"
"C:\\program files\\autodesk\\autocad 2021\\fonts;"
"C:\\program files\\autodesk\\autocad 2021\\help;"
"C:\\program files\\autodesk\\autocad 2021\\express;"
"C:\\program files\\autodesk\\autocad 2021\\support\\color;"
"C:\\program files (x86)\\autodesk\\applicationplugins\\autodesk appmanager.bundle\\contents\\resources;"
"C:\\program files (x86)\\autodesk\\applicationplugins\\autodesk appmanager.bundle\\contents\\windows\\2021;"
"C:\\program files (x86)\\autodesk\\applicationplugins\\autodesk featuredapps.bundle\\contents\\resources;"
"C:\\program files (x86)\\autodesk\\applicationplugins\\autodesk featuredapps.bundle\\contents\\windows\\2021\\win64;"
)
)
Yes it is possible, but what's the benefit of that new sorting / order since paths will be the same ?
First one wins in a search. I let my people add a personal folder up top create custom things like pgp and lsp routines. I also give them the option of using a personal lisp routine via a workspace for things they want that are not company policy.
-
You can use this function (http://lee-mac.com/addremovesupportpaths.html#addsfspn) to insert a support path at a specific position in the list.
-
You can use this function (http://lee-mac.com/addremovesupportpaths.html#addsfspn) to insert a support path at a specific position in the list.
I can't test your feature right now,
but I'm sure, as always,
it will be perfect ...
... thank you very much
-
You can use this function (http://lee-mac.com/addremovesupportpaths.html#addsfspn) to insert a support path at a specific position in the list.
I tested your function, and it works perfectly, of course . . .
Thanks again
-
You're welcome maria, I'm glad it helps.
-
You're welcome maria, I'm glad it helps.
:no:
:laugh:
My first name is Domenico
I am male
Maria is my second name and is a woman's name !
-
Oops! :uglystupid2:
-
A couple of other ideas,
Lee pretty sure you have the dcl with 2 lists you select from the left and it adds to the right box hence new list order then would update paths.
Export paths to a file, reorder then just read back in as code.
As I write code for external clients have to make sure when testing that their directory is always 1st, in case I have done a mod on some library routines.
A quick and dirty would just drag and drop lsp etc not really a end user program.
; thanks to Lee-mac for this defun
; www.lee-mac.com
; 44 is comma 32 is space . is 46 ; is 59
(defun _csv->lst ( strtxt / pos )
(if (setq pos (vl-string-position 59 strtxt))
(cons (substr strtxt 1 pos) (_csv->lst (substr strtxt (+ pos 2))))
(list strtxt)
)
)
(setq *files* (vla-get-files (vla-get-preferences (vlax-get-Acad-object))))
(setq paths (vla-get-SupportPath *files*))
(setq lstpaths (_csv->lst59 paths))
(setq fo (open "D:\\acadtemp\\paths.txt" "W"))
(write-line "(setq *files* (vla-get-files (vla-get-preferences (vlax-get-Acad-object))))" fo)
(write-line "(vla-put-SupportPath *files* (strcat " fo)
(foreach path lstpaths
(write-line (strcat " \"" path ";\"") fo)
)
(write-line "))" fo)
(close fo)
(alert "Edit using Notepad then just copy and paste to command line")
(startapp "NOTEPAD" "D:\\acadtemp\\paths.txt")