Auto-add paths to Support File Search Path

Auto-add paths to Support File Search Path

johnw
Collaborator Collaborator
4,802 Views
14 Replies
Message 1 of 15

Auto-add paths to Support File Search Path

johnw
Collaborator
Collaborator

I need a programmer that could create a program that would run PRIOR to autocad searching for / loading the acad.lsp and acaddoc.lsp files. I need it to run prior because all my lisp routines are located within the acaddoc.lsp which is to be located in the C:\Lisp folder. I wanted to know if you'd be interested in helping me out and if so, what would you charge to create such a program. The details of what I need are listed below:

 

-------------------------

 

I have 4 folders paths that I need ADDED at the TOP of the Support File Search Path: If these files were already there then nothing would need to be added.

 

C:\Lisp

C:\Blocks

C:\Symbol

C:\Fonts

 

Then under Customization Files:

 

                       Custom Icon Location:

 

                                                  C:\Bitmaps

 

Then under Text Editor, Dictionary

 

                      Custom Dictionary:

 

                                                 C:\blocks\dictionary\,mycustom.dictionary.cus

 

 

Any help would really be appreciated.


Thank you.

0 Likes
4,803 Views
14 Replies
Replies (14)
Message 2 of 15

doaiena
Collaborator
Collaborator

It's generally not good practice to put your routines in the acaddoc.lsp file. Acaddoc is mostly used to set paths/variables and to load applications, that reside in a different location.

If i may suggest, why don't you create/append the acaddoc.lsp file at the default acad support path, with just setting up paths, and load your routines from lets say "C:\Lisp\routines.lsp".

You can get the
support file search paths at: (vla-get-supportpath (vla-get-files (vla-get-preferences (vlax-get-acad-object))))
custom icon location at: (vla-get-customiconpath (vla-get-files (vla-get-preferences (vlax-get-acad-object))))

custom dictionary at: (vla-get-customdictionary (vla-get-files (vla-get-preferences (vlax-get-acad-object))))

 

Or you can altogether skip acaddoc.lsp modification and just create a C:\Lisp\Loader.lsp file that will contain all your paths, variables, etc and add it to AutoCAD's startup suite. That way it will always load with each document.

I'm not sure i fully understood what you are trying to achieve, so if i have the wrong idea, please elaborate on exactly what you want to do.

Message 3 of 15

_gile
Consultant
Consultant

Hi,

 

What about using the AutoCAD Profile feature?

You can create a new profile, set the paths to suit your needs, export the profile and deploy it.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 4 of 15

john.uhden
Mentor
Mentor

Didn't there used to be a command line option for acad.exe?   /P <profile name>?

If so, I wonder if it still exists.  Of course it's not going to help if you launch a DWG from Explorer.

 

But I'm pretty sure I recall setting up a lisp routine for loading optional profiles using DCL.

John F. Uhden

Message 5 of 15

johnw
Collaborator
Collaborator
I cannot use profiles because I don’t want to overwrite anyone else’s global setup or other settings. All I want to do is add a few paths as listed to a persons existing setup. This routine I’m looking to get done will be sent to others I work with and it is needed for them to use my system wherever they are in the world.
0 Likes
Message 6 of 15

_gile
Consultant
Consultant

What about using the Autoloader mechanism?



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 7 of 15

_gile
Consultant
Consultant

@johnw wrote:
I cannot use profiles because I don’t want to overwrite anyone else’s global setup or other settings. All I want to do is add a few paths as listed to a persons existing setup. This routine I’m looking to get done will be sent to others I work with and it is needed for them to use my system wherever they are in the world.

Adding support paths, changing the custom icons location, the custom dictionary location and so on does overwrite at one existing profile.

 

Adding a new profile with the settings you need is the only way to avoid overriding an existing one.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 8 of 15

john.uhden
Mentor
Mentor

True, but I think one could build in a saveas function to create the new profile wirthout permanently affecting the existing.

John F. Uhden

0 Likes
Message 9 of 15

johnw
Collaborator
Collaborator
Yes I assume it would modify certain aspects if their existing settings. Just don’t want to overwrite all of them.
0 Likes
Message 10 of 15

_gile
Consultant
Consultant

I purposed to create a new one and deploy it so that you do not overwrite none of them.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 11 of 15

johnw
Collaborator
Collaborator

GIle, i don't know anything about "deploying" anything. I've created different profiles for different things within my office, but as I mentioned earlier, my routines are going onto strangers computers and keeping things as much the same as possible for all of them seems like the best move...at least until someone can explain a better way to accomplish what i need.

 

Thanks for all the posts and comments. I'm having a hard time providing any better feedback since I do not know how to write any external program for autocad. so all i can do is describe what I'm trying to do.

Message 12 of 15

pbejse
Mentor
Mentor

@johnw wrote:
 

Thanks for all the posts and comments. I'm having a hard time providing any better feedback since I do not know how to write any external program for autocad. so all i can do is describe what I'm trying to do.


Autoloader Mechanism approach:

 

I'm attaching a ZIP file for you to try.  Copy the files to your 

 

C:\Users\YOURUSERNAME\AppData\Roaming\Autodesk\ApplicationPlugins\ <---- extract here

C:\Users\YOURUSERNAME\AppData\Roaming\Autodesk\ApplicationPlugins\JohnWagner.bundle <-- it should look like this.

 

I created a demo installer for you.

 

johnW.PNG

 

For now, You can place the bundle in the folder without actually installing it because you lack the knowledge to create an MSI file.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

If you do this correctly, you should see this at startup

 

 


::---------------------------------------------------------:: :: 1st lisp File for demo loaded :: ::---------------------------------------------------------:: ::---------------------------------------------------------:: :: 2nd lisp File for demo loaded :: ::---------------------------------------------------------:: ::---------------------------------------------------------:: :: Files for demo loaded :: ::---------------------------------------------------------::

 

So the deal is, you put all your support files in this folder and AutoCAD will find it:

C:\Users\YOURUSERNAME\AppData\Roaming\Autodesk\ApplicationPlugins\JohnWagner.bundle\Contents\Windows such as .lin/.pat/.cus etc.

 

 

HTH

 

Message 13 of 15

johnw
Collaborator
Collaborator

Gile,

 

please clarify: does this extraction also add the "C:\Lisp" path (verbiage) to the Options/Files Tab/Support File Search Path (at the top) - see image attachment?

 

 

0 Likes
Message 14 of 15

JamesMaeding
Advisor
Advisor

ok, now things are getting complicated.

I get what the OP wants, and really anyone who runs their own folder with acaddoc.lsp would need their path at the top before acad starts.

 

The only way to modify support paths outside of acad is through the registry, its easy too, here is the key:

HKEY_CURRENT_USER\SOFTWARE\Autodesk\AutoCAD\R22.0\ACAD-1001:409\Profiles\HA_ACAD2018\General\

modify the ACAD item.

 

You would have to write some prog to do that, as it would look at the different profiles defined and do the ones desired.

The key above is my profile of course.

 

Having said that, if you are asking users to start with a generic profile, and then you will "take it over" with your startup lisp, that is very heavy handed.

If you are taking that much control, you should have provided them a company standard profile to begin with.

To do that, you make the profile, export it to .arg, then make an acad icon with /P and the arg name after.

It will make the profile from the arg the FIRST time its run. After that, the icon simply switches to it, it will no recreate over and over.

So /p is gentle, it does not wipe out user changes once the profile is created.

 

At my place, if you change the top path, thus losing the path to acaddoc.lsp, you hosed the profile.

I tell them to rename the profile, thus causing the icon to remake it from the arg, starting them over.

Also, in my acaddoc.lsp, I control the other paths like fonts as they need to be at the bottom or close.

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 15 of 15

johnw
Collaborator
Collaborator

yes, things seemed to get very complicated.

 

From what I originally wanted to what is currently being suggested is getting way too deep for what I need.

 

I appreciate everyone's comments and suggestions.

 

John

0 Likes