Visual LISP, AutoLISP and General Customization
cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 

run lisp on start

33 REPLIES 33
Reply
Message 1 of 34
jsrocha
525 Views, 33 Replies

run lisp on start

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
33 REPLIES 33
Message 2 of 34
SMMASON
in reply to: jsrocha

You can add it at the end of acad2000doc.lsp file (assuming you are using 2000+ ver. of Autocad.
Message 3 of 34
Anonymous
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.
Message 4 of 34
Anonymous
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.
Message 5 of 34
dviator
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.
Message 6 of 34
Anonymous
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.
>
Message 7 of 34
dviator
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?
Message 8 of 34
Anonymous
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
>
Message 9 of 34
Anonymous
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?
>
Message 10 of 34
Anonymous
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
Message 11 of 34
dviator
in reply to: jsrocha

point taken, i hadn't thought about patches possibly altering or replacing the acad2000doc.lsp.
Message 12 of 34
Anonymous
in reply to: jsrocha

Good point. I also prefer to use .mnl files for partial menus to
automatically run AutoLISP functions at startup. Two or more developers can
contribute to the same work station customization without stepping on each
others' toes.

Randy Richardson
Message 13 of 34
Anonymous
in reply to: jsrocha

In 2000 you'll want to use acaddoc.lsp instead. Although you can make it
load acad.lsp into each document, this is not the default behaviour and they
may do away with acad.lsp altogether in the future (that's just specualtion
on my part though).

--
Kevin Nehls


"Programmin_Fool" wrote in message
news:f13638f.1@WebX.maYIadrTaRb...
> 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.
>
Message 14 of 34
Anonymous
in reply to: jsrocha

I to have also started moving more of our code to our mnl file. This is
mostly to avoid the bug of the start-up files not being run by Autocad when
opening files from the MRU.

--
Kevin Nehls


"Randy Richardson" wrote in message
news:A547F4C1277D19077D483EE6711FA6DB@in.WebX.maYIadrTaRb...
> Good point. I also prefer to use .mnl files for partial menus to
> automatically run AutoLISP functions at startup. Two or more developers
can
> contribute to the same work station customization without stepping on each
> others' toes.
>
> Randy Richardson
>
>
Message 15 of 34
dviator
in reply to: jsrocha

point taken here as well. (define norm for me, though. i've run across numerous posts recommending adding code to the acad2000doc.lsp for variable settings, so there are many, many other people doing it this way. i'll concede, however, in light of the information brought out by this post, i will create an acaddoc.lsp file of my own for future modifications.)
Message 16 of 34
Anonymous
in reply to: jsrocha

You're right, this recommendation to use the wrong file has been repeated so
many times, it's hard to stem the tide. Sometimes it seems it's like the
Bugs Bunny version of The Little Dutch Boy: Not only do we have to put a
finger in the leak in the dike, but after both hands, ears, feet, and the
tail are all recruited to plug multiple leaks, another leak starts 20 feet
away.

"dviator" wrote in message
news:f13638f.13@WebX.maYIadrTaRb...
> point taken here as well. (define norm for me, though. i've run across
numerous posts recommending adding code to the acad2000doc.lsp for variable
settings, so there are many, many other people doing it this way. i'll
concede, however, in light of the information brought out by this post, i
will create an acaddoc.lsp file of my own for future modifications.)
>
Message 17 of 34
Anonymous
in reply to: jsrocha

Maybe we should post a new thread every hour for the next 2 years stating
that this is not a good thing to do.

--
Kevin Nehls


"Randy Richardson" wrote in message
news:1A5A251E8A154483B92E38C9428CABBE@in.WebX.maYIadrTaRb...
> You're right, this recommendation to use the wrong file has been repeated
so
> many times, it's hard to stem the tide. Sometimes it seems it's like the
> Bugs Bunny version of The Little Dutch Boy: Not only do we have to put a
> finger in the leak in the dike, but after both hands, ears, feet, and the
> tail are all recruited to plug multiple leaks, another leak starts 20 feet
> away.
Message 18 of 34
SMMASON
in reply to: jsrocha

The only reason I suggested using the existing ACAD2000DOC over the existing ACAD2000 lisp the the autoload feature on each drawing. The ACADDOC.lsp doesn't exist unless you generate it, correct? As far chances of lost file because of service patch and what-not, aren't you suppose to backup these and other files prior to doing so?
Message 19 of 34
Anonymous
in reply to: jsrocha

That's why I use MNL- it autoloads after the
corresponding Menu (what, you don't use a menu?)

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
The
only reason I suggested using the existing ACAD2000DOC over the existing
ACAD2000 lisp the the autoload feature on each drawing. The ACADDOC.lsp
doesn't exist unless you generate it, correct? As far chances of lost file
because of service patch and what-not, aren't you suppose to backup these and
other files prior to doing so?
Message 20 of 34
SMMASON
in reply to: jsrocha

So what you are saying is that your .mnl file is protected from being updated by other means other than yourself?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

ā€Boost