jmos4 Posted March 1, 2017 Posted March 1, 2017 Hi, I have a personal lisp that worked good for years with no issues last 2012 AutoCAD, I am now on 2015 and having a issue with the file, it won't load from the startup suite and if I add a load to type out a command to load it, it keeps till I hit escape. this is the code I use to quick load it: (defun c:jmos () (quickld "jmos") (if loadok (c:jmos)) (princ)) now how do I get it to load once with the command without having to hit escape or get the startup suite to actually load the file? Thanks in advance, Regards, Quote
Roy_043 Posted March 1, 2017 Posted March 1, 2017 Assuming the file contains a c:jmos function and does not return "ERROR" when loaded, this should work: (defun c:jmos () (if (/= "ERROR" (load "jmos" "ERROR")) (c:jmos)) (princ)) Quote
jmos4 Posted March 1, 2017 Author Posted March 1, 2017 Hi, I tried that line of code and still keeps loading it and telling me it loaded until I hit escape is there a line I need to add to the jmos lisp, as the previous line is in the Acad lisp file? Regards Quote
jmos4 Posted March 1, 2017 Author Posted March 1, 2017 Hi, The ACAD.LSP file contains the quick load command line to load the JMOS.LSP, both of these load after the 2015 ACAD lisp file loads. The JMOS.LSP file contains a bunch of custom command, command lines so not sure why it all of sudden loads over and over again, its like it goes in a loop, and I really don't see why. Once I escape I can use the commands from that lisp file and all seems to work. but when I appload it loads once and that's it. I would be fine if I could get both file to load upon opening a file, just not sure how, I have added them to the startup suite and no go, so I added the quick load command so I didn't have to keep apploading each drawing, I just had to open 70 sheets so any fewer mouse clicks is the goal. Regards, Quote
Roy_043 Posted March 1, 2017 Posted March 1, 2017 You have not answered my question. Based on your original code I am assuming that the jmos.lsp contains a function named 'c:jmos'. Is that the case? Quote
Lee Mac Posted March 1, 2017 Posted March 1, 2017 Try loading the program using my version of an autoload function from here - this should report any issues rather than sending you into an infinite loop. For your program, you might call the function in the following way: (autoload "jmos" '("jmos")) Quote
jmos4 Posted March 2, 2017 Author Posted March 2, 2017 Hi, Guess I did not understand the question, I am using a add-on lisp (MARVIC) that has commands set to a default, I have a users lisp file (jmos.lsp) that changes some of the short commands to my preferences along with some added ones, I have been using it with minor tweaks since R13 and worked with no issues until version 2012. I had to change a bunch of things when I went to 2015 just to get it to work but the loading thing is one thing I can't seem to figure out. FYI: Program Acad.lsp loads, Add-on Acad.lsp (MARVIC) loads, and suppose to load jmos.lsp. Hopefully this helps you see what I have going on I tried adding the Auto load line in the Add-on Acad.lsp and it doesn't work, so any other things to try? Thanks all for the assistance so far, though were not getting very far with the solution, but may be my fault trying to explain this correctly. I would have though this shouldn't be this difficult, but good old Autodesk changing things that work for eons for the sake of change... Regards, Quote
Lee Mac Posted March 2, 2017 Posted March 2, 2017 I tried adding the Auto load line in the Add-on Acad.lsp and it doesn't work What error do you receive, if any? Have you ensure that my autoload function is loaded before evaluating it? Quote
jmos4 Posted March 2, 2017 Author Posted March 2, 2017 Hi again, No errors, its like it never does it, but I don't know how I could see if it is reading that line in the Lisp file, I know that use to be ways of checking but its been years since I got that in depth with Lisp, now I remember just enough to be dangerous, LOL FYI: it does load the 2015 Acad.lsp and the (Marvic) Acad.lsp, but that is where it stops. I added that line to the end of the Lisp file, I don't thing where it is should effect it, but I could be wrong? Is there a LISP command line I could add to the JMOS list to stop it loading after the first instance? I tried "(princ)" but that had no effect. Regards, Quote
Lee Mac Posted March 3, 2017 Posted March 3, 2017 After everything has loaded, what happens if you type 'jmos' at the command-line? Quote
jmos4 Posted March 3, 2017 Author Posted March 3, 2017 Hi, I add the quick load so I could type JMOS and get it to load, but it keeps loading over and over again until I hit escape. If I could solve that issue I could live with it not auto loading, just sucks that they changed things and now lisp files that have worked properly for years now won't. Regards, Quote
Lee Mac Posted March 3, 2017 Posted March 3, 2017 I add the quick load so I could type JMOS and get it to load, but it keeps loading over and over again until I hit escape. If I could solve that issue I could live with it not auto loading, just sucks that they changed things and now lisp files that have worked properly for years now won't. I realise that, but I suspect that your demand-load stub is not redefining the c:jmos function, which is why the function is loading in an infinite loop as the stub is being repeatedly evaluated. I therefore suggested that you instead use my autoload function to define the demand-load stub, and then try using the command (which would cause the program to load); my autoload function accounts for the possibility that the stub is not being redefined and will alert you to such. Quote
tombu Posted March 3, 2017 Posted March 3, 2017 Hi, The ACAD.LSP file contains the quick load command line to load the JMOS.LSP, both of these load after the 2015 ACAD lisp file loads. The JMOS.LSP file contains a bunch of custom command, command lines so not sure why it all of sudden loads over and over again, its like it goes in a loop, and I really don't see why. Once I escape I can use the commands from that lisp file and all seems to work. but when I appload it loads once and that's it. I would be fine if I could get both file to load upon opening a file, just not sure how, I have added them to the startup suite and no go, so I added the quick load command so I didn't have to keep apploading each drawing, I just had to open 70 sheets so any fewer mouse clicks is the goal. Regards, Did you remove it from the Startup Suite before you added it to load in ACAD.LSP? What returns when you enter !c:jmos at the command line? Quote
jmos4 Posted March 6, 2017 Author Posted March 6, 2017 Hi again, I did remove the lisp from the start-up suite, even though it doesn't seem to load from there, I can Appload it and it loads once and that is it, if I use the quick command it goes into a loop like you stated. I tried the auto load line in the Marvic Lisp and it doesn't load the lisp file, not sure if it matters or not, but when the JMOS.lsp loads it tells you so, so even if I start a fresh session of AutoCAD and hit f2 I can see its not loading. Seems like this shouldn't be that big of a pain to get to load, and doing 1 or 2 drawings isn't bad but having to open 70 of them it gets old real quick going thru the appload routine or quick loading and hitting escape every time Is there a routine I can add to the end of the JMOS lisp that will kill the loop? Regards, Quote
Lee Mac Posted March 6, 2017 Posted March 6, 2017 I tried the auto load line in the Marvic Lisp and it doesn't load the lisp file, not sure if it matters or not, but when the JMOS.lsp loads it tells you so, so even if I start a fresh session of AutoCAD and hit f2 I can see its not loading. As described in my previous posts, the autoload expression will define a demand-load stub which will load the program when you invoke the command, therefore you will not see any loading messages on startup (this is why I asked what happens when you invoke the command after everything had loaded, however you ignored this question). Quote
tombu Posted March 6, 2017 Posted March 6, 2017 The problem has to be in the Marvic Lisp. Did you try Lee's autoloader? Try loading it at the command line with (load "jmos.lsp") and look for errors at the command line. Personally I autoload with macros in the Ribbon. ^C^C^P(or C:jmos (load "arrow.lsp"));jmos only loads "jmos.lsp" if it hasn't already been loaded. Then jmos is run. Quote
jmos4 Posted March 6, 2017 Author Posted March 6, 2017 Hi, I didn't know what you meant , but tried the auto load in the Marvic lisp and then invoked it (typed jmos in the command line) and it did the runaway loading again, acted the exact same as the quick load does. only way it loads once is thru appload, not sure why that works and the other methods do not. If there was a way to stopped it after 1 load that would be great, funny is it use to load automatically in 2012 just like it had since R13 so not sure what changed to make it behave this way, but its annoying to say the least. I probable could add a custom tool bar button/Macro but I am kind of old school and like typing 90% of my commands usually with a 2-3 digit abbreviation Regards, Quote
tombu Posted March 6, 2017 Posted March 6, 2017 Clearly Marvic Lisp is the problem, try Lee's autoloader. Quote
jmos4 Posted March 6, 2017 Author Posted March 6, 2017 Hi, I am really certain Marvic is not the issue, as it worked for years and years, originally, Marvic had a user ID which does not seem to maintain in newer versions of AutoCAD, that would load a users specific lisp file (jmos.lsp) when you would open a drawing it would load the Marvic lisp and then the user lips and never had a issue until newer version of AutoCAD maybe 2010 onward?. (if (findfile "f:/lsp/users/userid.lsp") (load "f:/lsp/users/userid.lsp") (princ "\n\n********* Could not find the F:/LSP/USERS/USERID.LSP file. ***********\n\n") ) so hence I added the quick load, here are the 2 ones I have used with the same runaway effect: (defun c:jmos () (quickld "jmos") (if loadok (c:jmos)) (princ)) suggested in this post: (defun c:jmos () (if (/= "ERROR" (load "jmos" "ERROR")) (c:jmos)) (princ)) I tried and added the auto load to the end of the Marvic lisp: (autoload "jmos" '("jmos")) and the same runaway The JMOS lisp is not necessarily a function, but merely a to load my preference for certain lisp routines Like I said not sure why it doesn't work like it use to, I really haven't been using AutoCAD a lot for the past decade, but when I do it would be nice to get this working without having to appload things or escape every time. Thanks for the replies, Regards, 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.