Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Setting Support File Search Paths in lisp routine

17 REPLIES 17
Reply
Message 1 of 18
Anonymous
12724 Views, 17 Replies

Setting Support File Search Paths in lisp routine

Hey guys

 

I have a simple lisp routine that loads everytime one of my users opens a new drawing, It sets the printer paths, sets the template paths and sets a bunch of environment variables

 

One thing I would like to add to this lisp routine is the ability to add support file search paths.

 

 

Is there a simple setenv variable for this? or is it more complicated?

 

any advice is appreciated.

 

Thanks!

 

Chris

 

17 REPLIES 17
Message 2 of 18
Lee_Mac
in reply to: Anonymous

Message 3 of 18
BlackBox_
in reply to: Anonymous

Also worthy of note for those using 2012+ when manipulating SFSP, the Autoloader mechanism adds all app-dependent SupportPaths prior to Acad.lsp, and AcadDoc.lsp being loaded in the startup sequence.

 

It is important to ensure that any path containing \ApplicationPlugins\ NOT be removed from SFSP, as this may cause SupportPath-dependent Autoloader apps to stop working properly.

 

Cheers



"How we think determines what we do, and what we do determines what we get."

Message 4 of 18
smbrennan
in reply to: Lee_Mac

Lee_Mac

I am trying to utilize your Add & Remove Support File Search Paths - but I am having some difficulty. I haven't programmed in 14 years, and even at that, it was an introduction to C++ - needless to say I'm a bit out of it.

I am trying to run your LM:sfsp+ function via acad.lsp. I copied the entire "Function Description" code into it's own .lsp file. The acad.lsp file contains your "Function Call", and I am defining the folders I wish to add within the call. However, I don't see those folders when I re-open CAD. What am I missing??? I am using MEP 2015.

Thanks,
Shawn
Shawn B.

      |   
To help improve Autodesk Products, please Click Here to Vote for ideas and submit your own.
Message 5 of 18
mid-awe
in reply to: Anonymous

Here is how I've been doing it for many years:

 

(DEFUN AddSupportPath (dir / tmp Cpath)
  (VL-LOAD-COM)
  (SETQ	Cpath (GETENV "ACAD") tmp (STRCAT ";" dir ";"))
  (IF (NOT (VL-STRING-SEARCH dir cpath)) (SETENV "ACAD" (STRCAT Cpath ";" dir)))
  (PRINC)
)
(AddSupportPath "C:\\Symbols")
(AddSupportPath "C:\\Drawings")
(AddSupportPath "C:\\Lisps")

 Not as awesome as Lee's but it has not let me down ever.

Message 6 of 18
smbrennan
in reply to: mid-awe

Thanks Mid-Awe! That does the trick for me. Much easier to understand too! I'm still learning AutoLISP so easier = better (for now).
Shawn B.

      |   
To help improve Autodesk Products, please Click Here to Vote for ideas and submit your own.
Message 7 of 18
Lee_Mac
in reply to: smbrennan

smbrennan85 wrote:
Lee_Mac

I am trying to utilize your Add & Remove Support File Search Paths - but I am having some difficulty. I haven't programmed in 14 years, and even at that, it was an introduction to C++ - needless to say I'm a bit out of it.

I am trying to run your LM:sfsp+ function via acad.lsp. I copied the entire "Function Description" code into it's own .lsp file. The acad.lsp file contains your "Function Call", and I am defining the folders I wish to add within the call. However, I don't see those folders when I re-open CAD. What am I missing??? I am using MEP 2015.

Thanks,
Shawn

 

Hi Shawn,

 

The key point is that the function will need to be defined before the function call is evaluated - that is, the defun expression will need to be evaluated before the call to the function is evaluated.

 

I would suggest copying the code for my Add Support Paths Function into its own .lsp file, and then, on a new line following the code (in the same file), place the function call, i.e. something like:

 

(LM:sfsp+ '("C:\\Folder1" "C:\\Folder2" "C:\\Folder3"))

 

You can then load this .lsp file from the acad.lsp, and the function will be defined & evaluated.

 

Lee

Message 8 of 18
smbrennan
in reply to: Lee_Mac

Ahh ok. I think my problem was that I was placing the function call in the acad.lsp file itself. I knew something wasn't right with my own logic - but it makes sense now.

Thanks for the prompt reply Lee!
Shawn B.

      |   
To help improve Autodesk Products, please Click Here to Vote for ideas and submit your own.
Message 9 of 18
Lee_Mac
in reply to: smbrennan

You're welcome Shawn Smiley Happy

Message 10 of 18
m_rogoff
in reply to: Anonymous

I'm wondering what advantages this has opposed to setting a profile and workspace?  Now that would be too simple...?

I am looking for something similar, but I run on LT and profiles (or lisp for that matter) are not supported. Have you looked into changing the system registry keys?

 

Message 11 of 18
DanSingleton
in reply to: Lee_Mac

Sorry for bumping an old thead but I'm in the process of getting ready for our upgrade and have wanted to implement something like this for quite a while. Our network hiccups and we lose the paths. I also have certain users changing the pathing on their own and I'd like to stop that if possible. 

 

1. Is it better to put custom paths before the default SFSP, or after? Would this make any difference for performance or load times?

2. Is there a quick way to reset the SFSP back to the Autodesk default? This is so I can quickly reset to default to remove user customizations and add the company standard paths?

3. Is there anyway to lock the the SFSP? This is to prevent my users "accidentally" changing them.

 

Thanks,

Message 12 of 18
DanielLench_
in reply to: Anonymous

Excuse the resurrection of an old thread but I believe this to be the earliest and best on this topic and am asking @Lee_Mac for direction on how to pass a variable into the function call?

 

I'm trying to pass (LM:sfsp+n '("$Dir1" "$Dir2" "$Dir3" "$Dir4") 0) and have tried all manner of formatting that I can think of.

 

For this example assume the following:

(setq $Dir1 "C:\\ACC\\ACCDocs\\XYZ\\XYZ_ACAD Support\\_C3D\\2024\\"))

(setq $Dir2 "G:\\XYZ_ACAD Support\\_C3D\\2024\\")
(setq $Dir3 "C:\\ProjectWise\\XYZ\\C3D\\2024\\")

(setq $Dir4 "C:\\ACAD\\XYZ_ACAD Support\\_C3D\\2024\\")

 

Thanks in advance!

Message 13 of 18
Sea-Haven
in reply to: Anonymous

Easy just make a string the paths are seperated by a semi colon ;

 

";C:\\ACC\\ACCDocs\\XYZ\\XYZ_ACAD Support\\_C3D\\2024\\;G:\\XYZ_ACAD Support\\_C3D\\2024\\;C:\\ProjectWise\\XYZ\\C3D\\2024\\;C:\\ACAD\\XYZ_ACAD Support\\_C3D\\2024\\"

 

;make new support paths exist + new
(setq paths (vla-get-SupportPath *files*))
(setq XXXXpaths "L:\\autodesk\\supportfiles;L:\\autodesk\\lisp;L:\\autodesk\\fonts;")
(setq newpath (strcat XXXXpaths paths))
(vla-put-SupportPath *files* newpath)

 

 

Message 14 of 18

Thanks @Lee_Mac , do you know if this works on Sharepoint as each individuals folder path has their name in it?  Would I have to strcat the name to input their name in the correct place?

 

Something like this;


(LM:sfsp+ '("C:\\Users\\NAME\\OneDrive - Property\\Standards\\00_CAD Standards\\Lisp Routines"))

 

I can't seem to get it work even if I use my filepath.  Any ideas?  and thank you 🙂

Message 15 of 18

Thanks @Lee_Mac , do you know if this works on Sharepoint as each individuals folder path has their name in it?  Would I have to strcat the name to input their name in the correct place?

 

Something like this;


(LM:sfsp+ '("C:\\Users\\NAME\\OneDrive - Property\\Standards\\CAD Standards\\Lisp Routines"))

 

I can't seem to get it work even if I use my filepath.  Any ideas?  thank you

Message 16 of 18

You can get (getenv "username") and it is different for different users, so can then match that to the server name, by comparing in a list. used this for printing in a multi Storey building only 1 code but printers on multiple floors.

Message 17 of 18

Hi there, I've created a routine to update the support paths but it something weird has gone on and it looks as if its copied folders!!  We are on One Drive so unsure if its the coding or somebody else moving things (everybody says they haven't!).

Would this code download anything or purely update the template support paths within Autocad??

; template path
(vla-put-TemplateDwgPath *files* (strcat "C:\\Users\\" (getvar "username") "\\OneDrive\\Formats and Standards\\00_CAD Standards\\Templates\\_pg_x-ref drawing pack\\"))


; template location
(vla-put-QnewTemplateFile *files* (strcat "C:\\Users\\" (getvar "username") "\\onedrive\\formats and standards\\00_cad standards\\templates\\_pg_x-ref drawing pack\\xxxx-xx-master.dwt"))

 

Thank you, apologies I'm just fretting 😂

 

Any help appreciated.

Message 18 of 18
Owackenreuther
in reply to: Anonymous

I think it is worth mentioning that this can also be accomplished by setting SFSP in the target of the shortcut, or setting it up in the installation deployment.

 

My preference is pointing to a shared acad.lsp and acaddoc.lsp on a network drive in the deployment. Control permissions in this path and modify as desired.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report