Jump to content

load lisp from tool palettes


jim78b

Recommended Posts

  • 1 month later...

Sorry how cai i make the path relative, so if in future i will change sub dir autocad find it?

(LOAD "C:/Users/Utente/Dropbox/Lavoro/backup/AUTOCAD/Lisp/Polilinee/polywidthzero.lsp");polywidthzero;

Link to comment
Share on other sites

Follow AutoCAD guidelines and put your lisp files in a folder in both the Support File Search Path and Trusted folders to minimize the possibility of loading and executing malicious code, always set the TRUSTEDPATHS system variable to unique, read-only folders where your authorized applications are located. 

 

Then you never have to put paths in macros again.

^C^C(LOAD "add2block.lsp");add2block

would be all you need.

  • Agree 1
Link to comment
Share on other sites

5 hours ago, jim78b said:

And the relative path where is?

 

Relative path... has to be relative to something else. So if I have a drawing saved in "c:\Users\stevenp\mydrawings\adrawing.dwg" then the relative path to that drawing is "c:\Users\stevenp\mydrawings". It might be you save a specific LISP file with the drawing folder and there are ways to set a relative path to the drawing you have open (for example, if I have LISPs specific to Client A, it might make sense to keep them in the folder for Client A with the drawings, all together in one place for 1 client).

 

Or you could define a specific file path for all your LISP files, such as "c:\users\stevenp\AllMyLISPS\" and in the AutoCAD Appload startup suite tell it to open that file in that location, needing to change it every time you move your LISPs or update your CAD version

 

Or you could do as suggested above and save your LISP files in a trusted location, no need to tell AutoCAD where it it saved, it looked in these Trusted locations automatically.

  • Like 1
Link to comment
Share on other sites

On 12/20/2021 at 3:50 AM, jim78b said:

Sorry how can I make the path relative, so if in future I change sub dir autocad find it?

(LOAD "C:/Users/Utente/Dropbox/Lavoro/backup/AUTOCAD/Lisp/Polilinee/polywidthzero.lsp");polywidthzero;

Doesn't even matter what folder the lisp is in or moved to as long as it's in both the Support File Search Path and Trusted folders  the 

^C^C(LOAD "polywidthzero.lsp");polywidthzero

will work!

 

Relative paths are useful to relate xrefs to the location of the current drawing so they are preserved when moving a project folder with references to subfolders. Why would you use relative paths in loading a lisp macro with no way of knowing what the location of the current drawing is in advance? 

  • Like 1
Link to comment
Share on other sites

5 hours ago, tombu said:

Why would you use relative paths in loading a lisp macro with no way of knowing what the location of the current drawing is in advance? 

 

Can I play devils advocate here, though this isn't something I do and doesn't really help.

So I make a LISP file in the trusted location / start up suit with a LISP something like "C:Clientsetup" (I am using my example from above). So then when I get a project from client A, I save in the drawings folder a second LISP file, with say "C:ClientPgeSetup" and this is run from C:Clientsetup. If I get Client B, I do the same. and save a file in their drawing folder with their page setups, but called the same as Client As (2 or more files in the relative paths with the same names).

Right so to set up a project I can modify the client specific Lisps, maybe set line weights, colours, import border and so on and after that no matter which client I am working for, the I only need to use C:Clientsetup with no more thought.... uses a relative file path to load the LISP file.

 

Like I said, playing devils advocate, there is a remote possibility that someone might want to do that, however for everyday LISPS the other options are the best.

 

 

Link to comment
Share on other sites

Steven P I just did make a new client layout for a client, it is added to the master layout dwg. It contains around 20 layouts various sizes and por/Land. So user selects a client name and size and in say a dwt the correct title block layout is inserted plus notes etc with client details filled in.

 

I would not be going down the path of a new lisp for each client. Why not Client A.dwt, Client B.dwt much easier. Just edit for Client C.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...