Lee Mac Posted December 17, 2010 Share Posted December 17, 2010 (edited) I finally got around to writing this tutorial which hopefully encompasses everything a user might need to know on the topic of loading programs on startup. Loading Programs Automatically As always, your feedback is very welcome should you have any suggestions for improvement, criticism, or indeed discover mistakes in the content. Enjoy! Lee Edited December 18, 2010 by Lee Mac Quote Link to comment Share on other sites More sharing options...
pBe Posted December 20, 2010 Share Posted December 20, 2010 (edited) Great tutorial Lee. Thank you for the lessons my friend Question for you. Is it advisable to load lisp that are programmed to run upon loading and not as a sub for the current active lisp? (defun c:Drawline () (setq ...) (if () (load "C:\\My Folder\\MyProgram\\ChangeProgram") ) ) (defun c:ChangeMe () (... ...) );defun (c:ChangeMe) or is it better this way? ;;ACADDOC.lsp (....... (autoload "LineProgram" '("DrawLine")) (autoload "ChangeProgram" '("ChangeMe")) (..... (defun c:Drawline () (setq ...) (if () (ChangeMe) ) ) or neither? or better yet stick with sub-routine from the toolbox functions? This are jsut few from my collection "Bad Habits for Coding in Vlisp: Don't do it" Edited December 20, 2010 by pBe Typo error Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 20, 2010 Author Share Posted December 20, 2010 Thanks pBe With regards to your question, if the LISP is programmed to run automatically upon loading, then using 'autoload' will cause the LISP to run twice since the autoload function will also call the program following loading. I suppose it depends on what kind of behaviour you are looking for. For example, with some reactors, you might want them to be loaded and running in the background when you open a new drawing - and so programming these to run when loaded then using the 'load' function in the ACADDOC.lsp is perhaps the easiest solution. However, if you are just looking to load a normal program to be called at the command line when the user needs it, then I would just use the 'autoload' function within the ACADDOC.lsp which will handle the first-time loading for you (otherwise, perhaps write your own autoload function as demonstrated here). Lee Quote Link to comment Share on other sites More sharing options...
Fnuik Posted December 20, 2010 Share Posted December 20, 2010 An other id is when u have a CUI file and a corresponding .MNL (Lisp) file with the same name in the same folder, the mnl file will load automaticly with the cui file. Thats how i do it Quote Link to comment Share on other sites More sharing options...
Bhanson Posted December 23, 2010 Share Posted December 23, 2010 Thanks for the tutorial. I did have a question though. Would it be advantageous to use the autoload command in ACADDOC.lsp when testing new code so that every time I would go to type in the function name it would re-load the file and any changes that have been made since I opened the drawing? Just Wondering. Thx Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 23, 2010 Author Share Posted December 23, 2010 Thanks for the tutorial. You're welcome I did have a question though. Would it be advantageous to use the autoload command in ACADDOC.lsp when testing new code so that every time I would go to type in the function name it would re-load the file and any changes that have been made since I opened the drawing? Autoload will not 'reload' the function everytime you type the command syntax - it will only load the file once, the first time the user types the command. Why not edit/reload code using the VLIDE? Quote Link to comment Share on other sites More sharing options...
Bhanson Posted December 23, 2010 Share Posted December 23, 2010 Thanks , I've been teaching myself AutoLisp for about a year now but there are a quite a few little tricks I simply haven't learned yet. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 23, 2010 Author Share Posted December 23, 2010 Thanks , I've been teaching myself AutoLisp for about a year now but there are a quite a few little tricks I simply haven't learned yet. The VLIDE really is the way to go - even if you are just going to use AutoLISP and not stray into Visual - its got great debugging capabilities and the Help documentation is only a click away. Lee Quote Link to comment Share on other sites More sharing options...
alanjt Posted December 23, 2010 Share Posted December 23, 2010 The VLIDE really is the way to go - even if you are just going to use AutoLISP and not stray into Visual - its got great debugging capabilities and the Help documentation is only a click away. Lee Hell, I'd use it simply because it has automatic formatting and you can load it directly into AutoCAD for testing, etc. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 23, 2010 Author Share Posted December 23, 2010 Hell, I'd use it simply because it has automatic formatting and you can load it directly into AutoCAD for testing, etc. Exactly. I sometimes use Notepad++ because it has more formatting tricks, but mostly the VLIDE due to how directly something can be loaded. Quote Link to comment Share on other sites More sharing options...
alanjt Posted December 23, 2010 Share Posted December 23, 2010 Exactly. I sometimes use Notepad++ because it has more formatting tricks, but mostly the VLIDE due to how directly something can be loaded. Ehh, the formatting is close enough for me and I couldn't trade the ability to load directly. Quote Link to comment Share on other sites More sharing options...
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.