hosyn Posted July 9, 2018 Share Posted July 9, 2018 Hey guys Are there approach for load again the latest lisp file loaded from some lsp file?? Quote Link to comment Share on other sites More sharing options...
Emmanuel Delay Posted July 10, 2018 Share Posted July 10, 2018 I have a .lsp file on my desktop that loads other useful lisp files. (defun openuseful ( / ) (load "...\\lisp\\cabling\\movetofrom.lsp") (load "...\\lisp\\alp\\alp3.lsp") (load "...\\lisp\\furn\\furn_v5.lsp") ... ) (openuseful) You can also make Autocad auto-load a list of files that you provide. But lisp does not remember which function is on which file. Like you cannot write a function (defun detectCurrentLispFile (/) ... ) . That question would not make sense to lisp. Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted July 10, 2018 Share Posted July 10, 2018 Hey guysAre there approach for load again the latest lisp file loaded from some lsp file?? What exactly do you mean? Are you loading a lisp file, then while you're working, someone is updating the code and you want to load it as soon as the file is updated? Quote Link to comment Share on other sites More sharing options...
hosyn Posted July 10, 2018 Author Share Posted July 10, 2018 What exactly do you mean? Are you loading a lisp file, then while you're working, someone is updating the code and you want to load it as soon as the file is updated? Yup, this is exactly what I need. (after updating code) Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted July 10, 2018 Share Posted July 10, 2018 And you want it to do this automatically, with no human interaction? I suppose you'll need a reactor, and a function that can read the file dates. (some examples here possibly) 1. Load the function, and read/store the file date on the file. 2. Have the reactor check the file every so often (30 sec?), and if the file date/time is newer, repeat step 1. Quote Link to comment Share on other sites More sharing options...
Steven P Posted July 10, 2018 Share Posted July 10, 2018 I use this: (defun c:appreload () ;;Re-load named LISP files (setq mylispfolder "c:\\Users\\.....\\......\\") (setq myfiles (vl-directory-files mylispfolder "*.lsp" nil)) ;;myfiles is list of files in mylispfolder location (setq mylistlength (length myfiles)) ;;count of number of lsp files (setq acount -1) (repeat mylistlength (setq acount (1+ acount)) (setq FailedtoLoad (strcat (nth acount myfiles) " failed to load")) (load (strcat mylispfolder (nth acount myfiles)) FailedtoLoad) ;;Loads each LISP file ) ) which will load all the LISP files within a location. I use it when I have updated a LIPS 'appreload' and its reloads (I have a folder with all my LISPS in it) However it won't reload a LISP file as soon as its been updated you still need to type in the command. For al the time that takes and the time it would take to research and write a code to do this automatically is it worth the effort? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 11, 2018 Share Posted July 11, 2018 If your writing and testing just make a temporary defun takes about 30 seconds. (defun c:aaa ()(load "mynewprogram")) 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.