auto load lisp to startup

auto load lisp to startup

Emerson.Venadas
Explorer Explorer
313 Views
13 Replies
Message 1 of 14

auto load lisp to startup

Emerson.Venadas
Explorer
Explorer

Hello guys, this is my first time to start a topic in this group. I want to load some command automatically when opening new drawings and every drawings. Could you please help me to find the way to do this? It could be a big help. Thanks a lot!

0 Likes
Accepted solutions (1)
314 Views
13 Replies
Replies (13)
Message 2 of 14

paullimapa
Mentor
Mentor

use AutoCAD's built-in command: Appload>Startup Suite

https://lpcetraprojects.wordpress.com/2015/04/08/how-to-auto-load-lisp-files-in-autocad/


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 3 of 14

Kent1Cooper
Consultant
Consultant

There are several ways.  Read about them >here<.  [That's for Acad2026, but won't be different for other recent versions.]

I have always preferred the acaddoc.lsp approach.  It is explicitly described as running every time you open [or create new] a drawing.  The way the Startup Suite in APPLOAD is described >here< is only on program startup, not necessarily in every drawing:

"These are the applications that are loaded each time you start the product."

Some of the things you could load that way will apply in all drawings, but I would not assume everything.  Whereas [from the first link above]:

"the acaddoc.lsp or acadltdoc.lsp file is loaded with each individual document (or drawing)."

Also, when you upgrade to a new version, you can simply copy your acaddoc.lsp file into an appropriate folder and you're done -- no need to add things into the Startup Suite in the new version.

Kent Cooper, AIA
Message 4 of 14

paullimapa
Mentor
Mentor

"These are the applications that are loaded each time you start the product."

Curious as to why Autodesk documents Appload Startup Suite that way because any lisp I add to it always loads in each drawing I open and not only when the program starts.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 5 of 14

Sea-Haven
Mentor
Mentor

I have always used Start up suite rather than Acaddoc.lsp. As the lisps are saved into a known directory. One of the things you can do is have multiple lisps in say one Custom.lsp so no need for a big list of lisps to be loaded. The other thing to look at in your say custom lisp is using the Autoload function. it loads the lisp automatically once you type the command line. 

(autoload "COPY0" '("COPY0"))
(autoload "COPYCOMMAND" '("ZZZ"))
(autoload "COVER" '("COVER"))
(autoload "DIMFLIP" '("DIMFLIP"))
(autoload "DRAWXFALL" '("DRAWXFALL"))
(autoload "DRAWPIPE" '("DRAWPIPE"))
(autoload "EDITRL" '("EDITRL"))

 

Message 6 of 14

Moshe-A
Mentor
Mentor

@paullimapa wrote:

"These are the applications that are loaded each time you start the product."

Curious as to why Autodesk documents Appload Startup Suite that way because any lisp I add to it always loads in each drawing I open and not only when the program starts.


i fully agree with that.

Message 7 of 14

Emerson.Venadas
Explorer
Explorer

Thanks for all your responses guys. Appreciated.

 

Regarding the acad.lsp or acaddoc.lsp which should load in every drawings open. Would it be like if I make this inside the acad.lsp, for instance, these 3 commands automatically activated without typing it in command line?

EmersonVenadas_0-1757287332715.png

 

0 Likes
Message 8 of 14

Sea-Haven
Mentor
Mentor

You can have both a defun or use (setvar 'orthomode 0) is off 1 is on. Its also F8 key.

osnap is osmode can set to any value. eg 47.

Grid is gridmode 0 or 1

 

GIZMO is something you have.

 

Again they are in my custom.lsp that gets loaded via Start up Suite. Its has 38 C: defuns and 35 Autoloads in one lisp.

Message 9 of 14

paullimapa
Mentor
Mentor

Keep in mind that if you go with the acad.lsp method in order for this file to load each time you open a dwg you have to make sure that ACADLSPASDOC is set to 1 as explained here:

AutoCAD 2026 Help | ACADLSPASDOC (System Variable) | Autodesk

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 10 of 14

Kent1Cooper
Consultant
Consultant
Accepted solution

@Emerson.Venadas wrote:

.... Regarding the acad.lsp or acaddoc.lsp which should load in every drawings open. Would it be like if I make this inside the acad.lsp, for instance, these 3 commands automatically activated without typing it in command line? ....


No.  That would only define the commands.  You would then need to enter the command names to activate them.  But you could have them activated after being defined.

 

(defun c:orthoon() (command "ortho" "on")) ; define it

(c:orthoon) ; run it

 

If you do it that way, you can type in that command name any time if you want to run it again later [or, as already noted, just use the F8 key if Ortho is currently off].  If you want it to happen automatically only once, upon opening a drawing, but don't need to be able to run it again as a command later, you can dispense with the named command definition, and just put in the (command) function alone:

 

(command "ortho" "on")

Kent Cooper, AIA
Message 11 of 14

Sea-Haven
Mentor
Mentor

See my prior post I use the setvar method for setting variables to what I want on startup. 

Message 12 of 14

Emerson.Venadas
Explorer
Explorer

Thanks for all your responses guys. I understand it more now.

 

Basically, this is what I did and it works like I how I wanted it and simplest way for me. I still use the acad.lsp and acaddoc.lsp to run on every new drawing and existing drawings. I know there are lots of other method on how to run this, but this works fine with me. Cheers!

 

EmersonVenadas_0-1757544119482.png

 

0 Likes
Message 13 of 14

Emerson.Venadas
Explorer
Explorer

Tried to find this setvar on your post but too many posts to look at.

0 Likes
Message 14 of 14

Sea-Haven
Mentor
Mentor
(setvar 'ucsicon 2)
(setvar 'orthomode 0)
(setvar 'gridmode 0)
(setvar 'osmode 47) ; osnaps
0 Likes