Mostly Nice Posted May 23, 2011 Posted May 23, 2011 Eyyy, I've upgraded everyones machines to 2012 and now encountering the problem of getting all the lisp routines we have to load upon open. Normally i've always done this through the contents suite and just added the folder. However, for some reason it is not loading the routines each time a drawing file is fired up. Anyone experienced similar issues or is there a more effective way of auto loading these lisps each time AutoCAD starts? Cheers Quote
rkmcswain Posted May 23, 2011 Posted May 23, 2011 (edited) Create a text file named "acaddoc.lsp" Add lines like this for each lisp file you want to load (load "mylispfile") (load "another_lisp_file") (load "myCustomStuff") (load "\\\\server\\share\\lisp\\mylisp_with_a_path") Put this file in the TOP path of your support file search paths on each machine -OR- If all of the machines have access to the same network locations, then create a network share (i.e.: \\server\share\cad) and place this file here. Then add this path to the TOP of the support file search path on each machine. Assuming you do the latter, then whenever you need to add/delete/edit the startup files, you only have to modify a single file on the network to handle all of the machines. Reference: http://cadpanacea.com/node/90 http://www.jtbworld.com/lisp/acaddoc.htm http://cadpanacea.com/node/34 http://lee-mac.com/autoloading.html Edited May 23, 2011 by rkmcswain add reference links Quote
Mostly Nice Posted May 23, 2011 Author Posted May 23, 2011 Excellent. If i park this acaddoc.lsp in the same directory as my lisp routines, do i need to specify the full path in the load? I.e (load "X:\CAD Systems\mylispfile.lsp") Quote
BlackBox Posted May 23, 2011 Posted May 23, 2011 Excellent. If i park this acaddoc.lsp in the same directory as my lisp routines, do i need to specify the full path in the load? I.e (load "X:\CAD Systems\mylispfile.lsp") If the file(s) are stored in a directory included in your Support Files Search Paths, then no. Also, when including a file path, be sure to use double backslashes "\\". :wink: Quote
irneb Posted May 23, 2011 Posted May 23, 2011 Nope, since it's already in your support folders you only need to call the lisps by name. Another similar way would be to create a MNL file named the same as your CUI (even your enterprise CUI). Same rules apply as for the ACadDoc.LSP file. Quote
Mostly Nice Posted May 23, 2011 Author Posted May 23, 2011 Nice one gents Regards, Nice, Mostly. Quote
Lee Mac Posted May 23, 2011 Posted May 23, 2011 The guys have covered pretty much all of it, but here is a tutorial demonstrating a few more methods: http://lee-mac.com/autoloading.html Quote
alanjt Posted May 23, 2011 Posted May 23, 2011 Nope, since it's already in your support folders you only need to call the lisps by name. Another similar way would be to create a MNL file named the same as your CUI (even your enterprise CUI). Same rules apply as for the ACadDoc.LSP file. Great method. I have an AlanThompson.mnu and AlanThompson.mnl that I've loaded for years. Makes life so easy when setting up a new machine. Quote
rkmcswain Posted May 23, 2011 Posted May 23, 2011 The guys have covered pretty much all of it, but here is a tutorial demonstrating a few more methods: http://lee-mac.com/autoloading.html Your tutorial covers the "on failure" optional argument of the (load) function, which is a good idea to make use of. Quote
Mostly Nice Posted May 24, 2011 Author Posted May 24, 2011 (edited) This is gotta be easier than this.. I tried with the full path of each with double backslashes i.e. Load "X:\\CAD Systems\Lisp Routines\\Lisp1.lsp" Anyone advise? http://i54.tinypic.com/rk7twg.png Edited May 24, 2011 by Mostly Nice Large Pic Link Quote
irneb Posted May 24, 2011 Posted May 24, 2011 This is gotta be easier than this.. I tried with the full path of each with double backslashes i.e. Load "X:\\CAD Systems\Lisp Routines\\Lisp1.lsp" Anyone advise? http://i54.tinypic.com/rk7twg.png Sorry, can't open that link. You could attach png files directly here if you want (you've posted more than 10 times so the restriction should be over). Anyhow, type it EXACTLY as here into the AutoCAD command prompt: [color=red]([/color]Load "X:\\CAD Systems\[color=red]\[/color]Lisp Routines\\Lisp1.lsp"[color=red])[/color] Note you missed out one backslash, and also each lisp instruction *MUST* begin and end with a pair of parentheses. BTW, if you don't like the double backslashes (and there are times when they cause problems), you could rather just use forward slashes "/". So your code could be: (Load "X:/CAD Systems/Lisp Routines/Lisp1.lsp") As another thing - take note of Lee's examples as RK's suggested. The optional argument for the load function helps if there are errors. Just to clear something up for you. If you add this load call into the X:\CAD Systems\Lisp Routines\ACadDoc.LSP file and you have the X:\CAD Systems\Lisp Routines\ folder as the 1st inside your Support Folders (in the options dialog), then you don't need to specify that same path again: (Load "Lisp1" nil) The above will do 3 things: It will search for the file inside all the support folders (in order), so it should find it in X:\CAD Systems\Lisp Routines\. It'll search for Lisp1.VLX, if not found then for Lisp1.FAS, or otherwise Lisp1.LSP. So here if you later decide to compile you file to improve performance, you don't need to modify the lines where you called it. The nil a the end is what gets returned if there's a failure. If you omit this the load causes an error and everything else stops. You can thus wrap this load call inside an if statement and raher just display something so the user can see what went wrong ... instead of just stopping everything else as well. Quote
Mostly Nice Posted May 25, 2011 Author Posted May 25, 2011 I've put all my lisps in the support folder, including acaddoc.lsp i've put file support search path in and still it will not load any. (load "ALLZ0.lsp" nil) (load "BurstUpgraded.lsp" nil) (load "Colour.lsp" nil) (load "CopytoDrawing.lsp" nil) (load "CopytoXRef.lsp" nil) (load "DelTab.lsp" nil) (load "DIMASSOC1.lsp" nil) (load "Inserts.lsp" nil) (load "LayerDirector.lsp" nil) (load "layerfiltererase.lsp" nil) (load "LayerRename.lsp" nil) (load "Matchtxt.lsp" nil) (load "ObjectLock.lsp" nil) (load "Plan-W_UCS-W_Zoom-E_QSave_Close.lsp" nil) (load "PlanWUCSWZoomE.lsp" nil) (load "PlanWUCSWZoomE-QSAVE.lsp" nil) (load "Polyjoin.lsp" nil) (load "Previous Plot.LSP" nil) (load "PurgeAndAudit.lsp" nil) (load "ScaleListDelete.lsp" nil) (load "SectionClip.lsp" nil) (load "SourceText.lsp" nil) (load "Spline2Pline.lsp" nil) (load "SwitchTxt.lsp" nil) (load "T2T.lsp" nil) (load "TabSortV2-2.lsp" nil) (load "TAG2TXT.lsp" nil) (load "TileMode.lsp" nil) (load "TXT2MTXT.lsp" nil) (load "VPLock.lsp" nil) (load "VPorts.lsp" nil) (load "XRefsToLayers.lsp" nil) (load "ZoomE.lsp" nil) So why does it not boot them up? Quote
Lee Mac Posted May 25, 2011 Posted May 25, 2011 If you type at the command line: (findfile "ACADDOC.lsp") Does it return a valid path or nil? (I don't need to know what the path is, just that a path is returned - this determines whether AutoCAD can 'see' your ACADDOC.lsp) Quote
Mostly Nice Posted May 26, 2011 Author Posted May 26, 2011 Command: (findfile "ACADDOC.lsp") nil Quote
irneb Posted May 26, 2011 Posted May 26, 2011 Command: (findfile "ACADDOC.lsp")nil That means your support folders isn't pointing to it! Open the Options dialog, and its Files (1st) tab. The very 1st item in the list should be "Support File Search Path". When you open that branch (click the + next to it), you should have the top-most path to where your ACADDOC.LSP file is saved. If not, click Add, then Browse, browse to the folder, click OK, then click "Move Up" until it's at the very top, finally click OK in the Options dialog. Quote
Mostly Nice Posted May 26, 2011 Author Posted May 26, 2011 I think i'm encountering some minor profile errors Quote
irneb Posted May 26, 2011 Posted May 26, 2011 That looks like the "standard" support paths ... except for that "help" one down the middle. Not sure but it doesn't look like a "correct" path, someone else might know about that since I don't have 2012 (only 2008 and 2011). I see you actually just saved all your LSP files into the roamable user folder. That's something I'd prefer not doing, since it makes it more complex when upgrading to a new version or other vertical - not to mention it's quite a long path name to get hold of. I much prefer a shorter path for only my Lisps, which can then be used by various versions at the same time. Edit: BTW, are you on Vista/7 with the "bling" turned off? Or on XP? If V/7 then you might also have some folder access issues if your username isn't an administrator - though in that case other stuff from ACad may also not work correctly. Quote
Lee Mac Posted May 26, 2011 Posted May 26, 2011 If it were me, I would create a new folder (call it 'LISP' if you like) in a location you can easily access, put all your LISP files in there (along with your ACADDOC.lsp), and add the folder path to the list of support paths (it doesn't necessarily have to be at the top). This way, you are certain that you have r/w permission on the folder and its far easier to modify exactly what is being loaded without having to dig through hidden files/folders. Also, make sure that you don't have an ACADDOC.lsp in your working directory since this will be loaded before any others. One more thing I've noticed from your image: I'm not sure if it would make a difference but I would remove the trailing backslash from your folder specification (so that it matches the others in the list) - usually a folder filepath doesn't end with a backslash. Quote
irneb Posted May 26, 2011 Posted May 26, 2011 (it doesn't necessarily have to be at the top)Unless there's another ACADDOC.LSP in one of the other folders ... only the 1st one found will get loaded. This from my own experience in some other threads. The 1st reason I went to the MNL method instead.Also, make sure that you don't have an ACADDOC.lsp in your working directory since this will be loaded before any others.Yep, this tends to break all other things. Another reason I prefer the MNL method above the ACADDOC.LSP one. Quote
Lee Mac Posted May 26, 2011 Posted May 26, 2011 Unless there's another ACADDOC.LSP in one of the other folders ... only the 1st one found will get loaded. This from my own experience in some other threads. The 1st reason I went to the MNL method instead. True - a good point for those reading the thread - although I doubt the OP will have that trouble judging by the findfile result - but point taken. @MostlyNice: Just out of curiosity, does this work for you? 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.