Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Contributor
18 Posts
0 Kudos
Registered: ‎06-26-2003
Post 1 of 34

run lisp on start

66 Views, 33 Replies
01-07-2003 07:25 PM
I need to run a lisp routine on autocad start. Anyone knows how to do it?? i think that i have to add the lisp routine to some configuration file, but i don´t know wich one.
Can someone help me?
Thanks!

Juliano Rocha - Brasil
Distinguished Contributor
314 Posts
1 Kudo
Registered: ‎11-19-2003
Post 2 of 34

Re: run lisp on start

01-07-2003 07:41 PM in reply to: jsrocha
You can add it at the end of acad2000doc.lsp file (assuming you are using 2000+ ver. of Autocad.
Active Contributor
33 Posts
0 Kudos
Registered: ‎01-28-2003
Post 3 of 34

Re: run lisp on start

01-07-2003 10:20 PM in reply to: jsrocha
In acad 14 (2000 can also be set to work this way) make sure you have an acad.lsp in your support path and place your code inside of that.
*Bell, R. Robert
Post 4 of 34

Re:

01-07-2003 10:47 PM in reply to: jsrocha
No!

 

Add it to (or create) AcadDoc.lsp. The Acad2000.lsp and
Acad2000Doc.lsp files are reserved for Autodesk's use. Acad.lsp and AcadDoc.lsp
are documented as the mechanism for user customization.

 

Be aware that there is a bug with the MRU (most recently used)
list on the File menu, however. If you pick drawings off the MRU, occasionally
the normal startup (the suite & AcadDoc.lsp) won't run. The only reliable
way to run your startup code is to include it in your customized menu's .mnl
file.

 


 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
You
can add it at the end of acad2000doc.lsp file (assuming you are using 2000+
ver. of Autocad.
Distinguished Contributor
1,285 Posts
0 Kudos
Registered: ‎12-11-2003
Post 5 of 34

Re: run lisp on start

01-08-2003 01:06 AM in reply to: jsrocha
assuming you're using 2000-2000i-2002, it's perfectly acceptable to add things to your acad2000doc.lsp if you want to, there aren't any rules against it. (it's a handy place to set variables that you have to set in every drawing but aren't saved.) however, you probably don't want to add a LISP routine to it that you only want to load once, when you start autocad (i have several routines set to load this way in my startup suite.) check out the APPLOAD command in the help files, i think that's probably the route you want to go.
*Richardson, Randy
Post 6 of 34

Re:

01-08-2003 01:15 AM in reply to: jsrocha
The documentation says "Note: Do not modify the reserved acad2000doc.lsp
file."

It doesn't specifically say it's a rule, so maybe you're right. It's also
not a rule that you should not put object lines, text, and dimensions on
nine different randomly-chosen layers; it's just not a good idea.

How is adding things to the acad2000doc.lsp file superior to adding them to
the acaddoc.lsp file?

-Randy Richardson


"dviator" wrote in message
news:f13638f.3@WebX.maYIadrTaRb...
> assuming you're using 2000-2000i-2002, it's perfectly acceptable to add
things to your acad2000doc.lsp if you want to, there aren't any rules
against it. (it's a handy place to set variables that you have to set in
every drawing but aren't saved.) however, you probably don't want to add a
LISP routine to it that you only want to load once, when you start autocad
(i have several routines set to load this way in my startup suite.) check
out the APPLOAD command in the help files, i think that's probably the route
you want to go.
>
Distinguished Contributor
1,285 Posts
0 Kudos
Registered: ‎12-11-2003
Post 7 of 34

Re:

01-08-2003 02:32 AM in reply to: jsrocha
ok, i did find a knowledge base article that says not to modify the acad2000doc.lsp. (is this what you're referring to? i couldn't find it anywhere else.) however, adding variable settings to this file will not have any adverse affects as long as nothing else in the file is removed. as far as one being superior to the other, i never claimed that to be the case. the acaddoc.lsp file requires user creation, the acad2000doc.lsp file already exists, that's the only benefit i'm pointing out, so if you're just adding a couple of variable settings what's the difference?
*Friedrich, Peter
Post 8 of 34

Re:

01-08-2003 02:44 AM in reply to: jsrocha
That's a good (simple) question... My answer is Neither are good enough!
It's a strategy to avoid going back and re-installing things.

I customize quite a bit... and Lots of supporting code is involved.
What I do is load the menu
load the menu's MNL file
-- which contains: (menuload "my_submenu")
load the desired submenus
load the submenu's MNL file
-- which contains: (load"my_lisp_files")
-- which contains:
(if not xx (load"my_xx"))
(if not yy (load"my_yy")) ;; ... etc, until all my code is
loaded.
All of it is in my own files (except the base menu's MNL file)

Now, I can erase ALL of my stuff, and be confident AutoDesk's stuff has been
left alone.



"Randy Richardson" wrote

> How is adding things to the acad2000doc.lsp file superior to adding them
to
> the acaddoc.lsp file?
> -Randy Richardson
>
*Richardson, Randy
Post 9 of 34

Re:

01-08-2003 02:48 AM in reply to: jsrocha
The documentation for the acaddoc.lsp file is where I took the quote from.

If you ever have a need to reinstall or upgrade AutoCAD, all of your changes
to acad2000doc.lsp will disappear. If person A wants to give his
customizations to person B, and sends acad2000doc.lsp, and if person B also
has his own customized acad2000doc.lsp, it might take some effort to sort it
all out. The same could also be said for acaddoc.lsp files, but at least in
that case it isn't mixed with Autodesk-generated and necessary code.
Acad2000doc.lsp exists because AutoCAD needs it to run. Acaddoc.lsp does
not exist initially because the user is in charge of it. However, it's
extremely simple to create the file if it doesn't exist.

All that being said, I'll concede that it is possible, if you are the owner
of your AutoCAD license rather than an employee, and if you are either very
organized or have little ambition to do a lot of customization, that it may
well cause no harm to make your changes in a file that was never intended
for you to change. However, as you are giving advice on a public forum that
is intended to help people learn the proper way to do things, I have to
point out the proper way. If you want to depart from the norm, I don't
care, but I do care about people who will be influenced by what you say.

"dviator" wrote in message
news:f13638f.5@WebX.maYIadrTaRb...
> ok, i did find a knowledge base article that says not to modify the
acad2000doc.lsp. (is this what you're referring to? i couldn't find it
anywhere else.) however, adding variable settings to this file will not have
any adverse affects as long as nothing else in the file is removed. as far
as one being superior to the other, i never claimed that to be the case. the
acaddoc.lsp file requires user creation, the acad2000doc.lsp file already
exists, that's the only benefit i'm pointing out, so if you're just adding a
couple of variable settings what's the difference?
>
*Nehls, Kevin
Post 10 of 34

Re:

01-08-2003 02:49 AM in reply to: jsrocha
The reason for not editing the acad2000.lsp or acad2000doc.lsp file is that
they could very well be replaced when you install a patch to AutoCAD, thus
overwritting your changes. Use acad.lsp and acaddoc.lsp instead. These
files are inteneded for use by the user the acad2000 files are intended for
use by Autodesk and only autodesk. Making changes to those files only put
you at risk of loosing your modifications.

--
Kevin Nehls
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!