TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: domenicomaria on August 31, 2022, 09:11:25 AM

Title: change the order of the paths in the support file search path
Post 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?
Title: Re: change the order of the paths in the support file search path
Post by: Tharwat on August 31, 2022, 10:01:04 AM
Yes it is possible, but what's the benefit of that new sorting / order since paths will be the same ?
Title: Re: change the order of the paths in the support file search path
Post by: domenicomaria on August 31, 2022, 10:33:07 AM
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
Title: Re: change the order of the paths in the support file search path
Post by: Lonnie on August 31, 2022, 11:07:06 AM
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.


Title: Re: change the order of the paths in the support file search path
Post by: Lee Mac on August 31, 2022, 01:02:23 PM
You can use this function (http://lee-mac.com/addremovesupportpaths.html#addsfspn) to insert a support path at a specific position in the list.
Title: Re: change the order of the paths in the support file search path
Post by: domenicomaria on August 31, 2022, 01:26:35 PM
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
Title: Re: change the order of the paths in the support file search path
Post by: domenicomaria on September 01, 2022, 05:12:44 AM
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
Title: Re: change the order of the paths in the support file search path
Post by: Lee Mac on September 01, 2022, 12:28:04 PM
You're welcome maria, I'm glad it helps.
Title: Re: change the order of the paths in the support file search path
Post by: domenicomaria on September 01, 2022, 02:01:57 PM
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 !
Title: Re: change the order of the paths in the support file search path
Post by: Lee Mac on September 01, 2022, 04:57:21 PM
Oops! :uglystupid2:
Title: Re: change the order of the paths in the support file search path
Post by: BIGAL on September 01, 2022, 09:17:42 PM
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.

Code: [Select]
; 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")