masterfal Posted June 23, 2023 Share Posted June 23, 2023 Hi, Does anyone know if its possible to pinpoint where a lisp routine is being run from? I've got hundreds of lisp routines set up, majority are called up from 1 lsp file but i have a bunch that run from separate files. My issue is every know and then i run a lisp command i want to change but i can't work out where its being referenced from. I usually just end up setting up a new command but it would be much better if i could just edit the main routine. Possible or not really? Quote Link to comment Share on other sites More sharing options...
Emmanuel Delay Posted June 23, 2023 Share Posted June 23, 2023 (edited) I don't think you can do that. I hope I'm wrong, I'd like to know. Okay, one thing you can do if you have the time, is start every function by saying who they are and where they're saved. (defun rad2deg (rad) (princ "\nfunction rad2deg - mathfunctions.lsp") ;; (/ (* rad 180.0) pi) ) Edit: Now that I think about it... You could write a lisp function that writes this extra line of code to all other lisp files. But this is probably not a good idea More edit: don't use princ. Make a custom funtion that you can turn on and off. Edited June 23, 2023 by Emmanuel Delay Quote Link to comment Share on other sites More sharing options...
mhupp Posted June 23, 2023 Share Posted June 23, 2023 All your lisps should be in one place/folder. are you asking to find the specific file that has the command? quick and easy open them all into notepad++ and run a search across all documents. 2 hours ago, masterfal said: My issue is every know and then i run a lisp command i want to change but i can't work out where its being referenced from. I usually just end up setting up a new command but it would be much better if i could just edit the main routine. I would take the time to clean up your commands and get everything in order. to cut down on redundancy and improve performance. and over all make things simpler. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 23, 2023 Share Posted June 23, 2023 Like others if you know command then windows can help, you run command mode, change to the directory where your lsp files are and do Findstr rad2deg *.lsp and it will display all the files with that text. You can look in your menu files also use CUI or if your lucky can open the .mnu files, also look for mnl files they load lisps as well. If its a big lisp could look for C : using findstr and get all the command defuns. go bottom left in windows type CMD then for this lisp directory D: CD \LISP D:\LISP>findstr aaa *.lsp AdvancedPolyOutlineV1-2.lsp: (and (caaar lst) (caaadr lst) AdvancedPolyOutlineV1-2.lsp: (setq ep1 (f (_endpoints (caaar lst) (last (caar lst))))) AdvancedPolyOutlineV1-2.lsp: (setq ep2 (f (_endpoints (caaadr lst) (last (caadr lst))))) repeat object along line.lsp:; change aaa to soemthing else to suit repeat object along line.lsp:(defun c:aaa ( / pt1 pt2 pt3 ans oldang oldangdir oldsnap xoff yoff maxspc dia ) repeat object along line.lsp:(alert "Type aaa to run again") repeat object along line.lsp:(c:aaa) ss.lsp:(defun c:aaa ( / ss) D:\LISP> Similar to Notepad method 1 Quote Link to comment Share on other sites More sharing options...
mhupp Posted June 25, 2023 Share Posted June 25, 2023 apparently windows explorer can search inside files you just have to enable it. https://www.howtogeek.com/99406/how-to-search-for-text-inside-of-any-file-using-windows-search/ Quote Link to comment Share on other sites More sharing options...
JerryFiedler Posted June 25, 2023 Share Posted June 25, 2023 I really like using "Agent Ransack". https://www.mythicsoft.com/agentransack/ The free version is just what I need. You enter the folder containing the lisp files you want to search. Then enter the search term. The left side of the resulting window will show all the files containing your search term. If you high-lite, i.e. select, one of the files the right side of the window shows ALL the incidences of the search term in THAT file. The entire line of the file is displayed so you can review whether or not the context is what you are looking for. It is a slick program. Too bad it has such an odd name! Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 25, 2023 Share Posted June 25, 2023 Could do via a lisp using wcmatch reading lisp files I dont think as fast as the findstr though. Quote Link to comment Share on other sites More sharing options...
masterfal Posted June 26, 2023 Author Share Posted June 26, 2023 thanks for the feedback! yeh i definitely need to do a bit of housekeeping and tidy up my main lisp folder.. i grabbed that agentransack app. that'll come in handy i'm sure. i've never been able to get the windows search function to find all the stuff it should be finding Quote Link to comment Share on other sites More sharing options...
Steven P Posted June 26, 2023 Share Posted June 26, 2023 You could try this one, command is 'LH' - let me know if it wants something else (it is my 'help' LISP, you can read through it to work out what it does, but for this thread select a LISP in the main list and in the top of the box on the right will tell you the file. You can also search LISPs in a file from the top 2 dialogues. I didn't get chance over the weekend to take stuff out to do just what you wanted, ) LISPSHELP.lsp Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 27, 2023 Share Posted June 27, 2023 Had a play with startapp, shell, and powershell using findstr, pretty sure could get one of them to work passing the command to the windows operating system, so very fast. This worked bat file that you would write with lisp so look for string aaa c:\\windows\\syswow64\\findstr.exe aaa D:\\lisp\\*.lsp pause Lisp code to call the bat file (startapp "D:\\acadtemp\\test.bat") 1 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.