Hi, I won't bore you with the reasons, but I need to load a lisp routine by way of a toobar button. I do not want to use the appload dialog box.
Thanks for your time,
Rick
Use the CUI to create a new command. The command string should look something like. "^c^c^p(load "mypath\\mylispprogram"). Associate an icon of your choice with it and choose which toolbar to put it on.
That is a start, thanks. Here is the thing.What I really need to do is have the ability to switch back and forth between 2 different lisp routines. What you sent me loaded the file perfectly. So I made 2 buttons, one for each lisp. The original was always loaded through acaddoc.lsp. So with your help I can load the second one. Here is the problem. Lets say I have 2 lisps, A&B. "A" is loaded already, your button loads "B". Now if I use the appload dialog box and and pick "A", it reloads it and makes it current. I can go back to the dialog box later, pick "B" and it reloads it and makes that current.
Using the buttons does not "reload" the lisp. So it is not "switching" back and forth as I need. Is there a way to "unload" then "reload"?
Thanks again for your time,
Rick
The "A" lisp is in acaddoc.lsp, is loadded, or, is a text line as (autoload "MyPath/Mylisp" '("Mydefun"))?
if all lisp is written in acaddoc.lisp you nead to reload it.
^C^C^P(load "MyPath/acaddoc.lisp"))
if you only have a autoload, then
^C^C^P(load "MyPath/MyLisp"))
Thanks for the reply. I am not sure what you mean in the first line. Acaddoc "calls" or loads the first lisp. Recalling it as you sugested does not make it current again as I need.
Thakns anyway,
Rick
I would recommend that you completely change your strategy. 2 separate lisp files should not redefine the same command. Make them separate commands or functions and don't muddy the waters by having your users swap them out, never knowing which one is current without pushing a toolbar.
Okay, these 2 files are huge lisp routines. First let me say the 2nd lsp. Is a direct copy of the original. That said....A small, but important part of what they do is set global block insertion scale and text size. They set a base so to speak. Then on a menu a scale is selected and the text or blocks are sized according to the base size set in the lisp routines.
We are now working to 2 standards in the office. New is larger blocks and text, old or original is smaller.
We may be working on more than one job at a time, thus the need to switch back and forth.
Thanks,
Rick
Since "a huge lisp file" is usually much smaller than any drawing file, and since these lisp files are related to individual projects so that only one is used for any single project, I recommend that during the transition period of switching from one standard to another, that you just copy the relevant lisp file to your project folder and launch autocad by clicking on drawing file in that folder.
Load statements placed in acaddoc.lsp will load the lisp in the current folder before loading one in a search path if you do not include a path in your load statement.
Afterwards, you might rethink your entire strategy. If the scalling is related to units, then newer versions of AutoCAD will automatically scale the drawings to particular units sizes.
Using appropriate project template drawing files should be a solution to most of your problems without any programming.
Annotation scaling problems can be accomodated by using the annotation scaling system.
Thanks for your help. That won't fly, this is part of a larger menu system. It is all intigrated. We'll get there somehow.
Thanks again
Rick,
with the buttons you can solve the problem, as I said.
if your lisp "A" is written inside acaddopc.lsp you nead to reload, using
^c^c( load "yourfilepath/acaddoc.lsp")
if is a external file,
^c^c( load "yourfilepath/yourfilename")
Cheers
Henrique
@Anonymous wrote:A small, but important part of what they do is set global block insertion scale and text size. They set a base so to speak. Then on a menu a scale is selected and the text or blocks are sized according to the base size set in the lisp routines.
Thanks,Rick
Sounds to me like you need to store these settings inside the drawing file itself, that way no matter
what drawing you have opened, the settings can be obtained internally without all that switching...
Look into VLAX-LDATA-PUT and VLAX-LDATA-GET.
If there are many (more than one) items (base) to store, use LIST.
Access the list using NTH.
Example:
(VL-LOAD-COM)
(VLAX-LDATA-PUT "MyMenu" "Base" (list 1.0 4.5 "Standard"))
(if (not (setq a (VLAX-LDATA-GET "MyMenu" "Base")))
(setq a (list 1.0 4.5 "Standard"))
);if
(setvar "DIMSCALE" (nth 0 a))
(setvar "TEXTSIZE" (nth 1 a))
(setvar "TEXTSTYLE" (nth 2 a))
...
Your routine(s) can be reworked rather easily.
???
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.
@Anonymous wrote:
Hi there,
I didn't have success creating a toolbar button for my lisp routine.
Any more pointers?
Thanks.
Hi jcarey
try
(if (not c:YourCommandName)(load "YourLispFileName"));YourCommandName;
Hope this helps,
Henrique