CadJunky Posted May 24, 2017 Share Posted May 24, 2017 Hey, guys. Maybe an easy one. How can I retrieve all of the defuns in my one master lisp file. I have one lisp file that has hundreds of individual command that reside within it. Quote Link to comment Share on other sites More sharing options...
David Bethel Posted May 24, 2017 Share Posted May 24, 2017 Welcome to CADTutor. That can actually be a tough problem. If: The main file has not been loaded There are no overwrite of the defun name when loading The defun name is not a protected symbol ALL variables the main file are localized So on And So on Then this could work : [b][color=BLACK]([/color][/b]defun c:ldefun [b][color=FUCHSIA]([/color][/b]/ dl oldatoms newatoms[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq oldatoms [b][color=NAVY]([/color][/b]atoms-family 1[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]load [color=#2f4f4f]"[i][b]file_name[/b][/i]"[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq newatoms [b][color=NAVY]([/color][/b]atoms-family 1[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]foreach a newatoms [b][color=NAVY]([/color][/b]if [b][color=MAROON]([/color][/b]not [b][color=GREEN]([/color][/b]member a oldatoms[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]setq dl [b][color=GREEN]([/color][/b]cons a dl[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]prin1 dl[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] Otherwise, if you are VERY consistent in your coding practices, you could read every line in the main file searching for the string defun and the extract the next word in that line as the function name. -David Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 24, 2017 Share Posted May 24, 2017 You could try this old program, but it's by no means bulletproof. Quote Link to comment Share on other sites More sharing options...
CadJunky Posted May 24, 2017 Author Share Posted May 24, 2017 Thanks, Lee Mac. Your routine worked exactly for what I was looking for. Much appreciated. @David - Thanks for your reply. I appreciate it. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 25, 2017 Share Posted May 25, 2017 Another read your lisp file line by line look for "(defun" then simply write that line to a text file. It will find all Command defuns, plain rtd and user AH:getval etc 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.