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

Acadlspasdoc

15 REPLIES 15
Reply
Message 1 of 16
BillZ
489 Views, 15 Replies

Acadlspasdoc

R2005:
I have a lisp routine that saves the user profile.
I put it in my acad.lsp.
(load "Save_Login_Profile") ;saves profiles.
(Save_Login_Profile)
I also set the acadlspasdoc variable to 0 at the beginning of my acad.lsp.
Yet each time I open a new or existing drawing, I see displayed on the screen the prompt that is associated with this program.
"G:\Autolisp\AutoCAD_2004_Support\Profiles\BZONDLO.arg saved."

Isn't acad.lsp only suppose to load on the first drawing when AutoCAD is first opened?

I didn't notice this in 2004 but it may have been that way also.
Edit: I checked it and It doesn't do it in R2004.

TIA

Bill
Message was edited by: BillZ
15 REPLIES 15
Message 2 of 16
Anonymous
in reply to: BillZ

You've pointed out your problem yourself: I also set the acadlspasdoc variable to 0 at the beginning of my acad.lsp. Setting acadlspasdoc tells AutoCAD to reload Acad.lsp for each document opened (which is what acaddoc.lsp is for). -- Gary J. Orr CADD Administrator (218) 279-2421 Gary.Orr@LHBcorp.com LHB, Inc 21 West Superior Street, Suite 500 Duluth, Mn 55802 (218) 727-8446 www.LHBcorp.com "BillZ" wrote in message news:1255629.1081273286976.JavaMail.jive@jiveforum2.autodesk.com... > R2005: > I have a lisp routine that saves the user profile. > I put it in my acad.lsp. > (load "Save_Login_Profile") ;saves profiles. > (Save_Login_Profile) > I also set the acadlspasdoc variable to 0 at the beginning of my acad.lsp. > Yet each time I open a new or existing drawing, I see displayed on the screen the prompt that is associated with this program. > "G:\Autolisp\AutoCAD_2004_Support\Profiles\BZONDLO.arg saved." > > Isn't acad.lsp only suppose to load on the first drawing when AutoCAD is first opened? > I didn't notice this in 2004 but it may have been that way also. > > TIA > > Bill
Message 3 of 16
BillZ
in reply to: BillZ

<<>>
Setting acadlspasdoc tells AutoCAD to reload Acad.lsp for each document
opened (which is what acaddoc.lsp is for).
<<>>
Gary,
I'm trying to understand your post.
Are you saying that setting the acadlspasdoc variable causes AutoCAD to reload Acad.lsp for each document no matter if it's set to 0 or 1?

The help files says:

0 Loads acad.lsp into just the first drawing opened in an AutoCAD session.

1 Loads acad.lsp into every drawing opened .


Bill
Message 4 of 16
Anonymous
in reply to: BillZ

My apologies, I read your post a little too quickly. You are correct setting it to 0 should provide you with the desired effect. I had run into a similar situation in the past, so in form of recompense, here is how I usually handle the situation now: ;this checks for a variable to determine weather or not to run (if (= nil savedprofile) (progn (load "Save_Login_Profile") ;saves profiles. (Save_Login_Profile) ;The following creates a variable and sends it ;to all consecutive drawings opened during this editing session (setq savedprofile T) (vl-propagate savedprofile);sends the variable to all consecutive drawings opened );close progn );end if This method can be used in either Acad.lsp or AcadDoc.lsp -- Gary J. Orr CADD Administrator (218) 279-2421 Gary.Orr@LHBcorp.com LHB, Inc 21 West Superior Street, Suite 500 Duluth, Mn 55802 (218) 727-8446 www.LHBcorp.com "BillZ" wrote in message news:9090356.1081334865121.JavaMail.jive@jiveforum2.autodesk.com... > <<>> > Setting acadlspasdoc tells AutoCAD to reload Acad.lsp for each document > opened (which is what acaddoc.lsp is for). > <<>> > Gary, > I'm trying to understand your post. > Are you saying that setting the acadlspasdoc variable causes AutoCAD to reload Acad.lsp for each document no matter if it's set to 0 or 1? > > The help files says: > > 0 Loads acad.lsp into just the first drawing opened in an AutoCAD session. > > 1 Loads acad.lsp into every drawing opened . > > > Bill
Message 5 of 16
BillZ
in reply to: BillZ

Thanks,

I'll see if I can apply this until they get this bug fixed.


Bill
Message 6 of 16
BillZ
in reply to: BillZ

This may be different than I thought.
I added the code that you posted but AutoCAD acts the same.
I even tried the if statement before the s::startup but it doesn't change anything.
(if (= nil savedprofile)
(progn
(defun s::startup ()
And it still runs the acad.lsp evertime I open a new drawing.
Wnen I check the value of savedprofile.
Command: !savedprofile
T
And I've checked the spelling of the
(setq savedprofile T)
to be sure it's checking the same var.


Bill
Message 7 of 16
BillZ
in reply to: BillZ

I got it to work.

I had the vl-propagate inside the acad.lsp (no no).

Thanks Again

Bill
Message 8 of 16
BillZ
in reply to: BillZ

Well I was wrong.
Evidently when acad loads the acad.lsp, the var value for the next drawing is not available. savedprofile returns nil at this time so the acad.lsp runs anyway.
This have got to be a problem within the Acad executible. For some reason it loads the acad.lsp no matter what the acadlspasdoc variable is set at.
This would have been a good work around.
Bill
Message 9 of 16
BillZ
in reply to: BillZ

This is really bizzare.
I have my lispinit = 0
so I know the value of savedprofile is T all the time.
Yet that acad.lsp loads and runs.
Even with:
(princ "\nsavedprofile ")(princ savedprofile)
(if (= nil savedprofile)
(progn

(load "Save_Login_Profile") ;saves profiles.
(Save_Login_Profile)

(setq savedprofile T)
(vl-propagate savedprofile) ;sends the variable to all consecutive drawings opened.
);close progn
);end if
The princ savedprofile return T right before the if.

Command:
DOSLib Version 6.1.3 (Nov 21 2003) Loaded
savedprofile T
G:\Autolisp\AutoCAD_2004_Support\Profiles\BZONDLO.arg saved.
Command:

I don't get it. Am I missing something?

Bill
Message 10 of 16
Anonymous
in reply to: BillZ

Sorry, I was on something else... If the routine fails when running from acad.lsp, have you tried moving it to acaddoc.lsp? If that fails place it within S::Startup (as you had mentioned earlier) and be sure that your startup is in acaddoc.lsp. Another problem with startup is that it may already exist (from some other add-on for example) so place the following in your acaddoc.lsp: ;start code (defun your_startup () (princ "\n\nRunning Start UP: ") (if (= nil savedprofile) (progn (load "Save_Login_Profile") ;saves profiles. (Save_Login_Profile) ;The following creates a variable and sends it ;to all consecutive drawings opened during this editing session (setq savedprofile T) (vl-propagate savedprofile);sends the variable to all consecutive drawingsopened );close progn );end if (princ "\nDone.") (princ) ) (defun-q your_startup-q () (princ "\n\nRunning Start UP-q: ") (if (= nil savedprofile) (progn (load "Save_Login_Profile") ;saves profiles. (Save_Login_Profile) ;The following creates a variable and sends it ;to all consecutive drawings opened during this editing session (setq savedprofile T) (vl-propagate savedprofile);sends the variable to all consecutive drawingsopened );close progn );end if (princ "\nDone.") (princ) ) (if s::startup (setq s::startup (append s::startup your_startup-q)) (setq s::startup your_startup) ) ;end code -- Gary J. Orr CADD Administrator (218) 279-2421 Gary.Orr@LHBcorp.com LHB, Inc 21 West Superior Street, Suite 500 Duluth, Mn 55802 (218) 727-8446 www.LHBcorp.com "BillZ" wrote in message news:16150862.1081355587608.JavaMail.jive@jiveforum1.autodesk.com... > Well I was wrong. > Evidently when acad loads the acad.lsp, the var value for the next drawing is not available. savedprofile returns nil at this time so the acad.lsp runs anyway. > This have got to be a problem within the Acad executible. For some reason it loads the acad.lsp no matter what the acadlspasdoc variable is set at. > This would have been a good work around. > Bill
Message 11 of 16
BillZ
in reply to: BillZ

Again thanks!
But if I do it exactly like you say, I get an error on loading.

Regenerating model.

AutoCAD Express Tools Copyright © 2002-2004 Autodesk, Inc.

SavedProfile: nil; error: Invalid attempt to access a compiled function
definition. You may want to define it using defun-q: # S::STARTUP>

BZONDLO menu utilities loaded.

If I don't use the s::startup at all (I don't have any other apps that may have an s::startup) Then the code loads every drawing even though it's only in the acaddoc.lsp and savedprofile = T upon drawing opening.
I tried not using an acad.lsp at all and had the same results.
I'll attach a copy of acad.lsp and acaddoc.lsp.

Thanks again

Bill
Message 12 of 16
BillZ
in reply to: BillZ

Just to add:
If lispinit = 1
savedprofile comes up nil every drawing when checked in acaddoc.lsp, just like it did in the acad.lsp.
Same when not using any acad.lsp and setq savedprofile to T and vl-propagate in the acaddoc.lsp.
If I set lispinit = 0, then it will work to fire the setup code using the acaddoc.lsp.

Bill
Message was edited by: BillZ
Message 13 of 16
BillZ
in reply to: BillZ

In my research here I'm finiding things that go against what I thought I knew about acad.lsp and acadlspasdoc.
From the autocad website links posted in the thread about automatically loading files:

http://support.autodesk.com/Getdoc.asp?ID=TS21336

http://support.autodesk.com/Getdoc.asp?ID=TS68631


ACADLSPASDOC and SDI mode
ACADLSPASDOC is ignored in SDI (single document interface) mode.

And:

The disadvantage of using acad.lsp is that the files always will be loaded whether you need them in every drawing session or not.

Maybe this is why the Autodesk programmers can't get one version of AutoCAD the same as the previous version.
I had no trouble with acadlspasdoc and acad.lsp loading only on startup with R2004.

Bill
Message 14 of 16
BillZ
in reply to: BillZ

Inerestingly enough I did finally get the work around.
One problem that caused my prior attempt to fail was:
I had to use (vl-propagate 'savedprofile) instead of (vl-propagate savedprofile). They both returned T when executed....well....That'll be our little secret.
My acad.lsp now looks like this:

(defun s::startup ()
(vl-load-com)
(if (= nil savedprofile)
(progn
(load "g:/autolisp/AutoCAD_2004_Support/my_startup") ;program containing preference setup.
(my_startup)
)
)
;---;
) ;end s::startup defun
(princ) ;silent load.

With the my_startup routine containing the (setq savedprofile T) and the vl-propagate with all my setup calls.

I left my acaddoc.lsp with no changes and I created the my_startup subr in the support directory.
Seems to work fine now.

Thanks

Bill
Message 15 of 16
Anonymous
in reply to: BillZ

The need to quote the variable surprises me (I've never had to). Are you running 2004 products or 2005? I'm testing and running on 2004. I think that you've just answered another thing that has previously bugged me... I've often wondered why I could sometimes use (defun... and sometimes had to use (defun-q... It begins to seem to me that Acad.lsp does the compiling of the S::Startup; Therefore start up routines launched from Acad.lsp do not require the defun-q, as it is processed PRIOR to compiling, while those defined in AcadDoc.lsp do require the defun-q as they are processed AFTER startup is compiled. I'm glad that I stayed with it to the end ;-) -- Gary J. Orr CADD Administrator (218) 279-2421 Gary.Orr@LHBcorp.com LHB, Inc 21 West Superior Street, Suite 500 Duluth, Mn 55802 (218) 727-8446 www.LHBcorp.com "BillZ" wrote in message news:23025990.1081438116952.JavaMail.jive@jiveforum1.autodesk.com... > Inerestingly enough I did finally get the work around. > One problem that caused my prior attempt to fail was: > I had to use (vl-propagate 'savedprofile) instead of (vl-propagate savedprofile). They both returned T when executed....well....That'll be our little secret. > My acad.lsp now looks like this: > > (defun s::startup () > (vl-load-com) > (if (= nil savedprofile) > (progn > (load "g:/autolisp/AutoCAD_2004_Support/my_startup") ;program containing preference setup. > (my_startup) > ) > ) > ;---; > ) ;end s::startup defun > (princ) ;silent load. > > With the my_startup routine containing the (setq savedprofile T) and the vl-propagate with all my setup calls. > > I left my acaddoc.lsp with no changes and I created the my_startup subr in the support directory. > Seems to work fine now. > > Thanks > > Bill
Message 16 of 16
BillZ
in reply to: BillZ

<< running 2004 products or 2005? I'm testing and running on 2004.>>>

I am on 2005 and was surprised to have problems being I just got set up in 2004 with no troubles like this.
I found the quote thing in the help files ( I thought at first it worked without the quote). I also found and example of the defun-q that used a quote with the append function: (append s::startup 'my_startup-q) but have not tested it.

<<>>
Sometimes to me posting is like talking out loud, it helps me think.
:^)

Thanks for being there.

Bill

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

Post to forums  

Autodesk Design & Make Report

”Boost