CAD USER Posted November 26, 2015 Share Posted November 26, 2015 I have so many Lisp files, any possibility to all lisp combine in one Lisp file?? Thanks in advance.. Quote Link to comment Share on other sites More sharing options...
rlx Posted November 26, 2015 Share Posted November 26, 2015 I have so many Lisp files, any possibility to all lisp combine in one Lisp file?? Thanks in advance.. sure , paste them all in one file , for example mylisp.lsp. Just load this file every time and any function defined in mylisp.lsp will be available to you. gr. Rlx Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 26, 2015 Share Posted November 26, 2015 If you want 1 lisp have a think about a library lisp ie where you have just previously copied and pasted well tested code that you have put into multiple lisps and make them a defun, our auto load just has an emphasis on all the keyboard shortcuts rather than the code. You can use a (if (not mydefuname )(load "mydefuname")) so only load as required, again the if not finds my individual library code rather than say 30 programs in one lisp. This is simple for run from a menu command. I have again started moving code to a more multi defun approach not the copy and paste. New enter values use my auto create dialouge box routines "Getvals.lsp" this is like 3 lines of code and you have dialouge box entry rather than command line. Have a think about how many times in all your code you ask for say getstring or getreal repeatedly. The AutoLoad function enables a user to load an AutoLISP file when a specific command is entered at the command line. (autoload "COPY0" '("COPY0")) (autoload "COPYCOMMAND" '("ZZZ")) (autoload "COVER" '("COVER")) (autoload "DIMFLIP" '("DIMFLIP")) Quote Link to comment Share on other sites More sharing options...
CAD USER Posted November 27, 2015 Author Share Posted November 27, 2015 Thanks, Dear, rlx & Dear Bigal...... Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 27, 2015 Share Posted November 27, 2015 Where the autoload function is concerned, consider this improved version which averts the risk of an infinite recursive loop if the function is not correctly redefined. Quote Link to comment Share on other sites More sharing options...
rlx Posted November 27, 2015 Share Posted November 27, 2015 (edited) Thanks, Dear, rlx & Dear Bigal...... You're welcome , lots of information on this site as well Lee's site. I have several functions I use quite often. Just remember if you ever sent somebody one of your routines to include either your 'library lisp' or include the function used by the another lisp program. It's not unlike xref's , it's a LispRef :-) Gr. Rlx Edited November 27, 2015 by rlx Quote Link to comment Share on other sites More sharing options...
CAD USER Posted November 28, 2015 Author Share Posted November 28, 2015 Ok, rlx, I will do that??? thanks once again for everything... Quote Link to comment Share on other sites More sharing options...
ttray33y Posted December 1, 2015 Share Posted December 1, 2015 Ok, rlx, I will do that??? thanks once again for everything... or you can use the concatenate in ms dos, you can combine 100 .lsp in just a second. as simple as copy *.lsp merged.lsp the command copies all .lsp file then create a file merged.lsp and put them all in there. actually you can name it what ever you want. Quote Link to comment Share on other sites More sharing options...
sivapathasunderam Posted August 8, 2022 Share Posted August 8, 2022 On 12/1/2015 at 6:37 AM, ttray33y said: copy *.lsp merged.lsp the command copies all .lsp file then create a file merged.lsp and put them all in there. actually you can name it what ever you want. Need help (defun c:combinelisps () (startapp "cmd" "_cd C:\Users\Company\Documents\Autodesk\Lisp file folder" "copy *.lsp merged.lsp")) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 9, 2022 Share Posted August 9, 2022 (edited) 1. Go to bottom left of Windows type cmd cd \Users\Company\Documents\Autodesk\Lisp file folder copy *.lsp merged.lsp 2. So in lisp may need to use Shell rather than startapp. 3. Save above as a batch file .BAT then use (startapp "C:\Users\Company\Documents\Autodesk\Lisp file folder\copylisp.bat") Just a side note can add a security lisp by using, copy security.lsp+lisp1.lsp c:\somewhere\lisp1.lsp Edited August 9, 2022 by BIGAL Quote Link to comment Share on other sites More sharing options...
sivapathasunderam Posted August 9, 2022 Share Posted August 9, 2022 6 hours ago, BIGAL said: 1. Go to bottom left of Windows type cmd cd \Users\Company\Documents\Autodesk\Lisp file folder copy *.lsp merged.lsp 2. So in lisp may need to use Shell rather than startapp. 3. Save above as a batch file .BAT then use (startapp "C:\Users\Company\Documents\Autodesk\Lisp file folder\copylisp.bat") Just a side note can add a security lisp by using, copy security.lsp+lisp1.lsp c:\somewhere\lisp1.lsp cmd cd \Users\Company\Documents\Autodesk\Lisp file folder copy *.lsp merged.lsp You mean paste this to Notepad & change the extension as .bat (To create BAT File) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 10, 2022 Share Posted August 10, 2022 No need for cmd when you save as a bat file cd \Users\Company\Documents\Autodesk\Lisp file folder copy *.lsp merged.lsp For me by the time I have copied pasted and saved code made it work, I would have it all done using 1st manual method. Quote Link to comment Share on other sites More sharing options...
mhupp Posted August 10, 2022 Share Posted August 10, 2022 1 hour ago, BIGAL said: For me by the time I have copied pasted and saved code made it work, I would have it all done using 1st manual method. agree plus I dont want to automate updating the master lisp. could overwrite or lose code happend a few times so I always do it manually now. Quote Link to comment Share on other sites More sharing options...
sivapathasunderam Posted August 10, 2022 Share Posted August 10, 2022 BIGAL & mhupp: Thanks a lot Guys who replied to my thread ! I was merging Lisps files to make hard copies on A3 size paper to study & upgrade purpose only not to execute lisp routes. (To execute you can have max. 50 Lisps programs otherwise it makes you headache as per my knowledge) Another way by Lisp: (defun c:mergelisps ( / ) (vl-file-copy "c:/Users/Company/Documents/My Lisp programme/LISP1.lsp" "c:/Users/Company/Documents/My Lisp programme/Print_Purpose.lsp" T) (vl-file-copy "c:/Users/Company/Documents/My Lisp programme/LISP2.lsp" "c:/Users/Company/Documents/My Lisp programme/Print_Purpose.lsp" T) (vl-file-copy "c:/Users/Company/Documents/My Lisp programme/LISP3.lsp" "c:/Users/Company/Documents/My Lisp programme/Print_Purpose.lsp" T) (vl-file-copy "c:/Users/Company/Documents/My Lisp programme/LISP4.lsp" "c:/Users/Company/Documents/My Lisp programme/Print_Purpose.lsp" T) (vl-file-copy "c:/Users/Company/Documents/My Lisp programme/LISP5.lsp" "c:/Users/Company/Documents/My Lisp programme/Print_Purpose.lsp" T) (princ)) I want your help to upgrade the lisp with the below function (vl-load-com) (foreach lispfiles (vl-directory-files "c:/Users/Company/Documents/My Lisp programme" "*.LSP" 1) Thanks a lot. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 10, 2022 Share Posted August 10, 2022 As lisp files are text in old days could just push a text file straight to printer from DOS, should still be able to do the same probably using Powershell. Printing with Powershell and files in folders - Stack Overflow Please dont ask me how to make it work ! Trying to remember copy filename | printer Hey guys remember a dot matrix with a box of continuous paper hanging out the back, ideal for this task. Quote Link to comment Share on other sites More sharing options...
mhupp Posted August 10, 2022 Share Posted August 10, 2022 4 hours ago, sivapathasunderam said: To execute you can have max. 50 Lisps programs otherwise it makes you headache as per my knowledge I want your help to upgrade the lisp with the below function (vl-load-com) (foreach lispfiles (vl-directory-files "c:/Users/Company/Documents/My Lisp programme" "*.LSP" 1) Far as i know their isn't a limit on how many lisp you can have in one file. Tho I don't edit any lisp inside of the main file. Because when loading a lisp its all or nothing. meaning if you forget a ")" in one of the functions it will error and all other functions wont load either. So if I am editing a function I will copy it to a new file edit it there make sure its working then put it back into the main file. to avoid this issue. You got to tell it what to do (vl-load-com) (foreach lispfiles (vl-directory-files "c:/Users/Company/Documents/My Lisp programme" "*.LSP" 1) (load lispfiles) ;load I'm guessing? ) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 11, 2022 Share Posted August 11, 2022 mhupp "to make hard copies on A3 size paper to study " wants to print 1 file. Quote Link to comment Share on other sites More sharing options...
sivapathasunderam Posted August 21, 2022 Share Posted August 21, 2022 On 8/10/2022 at 3:24 PM, mhupp said: You got to tell it what to do (vl-load-com) (foreach lispfiles (vl-directory-files "c:/Users/Company/Documents/My Lisp programme" "*.LSP" 1) (load lispfiles) ;load I'm guessing? ) I wrongly approach to the foreach function 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.