KFesting Posted July 15, 2014 Posted July 15, 2014 Hi all, Chasing a bit of help with this one. I use LISP files fairly routinely but generally rely on the CUI and the startup suite to load my routines - however, lately, the startup suite doesn't load ALL of my lisp routines. Seems to be all of my newer ones it doesn't like. After a bit of research online, it looks like acaddoc.lsp is the way to go in terms of startup. I've found my existing acad2012doc.lsp file in Program Files. Can anyone walk me through what the best way to use this is? Do I copy and paste the text from all of my individual lisp routines into this one file? Cheers. Quote
7o7 Posted July 15, 2014 Posted July 15, 2014 You do not need to copy and paste all your lisp into one file. Only put (load "...") with "..." is the name of lisp file. All your lisp files are put in the same directory with acaddoc.lsp. Quote
KFesting Posted July 15, 2014 Author Posted July 15, 2014 Thanks for your reply 7o7. I am using Autocad 2012 - should my file just be acaddoc.lsp or acad2012doc.lsp? I've found the latter in C:\Program Files\Autodesk\AutoCAD 2012 - English\Support but am having problem saving the file (even with administrator login it says access denied). This second file already has a fair bit of information in it - should I be starting from a blank file? I normally use C:\Users\USER\AppData\Roaming\Autodesk\AutoCAD 2012 - English\R18.2\enu\Support for all of my lientypes etc. but previosuly just had my LISP routines saved in My Documents folder and loaded using APPLOAD. Should I be creating a standard acaddoc.lsp file in the above directory and putting all of my LISP routines in there? Quote
7o7 Posted July 15, 2014 Posted July 15, 2014 Of course you should. Acad2012doc.lsp only loaded once when you first open Autocad, but acaddoc.lsp is loaded with every dwg file when opened. If there is no acaddoc.lsp you can create a new one by notepad. When you put (load "...") in your acaddoc.lsp, your routine is automatically loaded every time you open a dwg file. Quote
KFesting Posted July 15, 2014 Author Posted July 15, 2014 No problems. So I've created the new blank acaddoc.lsp in the R18.2\enu\Support filepath and put the (load "...") in this file. How do I ensure the acaddoc.ls[ file is loaded every time AutoCad opens? I've added the Support foler to the Support File Search Path in AutoCad options but this doesn't seem to load the lisps upon restart? Sorry for the silly questions but your help is appreciated. Quote
7o7 Posted July 15, 2014 Posted July 15, 2014 I prefer the old way: I use acad.lsp with (load "...") instead of acaddoc.lsp and I put all my lisp files including acad.lsp in D:\lisp directory (for the fear of C drive is sometime broken down), registerthe path in Support File Search Path -> D:\lisp . Be sure checking Options>System>Load acad.lsp with every drawing. Quote
MSasu Posted July 15, 2014 Posted July 15, 2014 Although the issue looks clarified, I would like to add a suggestion to avoid usage on acad20##.lsp or acad20##doc.lsp for custom tools; those were reserved by system and may be overwritten without warning (i.e. at a service pack installation). Quote
KFesting Posted July 15, 2014 Author Posted July 15, 2014 I'm still not having much luck with that so far... So here is what I've done. Created a folder in called 'LISP'S' in C:\Users\USER\Documents Inside this folder, I have my commonly used .lsp files that normally work fine using the APPLOAD command. Also in this folder I have a notepad file called acaddoc.lsp. Inside this file I simply have several lines saying (load "ROTMULT") (this is an example of a lisp routine I use to rotate multiple MTEXT items around their common basepoint). I've then saved this file so it is up to date and added C:\Users\EMPIRE\Documents\LISP'S to the Support File Search Path inside of AutoCad 2012. I've also set ACADLSPASDOC to 1 (same as Options>System>Load acad.lsp with every drawing). Now, I've rebooted CAD several times and can't get any of the LISP routines to load at all any more. They work if I use the old method of adding them in using APPLOAD, but this new method doesn't seem to work. Is it the acaddoc.lsp file causing issues, or the file path? I can post examples up here if that will help? Cheers, Kenny. Quote
MSasu Posted July 15, 2014 Posted July 15, 2014 Please paste this statement on command prompt: (findfile "acaddoc.lsp") It will prove you if AutoCAD see said file (and from what path) or not. Quote
KFesting Posted July 15, 2014 Author Posted July 15, 2014 That returns a 'nil' value, so I presume it isn't mapping to the directory correctly. Quote
MSasu Posted July 15, 2014 Posted July 15, 2014 Do you have the extension displayed (from Windows Explorer --> Folder Options) on your workstation? If not, please check that is possible that the tool you used to create that file had appended an extra extension - example: acaddoc.lsp.txt Quote
KFesting Posted July 15, 2014 Author Posted July 15, 2014 Yep - that seemed to work. Most LISP's load now, only a select few that don't... In the (load "...") section of the acaddoc.lsp file - does the "..." need to refer to the physical file name of the lisp routine or the actual defun c: name? Or should these both be the same? Quote
MSasu Posted July 15, 2014 Posted July 15, 2014 The LOAD function require the name/path of a LSP/FAS/VLX file as first argument. There is no restriction or recommended practice on naming the file (except of using a relevant name). Quote
KFesting Posted July 15, 2014 Author Posted July 15, 2014 Is there any way or need to 'refresh' or resync the acaddoc.lsp file? I've added 9 LISP routines to the documents - the first 5 all work but I can't get any others to be recognized by ACad. Quote
MSasu Posted July 15, 2014 Posted July 15, 2014 Out of 9 loading statements, if the first 5 loads correctly, but the remaining 4 not, looks that there is a problem with the file from 6th position. If its loading process fails from an internal error, then the following ones will not be reached. Try to open that file in AutoLISP editor (command VLIDE) and load it from there - you may be able to locate and fix the error. Do the same for any other trouble-maker ones. Presume that the files that doesn't load were located on a path from Support File Search Path list, too. Quote
KFesting Posted July 15, 2014 Author Posted July 15, 2014 This is what my acaddoc looks like when opened in the AutoLISP editor. Those names are just referencing LISP files of the same name and title within the same folder. Doesn't look like an error it just doesn't seem to be recognizing them. Quote
KFesting Posted July 15, 2014 Author Posted July 15, 2014 This is the LISP file in question that I am having trouble loading. flat.LSP Quote
MSasu Posted July 15, 2014 Posted July 15, 2014 Please paste the statements below on command prompt and check what it returns (may need to press to see entire message). (findfile "flat.lsp") (load "flat.lsp") Quote
KFesting Posted July 15, 2014 Author Posted July 15, 2014 Those commands yield the following. Command: (findfile "flat.lsp") "C:\\Users\\EMPIRE\\documents\\lisp's\\flat.lsp" Command: (load "flat.lsp") C:FLAT That LISP routine now works. I also tested a few others by typing (load ".....lsp") directly into the command line and all worked successfully. Seems to be an issue actually loading the acaddoc.lsp file or referencing it to the individual LISP files? I presume there is no limit on the amount of LISP files that can be loaded? Quote
MSasu Posted July 15, 2014 Posted July 15, 2014 Try to add the extension to your loading statements, although this is not mandatory. That it: (load "flat[color=magenta].lsp[/color]") instead of: (load "flat") May be useful to add also an on-failure message for future debug: (load "flat" [color=magenta]"Unable to load FLAT tool!"[/color]) Up to my knowledge, there is no limit on the number of loading statements an AutoLISP file may contain; however even if there is one, it surely be way bigger than 5. Quote
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.