au-s Posted January 22, 2009 Share Posted January 22, 2009 Hello, Since I do not want to add many supportpaths into Support Search Paths each time I create a lisp I want to load them with the commands in mnl file. Here is the scenario. In my Support Path "C:\\Support" I have Lisp called AIX_main.lsp I am not good at lisp but here it is: (defun AIX:LOADALL (/= lisppath netname) (setq netname "C:\\Lisp") (setq lisppath (strcat netname )) (load lisppath "\\" "ucs;" ) ) (AIX:UCS) (PRINC) And here is my under Supoportpath "c:\\menues" which is also added in my SupportFile Search Path. (autoload "AIX_main" '("AIX:UCS" )) Then I have about 10 folders whioch are not added in my Support Fiel SearchPath, like: c:\\lisp\\ucs c:\\lisp\\color c:\\lisp\\xref c:\\lisp\\linetypes etc ... So, what I want is instead of loading into my supportfile thousands of paths that has lisp-files in them I want to devide those paths into different menus which use them. So those mnl - files load only the commands from lisps in certain searchpaths. I hope you understand what I mean. Thank you. You might maybe give me a suggestion or sample of code I can move on with Best regards! Quote Link to comment Share on other sites More sharing options...
ASMI Posted January 22, 2009 Share Posted January 22, 2009 All 'Support Search Paths' contains in "ACAD" inviroment variable. Get it with (getenv "ACAD"), add your paths and save with (setenv "ACAD" PathString). To determine the standard ways to best use the Windows system variables. For example: Command: (getenv "SystemDrive") "C:" Command: (getenv "SystemRoot") "C:\\Windows" Command: (getenv "AllUsersProfile") "C:\\ProgramData" Command: (getenv "UserProfile") "C:\\Users\\Alexander" Command: (getenv "ProgramFiles") "C:\\Program Files" This could serve as a starting point for establishing the correct path. Quote Link to comment Share on other sites More sharing options...
au-s Posted January 22, 2009 Author Share Posted January 22, 2009 Okej... So is it like: My /Support/AIX_main.lsp (defun C:AIX:LOADALL () (setq lisppath (strcat "K:\\CAD\\AIX-meny-2008\\Lisp\\")) (setenv "LISP" lisppath "ucs;" "xref;" ) );end defun AND in my /menu/AIX_main.mnl (autoload "AIX_main" '("AIX:LOADALL )) or (getenv "LISP") Am I going the right way? Quote Link to comment Share on other sites More sharing options...
ASMI Posted January 22, 2009 Share Posted January 22, 2009 I think something like this: (defun C:AIX:LOADALL(/ lispPath subPath cPath) (setq lisPpath "K:\\CAD\\AIX-meny-2008\\Lisp\\" subPath '("ucs" "xref" "color" "linetypes") ); end setq (foreach sp subPath (setq cPath(strcat lisPpath sp)) (load cPath (alert(strcat "\nError loading: " cPath))) ); end foreach (princ) ); end defun If K: is server path: "K:\\\\CAD\\AIX-meny-2008\\Lisp\\" Quote Link to comment Share on other sites More sharing options...
au-s Posted January 22, 2009 Author Share Posted January 22, 2009 Thanx That worked fine !!! I will study the code and learn!! Thanx Sir! Quote Link to comment Share on other sites More sharing options...
au-s Posted January 22, 2009 Author Share Posted January 22, 2009 Hmm .. no it does not Quote Link to comment Share on other sites More sharing options...
ASMI Posted January 22, 2009 Share Posted January 22, 2009 Hmm .. no it does not : Quote Link to comment Share on other sites More sharing options...
au-s Posted January 22, 2009 Author Share Posted January 22, 2009 I have your code in /Support/AIX_main.lsp I have in my /menu/AIX_main.mnl this code: (autoload "AIX_main" '("AIX:LOADALL" )) (command "AIX:LOADALL") I have my lisps in: /Lisp/xref /lisp/ucs /lisp/color etc... first of all when I laod everything it complains: Unknown command "AIX:LOADALL" Then when I in commandline type AIX:LOADALL it complains it cant find searchpaths. AND when I try the menu it goes: The file AIX_xref(.lsp/.exe/.arx) was not found in your search path folders. Quote Link to comment Share on other sites More sharing options...
ASMI Posted January 22, 2009 Share Posted January 22, 2009 1. Because (command "AIX:LOADALL")? It can't work in any case. (C:AIX:LOADALL) - will work ok, and (autoload "AIX_main" '("C:AIX:LOADALL" )) 2. Does '("ucs" "xref" "color" "linetypes") only folders not lisp files? If it only folders you can use vl-directory-files to get file list inside. 3. The file AIX_xref(.lsp/.exe/.arx) was not found in your search path folders. What is AIX_xref? The load and autoload functions can load .lsp/.fas/.vlx files only. For .arx you shoul use the arxload or autoarxload functions. Quote Link to comment Share on other sites More sharing options...
au-s Posted January 22, 2009 Author Share Posted January 22, 2009 Got it ... 2. the "ucs" "xref" are directories with an amount of lisp files in them. 3. AIX_xref is a lisp file in /lisp/xref Thanks for helping me out. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 22, 2009 Share Posted January 22, 2009 Sorry to nose in on this thread, but, if "ucs" "xref" are directories where LISPs are housed, then surely in the code: (defun C:AIX:LOADALL(/ lispPath subPath cPath) (setq lisPpath "K:\\CAD\\AIX-meny-2008\\Lisp\\" subPath '("ucs" "xref" "color" "linetypes") ); end setq (foreach sp subPath (setq cPath(strcat lisPpath sp)) (load cPath (alert(strcat "\nError loading: " cPath))) ); end foreach (princ) ); end defun You would need to strcat it with: (defun C:AIX:LOADALL(/ lispPath subPath cPath) (setq lisPpath "K:\\CAD\\AIX-meny-2008\\Lisp\\" subPath '("ucs" "xref" "color" "linetypes") ); end setq (foreach sp subPath (setq cPath(strcat lisPpath sp [b][color=Red]"\\LISPfilename"[/color][/b])) (load cPath (alert(strcat "\nError loading: " cPath))) ); end foreach (princ) ); end defun As the "ucs" "xref" etc are only at folder level. Perhaps I have interupted when I shouldn't, but (in the words of David Bethel), only offering my $0.02. Quote Link to comment Share on other sites More sharing options...
ASMI Posted January 22, 2009 Share Posted January 22, 2009 (defun C:AIX:LOADALL(/ lispPath subPath cPath fLst cFil) (setq lisPpath "K:\\CAD\\AIX-meny-2008\\Lisp\\" subPath '("ucs" "xref" "color" "linetypes") ); end setq (foreach sp subPath (setq cPath(strcat lisPpath sp)) [color="Blue"](if(setq fLst(vl-directory-files cPath "*.lsp" 1)) (foreach cf fLst (setq cFil(strcat cPath "\\" cf)) (load cFil (alert(strcat "\nError loading: " cFil))) ); end foreach ); end if[/color] ); end foreach (princ) ); end defun Now extracts and try to load all *.lsp files inside each folder. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 22, 2009 Share Posted January 22, 2009 (defun C:AIX:LOADALL(/ lispPath subPath cPath fLst cFil) (setq lisPpath "K:\\CAD\\AIX-meny-2008\\Lisp\\" subPath '("ucs" "xref" "color" "linetypes") ); end setq (foreach sp subPath (setq cPath(strcat lisPpath sp)) [color=Blue](if(setq fLst(vl-directory-files cPath "*.lsp" 1)) (foreach cf fLst (setq cFil(strcat cPath "\\" cf)) (load cFil (alert(strcat "\nError loading: " cFil))) ); end foreach ); end if[/color] ); end foreach (princ) ); end defun Now extracts and try to load all *.lsp files inside each folder. Nice one ASMI, exactly what I was looking to do 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.