Jump to content

Let Lisp Work Automatically


MR MAN

Recommended Posts

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/

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 ???

Link to comment
Share on other sites

 
(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

Link to comment
Share on other sites

 
(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?

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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......................

Link to comment
Share on other sites

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.

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...