BIGAL Posted November 15, 2021 Share Posted November 15, 2021 An extra bug ^c^c^ is wrong cancel cancel does not need the last ^ ^c^c is correct this may have been causing early errors ^c^c^p is often used also. 1 Quote Link to comment Share on other sites More sharing options...
jim78b Posted December 20, 2021 Author Share Posted December 20, 2021 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; Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 22, 2021 Share Posted December 22, 2021 Try changing "/" to "\\" 1 Quote Link to comment Share on other sites More sharing options...
jim78b Posted December 22, 2021 Author Share Posted December 22, 2021 SORRY NOT WORKI (LOAD "C:\\Users\\Utente\\Dropbox\\Lavoro\\backup\\AUTOCAD\\Lisp\\BLOCCHI\\add2block.lsp");add2block; Quote Link to comment Share on other sites More sharing options...
tombu Posted December 22, 2021 Share Posted December 22, 2021 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. 1 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 22, 2021 Share Posted December 22, 2021 Like Tombu maybe also no need for ; that is the case for a normal mnu. ^C^C(LOAD "add2block.lsp") add2block Quote Link to comment Share on other sites More sharing options...
jim78b Posted December 23, 2021 Author Share Posted December 23, 2021 And the relative path where is? Quote Link to comment Share on other sites More sharing options...
Steven P Posted December 23, 2021 Share Posted December 23, 2021 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. 1 Quote Link to comment Share on other sites More sharing options...
tombu Posted December 23, 2021 Share Posted December 23, 2021 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? 1 Quote Link to comment Share on other sites More sharing options...
jim78b Posted December 23, 2021 Author Share Posted December 23, 2021 Ok thanks understand 1 Quote Link to comment Share on other sites More sharing options...
Steven P Posted December 23, 2021 Share Posted December 23, 2021 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. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 23, 2021 Share Posted December 23, 2021 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. Quote Link to comment Share on other sites More sharing options...
Steven P Posted December 23, 2021 Share Posted December 23, 2021 ... I wouldn't but it is about the only reason I could think of why anyone would want to save a LISP file in a relative path to the drawing. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.