aawilds Posted November 16, 2017 Posted November 16, 2017 Hello all. First off let me thank Lee Mac for all that he does with LISP and how he helps others out. He is a great value to the community. Now for the question I have been trying to get his Tip of the day lisp working. I have the lisp in my startup suite, it and the text file are both in a support file search path, and it does not show a tip at the start of the day. The Lisp does load because I can type (LM:tip) and it shows a tip, it just does not show anything for the first dwg of the day. Could the issue be that I am using Civil 3D 2015, maybe so variable that is causing the problem? http://www.lee-mac.com/tipoftheday.html Quote
Jef! Posted November 16, 2017 Posted November 16, 2017 Hi there. Just Shooting in the dark here. The function is defined, so the problems seems to be with the s::startup definition. This is where it is handled. (if (= 'list (type s::startup)) (if (not (member '(LM:tip) s::startup)) (setq s::startup (append s::startup '((LM:tip)))) ) (defun-q s::startup nil (LM:tip)) ) My guess: Maybe another function loaded after LM tip of the day redefine s::startup before it is executed? To see if that is the case, try typing (defun-q-list-ref 's::startup), which will show you the list which is bound to s::startup. It should return "(nil (LM:TIP))" or a longer list which contain (LM:TIP) at the end of it. If not, then something redefine s::startup after LM:tip does its magic. @Lee. If s::startup is not a list, s::Startup is defuned-q with (LM:tip). When I look at at AKN example for s::startup, they use defun (type = SUBR). With your code as is, if anyone has a s::startup defined using defun, from the test I made the part of LM:tip that I posted will overwrite it. Command: (defun s::startup () (princ"ya"))S::STARTUP Command: (s::startup) ya"ya" Command: (if (= 'list (type s::startup)) (_> (if (not (member '(LM:tip) s::startup)) ((_> (setq s::startup (append s::startup '((LM:tip)))) ((_> ) (_> (defun-q s::startup nil (LM:tip))) S::STARTUP Command: (defun-q-list-ref 's::startup) (nil (LM:TIP)) I think a (= (type s::startup) 'SUBR) is needed, but if that is the case, is a workaround to "append" to a s::startup made using Defun? Cheers! Quote
Lee Mac Posted November 16, 2017 Posted November 16, 2017 @Lee. If s::startup is not a list, s::Startup is defuned-q with (LM:tip). When I look at at AKN example for s::startup, they use defun (type = SUBR). For as long as I can remember, the formal documentation always advised to define the s::startup function as a list (i.e. using defun-q / defun-q-list-set), for example, as shown in this contradictory documentation from Autodesk. Therefore, with this in mind, I would argue that if the s::startup function is not of list data type, it should be correctly redefined as such. Quote
Lee Mac Posted November 16, 2017 Posted November 16, 2017 Hello all. First off let me thank Lee Mac for all that he does with LISP and how he helps others out. He is a great value to the community. Thank you for your kind words aawilds, I appreciate your gratitude for my contributions to the community. To test Jef!'s hypothesis above, you could try replacing lines 210-215 (inclusive) in the code with: (LM:tip) Quote
Jef! Posted November 17, 2017 Posted November 17, 2017 For as long as I can remember, the formal documentation always advised to define the s::startup function as a list (i.e. using defun-q / defun-q-list-set), for example, as shown in this contradictory documentation from Autodesk. Therefore, with this in mind, I would argue that if the s::startup function is not of list data type, it should be correctly redefined as such. I would not argue against defun-q being the best approach, as it enable the use of defun-q-list-ref, enables appending and/or setq differently. I might argue that if someone has a 3rd party app that use defun, or chose to use defun, it is his choice. For all I know it is just because that someone stumbled on a contradictory Adesk piece of documentation. Even if I don't approve, and also think that it should be correctly redefined as such, I would still not skip subr verification and just overwrite it. As always, I really appreciate the feedback you give. Cheers! Quote
aawilds Posted November 17, 2017 Author Posted November 17, 2017 To test Jef!'s hypothesis above, you could try replacing lines 210-215 (inclusive) in the code with: (LM:tip) That seems to be the issue it does now popup the tip on startup. The thing is I went through every other lisp that I have loaded with the startup suite and none of them change the s::startup function. It also opens a blank drawing I thought it would wait till the user picked a drawing to open. Thank you both with the help. Quote
Jef! Posted November 17, 2017 Posted November 17, 2017 To see if it is defined, you can type !s::startup, with what has been said here it should returned something like # Other that by the startup suite, It could be defined in a menu, a vlx, in acad.lsp or acaddoc.lsp, vba or in any other source that is loaded by any of the above in the first place. You could search for s::startup (in windows explorer) but if it is defined in an encrypted file, you wont find it. Happy hunting! I'm glad I could help! Have a nice week end! Quote
Lee Mac Posted November 17, 2017 Posted November 17, 2017 That seems to be the issue it does now popup the tip on startup. The thing is I went through every other lisp that I have loaded with the startup suite and none of them change the s::startup function. It also opens a blank drawing I thought it would wait till the user picked a drawing to open. Thank you both with the help. I'm glad to hear that the program is now working well for you; if you wanted the tip to only be displayed for a saved drawing, you could test the DWGTITLED system variable prior to evaluating the (LM:tip) function when the program is loaded. Quote
aawilds Posted November 17, 2017 Author Posted November 17, 2017 Thank you both y'all have been a big help. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.