Startup Lisp with Folder Paths?

Startup Lisp with Folder Paths?

MSchille-1994
Collaborator Collaborator
1,610 Views
6 Replies
Message 1 of 7

Startup Lisp with Folder Paths?

MSchille-1994
Collaborator
Collaborator

I have a startup lisp (shown in the screenshot below) that runs each time AutoCAD/Civil 3D is run.  In that lisp file are three different sections.  The first one loads custom lisp routines.  The second one sets various system variables.  The third one runs a couple of commands.

 

I'd like to add a fourth section that includes adding a couple of Support File search paths, a Trusted Folder search path, and a Printer Support search path.  All of these folders reside on our office server.

 

How do I go about adding into my startup lisp, a routine that appends the current folder listings by adding in some custom paths that I want?  For example, in the very first section of the folder paths, Support Folders, I want to add in our m:\ drive.  In the Trusted Folders section I'd like to add in our u:\ drive.  In the Plotter Support Search path I'd like to add in our m:\ drive.

 

I have seen several posts on this idea but they all vary so much so I am not sure where to start and my lisp routine writing ability is pretty limited.

 

Thanks for any help.

Michael

 

MSchille-1994_0-1608315057973.png

 

Attitude, not Aptitude, Determines Altitude
0 Likes
1,611 Views
6 Replies
Replies (6)
Message 2 of 7

alanjt_
Collaborator
Collaborator

Paste the following line of code into the command line and it should give you access to all the pathing changes you want to make.

 

(vlax-dump-object (vla-get-files (vla-get-preferences (vlax-get-acad-object))) T)

 

0 Likes
Message 3 of 7

Sea-Haven
Mentor
Mentor

You want something like this but you should check is path already exist.

 

(setq *files*  (vla-get-files  (vla-get-preferences (vlax-get-Acad-object))))
(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)

(setq oldtrust (getvar 'trustedpaths))
(setq newtrust (strcat oldtrust ";" "L:\\Autodesk..."))
(setvar 'trustedpaths newtrust)

 

 

0 Likes
Message 4 of 7

martti.halminen
Collaborator
Collaborator

We do this in a different way: we use our own profile, which has all the path definitions we need, and define the the profile to use in the shortcut used to start AutoCAD.

- This approach requires that the paths are rather static. If you need different paths depending on which customer or which project you are working on, the programmatic approach would be better.

0 Likes
Message 5 of 7

MSchille-1994
Collaborator
Collaborator

Okay @Sea-Haven , so I put that into my lisp file and it works the first time I run cad.  Problem is, the next time I run cad, it adds those paths in again, so I end up with multiple instances of my folder paths.  This kind of makes sense as the second time I run cad, it IS getting the search paths, which already contain the folders I want, so it adds them in but then puts back the previous set of search paths, which already contained the extra folders I want.  See below.......

 

MSchille-1994_0-1608563253719.png

 

Attitude, not Aptitude, Determines Altitude
0 Likes
Message 6 of 7

alanjt_
Collaborator
Collaborator

Read the existing paths and use wcmatch to see if they already exist. If so, skip and onto the next. 

0 Likes
Message 7 of 7

MSchille-1994
Collaborator
Collaborator

Sorry @alanjt_ , I am very novice to Lisp and trying to make this work.  What do you mean to use "WCMATCH"?

Attitude, not Aptitude, Determines Altitude
0 Likes