MR MAN Posted September 2, 2008 Share Posted September 2, 2008 Is There Any Way Let Lisp Work Automatically When Autocad Start? Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted September 2, 2008 Share Posted September 2, 2008 Plenty of ways. "acad.lsp" is loaded once per AutoCAD session (unless ACADLSPASDOC =1) "acaddoc.lsp" is loaded once per drawing session. For any menu that loads, if there is an ".MNL" file with the same name as the menu, it is loaded. There are other ways also, but it may depend on what your lisp is set up to do, and when you want it loaded. Remember, in the case of conflicting lisp definitions, the last to load wins. See also: http://rkmcswain.blogspot.com/2006/07/autocad-customization-setup-and.html http://www.blog.cadnauseam.com/2008/09/01/what-is-loaded-at-autocad-startup-and-when/ Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 2, 2008 Share Posted September 2, 2008 Is There Any Way Let Lisp Work Automatically When Autocad Start? Do you mean for the LISP to be loaded when AutoCAD starts, or for the LISP to run when AutoCAD starts? Because, if you want the LISP to automatically be loaded, you could always use the 'Startup Suite' under the 'Load Application' dialog box. (_appload) Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted September 3, 2008 Share Posted September 3, 2008 Do you mean for the LISP to be loaded when AutoCAD starts, or for the LISP to run when AutoCAD starts? That makes no difference in how you load the code. For example: ;;; this will load the function "foo" and execute it (defun c:foo () (alert "Hello World") ) (c:foo) ;;;<- take out this line to just load the function definition ;;; this will execute the same code without defining a function. (alert "Hello World") Because, if you want the LISP to automatically be loaded, you could always use the 'Startup Suite' under the 'Load Application' dialog box. (_appload) Although the startup suite generally works, this is a poor choice. There is no way to automatically migrate these items to another machine or during a upgrade. The startup suite is also known to fail to load or sometimes double load items. "Acaddoc.lsp" is a better choice since you can just dump this file in the top path of your support file search path, on any machine. Quote Link to comment Share on other sites More sharing options...
MR MAN Posted September 4, 2008 Author Share Posted September 4, 2008 THANKS GUYS FOR YOUR REPLAYS, REALLY I WANT the LISP to run when AutoCAD starts? Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted September 4, 2008 Share Posted September 4, 2008 THANKS GUYS FOR YOUR REPLAYS, REALLY I WANT the LISP to run when AutoCAD starts? Then put your code in "acad.lsp" like this: [color="SeaGreen"];;; begin acad.lsp[/color] [color="Red"]([/color][color="RoyalBlue"]put your code here[/color][color="Red"])[/color] [color="Red"]([/color][color="RoyalBlue"]more code[/color][color="Red"])[/color] [color="Red"]([/color][color="RoyalBlue"]even more code[/color][color="Red"])[/color] [color="seagreen"];;; end acad.lsp[/color] If this file does not already exist (it does not come with AutoCAD), then create a new one using Notepad or use the VLIDE editor built into AutoCAD. If you actually want the code to execute each time a drawing is loaded, then use the "acaddoc.lsp" file instead. Quote Link to comment Share on other sites More sharing options...
JONTHEPOPE Posted September 4, 2008 Share Posted September 4, 2008 If You Load Lisps This Way Does It Take Up Lots Of Space On The Hard Drive? How Many Should You Use ??? Also Can You Create Custom Buttons ??? Quote Link to comment Share on other sites More sharing options...
JONTHEPOPE Posted September 4, 2008 Share Posted September 4, 2008 (setq oldfiledia (getvar "FILEDIA")) ;Save value of FileDia system variable (setvar "FILEDIA" 0) ;Set FileDia to 0 to use command prompt only (setvar "FILEDIA" oldfiledia) ;Set FileDia back to previous value (setq oldfiledia nil) ;Clear variable used for FileDia Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted September 4, 2008 Share Posted September 4, 2008 (setq oldfiledia (getvar "FILEDIA")) ;Save value of FileDia system variable (setvar "FILEDIA" 0) ;Set FileDia to 0 to use command prompt only (setvar "FILEDIA" oldfiledia) ;Set FileDia back to previous value (setq oldfiledia nil) ;Clear variable used for FileDia What is that supposed to accomplish? Quote Link to comment Share on other sites More sharing options...
JONTHEPOPE Posted September 5, 2008 Share Posted September 5, 2008 THATS WHAT WAS IN MY ACAD DOC LISP FILE WHEN I GOT ON THIS COMPUTER . Regenerating model. AutoCAD Express Tools Copyright © 2002-2004 Autodesk, Inc. _.menuunload Enter the name of a MENUGROUP to unload:DWGGATEWAY Menu unloaded successfully. MENUGROUP: DWGGATEWAY _.menuload dwggateway.mns Menu loaded successfully. MENUGROUP: DWGGATEWAY THIS IS WHAT COMES UP AFTER I START ACAD . ANY IDEAS IF I SHOULD ERASE SOME OF IT ? Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted September 5, 2008 Share Posted September 5, 2008 THATS WHAT WAS IN MY ACAD DOC LISP FILE WHEN I GOT ON THIS COMPUTER . Regenerating model. AutoCAD Express Tools Copyright © 2002-2004 Autodesk, Inc. _.menuunload Enter the name of a MENUGROUP to unload:DWGGATEWAY Menu unloaded successfully. MENUGROUP: DWGGATEWAY _.menuload dwggateway.mns Menu loaded successfully. MENUGROUP: DWGGATEWAY THIS IS WHAT COMES UP AFTER I START ACAD . ANY IDEAS IF I SHOULD ERASE SOME OF IT ? The code you posted has nothing to do with the text results above. The code does nothing. Quote Link to comment Share on other sites More sharing options...
JONTHEPOPE Posted September 5, 2008 Share Posted September 5, 2008 If It Does Nothing Than Ill Erase It . Right On Quote Link to comment Share on other sites More sharing options...
JONTHEPOPE Posted September 5, 2008 Share Posted September 5, 2008 I Had A Hard Time Finding My Acaddoc.lsp File Too. Mainly Cause It Was Hidden In A Applications Folder . Also There Were 2 Of Them. My Advice Would Be To Make A New One Write Smalle Code Aka (setvar "***") And See If The Variable Changes . Or Try To Find It Using Search . And If All Esle Fails Just Hire Someone......... Good Luck ... ...........................best Forum Ever...................... Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted September 7, 2008 Share Posted September 7, 2008 My Advice Would Be To Make A New One Write Smalle Code Aka (setvar "***") And See If The Variable Changes . You don't have to guess. AutoCAD will load the first one it finds by searching the support file search path, in order, (and only the first one). Paste this to the command line (findfile "acaddoc.lsp") - that will tell you the location of the "acaddoc.lsp" file that AutoCAD is using. 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.