Fire Alarm Posted December 29, 2009 Posted December 29, 2009 I have search and can not seem to find a lisp. Hopefully yall will be able to help me. I am looking for a AutoLisp that will find and replace multiple text. For example if I have a string of text like 75cd, 15cd, 30cd, 30cd, 110cd, and I need everything to read 75cd. Instead of doing the find and replace command four times, or editing each attribute/text individually I would like to have it find all the 15's, 30's, & 110's and replace them with 75 at the same time. Thanks for taking to the time to help. Quote
ReMark Posted December 29, 2009 Posted December 29, 2009 Take a look at this. http://www.cadtutor.net/forum/showthread.php?t=35933 If you use the tfind.lsp on page 1 combined with the newfun.lsp on page 3 (substituting your own parameters) you'll obtain the desired results. You can thank forum member Freerefill for the code afterwards. Quote
Fire Alarm Posted December 29, 2009 Author Posted December 29, 2009 Thanks I will give it a try, but not sure on how to combine them. Still pretty green with it comes to LISP's. Quote
ReMark Posted December 29, 2009 Posted December 29, 2009 As I understand it Newfun.lsp is where the user tells AutoCAD, via TFind.lsp, what old text string is being replaced with what new text string. Open Newfun.lsp with any text editor and go to work specifying your changes. Save the file. Load the application (after loading TFind first) then run it. Presto-chango your text has been changed. I tried it out on some text I had made up on the fly and it worked. Heck, if I can do it anyone can! LOL Quote
Fire Alarm Posted December 29, 2009 Author Posted December 29, 2009 Ko, lunch is coming up. Will try it then. Thanks you quantum mechanic. By the way, where is the best place to get a book or an online course for lisp/programming? Quote
ReMark Posted December 29, 2009 Posted December 29, 2009 Hey, you're on the same coast as I am and it's too early for lunch unless you got up at 3:30 a.m. like I did! Re: Lisp programming resources. Do a Search of the forum. I've posted some references and I know that Lee Mac has as well. Mine are all online (links have been included). Lee has mentioned a couple of books as well as provided links to websites such as Jeff Sander's. Quote
Lee Mac Posted December 29, 2009 Posted December 29, 2009 My link library Starting LISP: http://www.cadtutor.net/forum/showthread.php?t=38760 http://www.cadtutor.net/forum/showthread.php?t=38734 http://www.afralisp.net/ http://www.jefferypsanders.com/autolisptut.html http://ronleigh.info/autolisp/index.htm More Advanced LISP Tutorials: http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-4.html http://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/html/cltl/clm/node1.html DCL Tutorials: http://www.jefferypsanders.com/autolisp_DCL.html http://www.afralisp.net/ Visual LISP Editor: http://www.afralisp.net/vl/vlisp.htm http://www.afralisp.net/vl/vl-edit.htm http://midpointcad.com/au/docs/lakose_The_Visual_LISP_Developers_Bible.pdf Quote
ReMark Posted December 29, 2009 Posted December 29, 2009 Who said Lee Mac was on holiday? The guy never sleeps! Thanks Lee. I just went looking for that too. Lee: Did I explain the function of the TFind and Newfun lisp routines correctly? Quote
Fire Alarm Posted December 29, 2009 Author Posted December 29, 2009 Thanks alot ReMark and Lee Mac. Lee Mac what are like a robot or what? Do you ever sleep? I will definitely check these out. I actually thought it was later than it really was for lunch. Besides this is the time that we all start asking each other where we're going. Which usually takes an hour and a half. If I'm not in contact with you all in the next couple days. Have a Great Day and Happy New Years. Quote
Lee Mac Posted December 29, 2009 Posted December 29, 2009 Who said Lee Mac was on holiday? The guy never sleeps! Thanks Lee. I just went looking for that too. Lee: Did I explain the function of the TFind and Newfun lisp routines correctly? Thanks alot ReMark and Lee Mac. Lee Mac what are like a robot or what? Do you ever sleep? I will definitely check these out. I actually thought it was later than it really was for lunch. Besides this is the time that we all start asking each other where we're going. Which usually takes an hour and a half. If I'm not in contact with you all in the next couple days. Have a Great Day and Happy New Years. Haha thanks Guys... but it is only about 5pm over here As for the TFind and Newfun, I'll have to take a look at Freerefill's code Quote
Fire Alarm Posted December 29, 2009 Author Posted December 29, 2009 Ok, only a 4 hour difference. Oh, lunch time. Hooray. Quote
ReMark Posted December 29, 2009 Posted December 29, 2009 Would work with a three digit sequence Lee but would it also work for a two digit sequence as well and at the same time? Quote
Fire Alarm Posted December 29, 2009 Author Posted December 29, 2009 Works perfectly. You need to change your name to Lee Mac Daddy. Cause your awesome. Quote
Fire Alarm Posted December 29, 2009 Author Posted December 29, 2009 You too ReMark. But ReMark Daddy just doesn't have a good ring to it. LOL Quote
ReMark Posted December 29, 2009 Posted December 29, 2009 Thanks. On very rare occassions I've been called ReMarkable! I just crack myself up sometimes. Quote
Lee Mac Posted December 29, 2009 Posted December 29, 2009 Would work with a three digit sequence Lee but would it also work for a two digit sequence as well and at the same time? Well, you could always run it three times with "###" "####" and "##", quicker than the alternative. Works perfectly. You need to change your name to Lee Mac Daddy. Cause your awesome. Haha thanks dude. _____________________________ After looking at Freerefill's code, I must say that it is coded in a very unconventional way (using an imaginary "GoTo" statement), and it could probably be made to run a lot faster. But to be completely honest, I don't see that Freerefill's code has any advantage over the improved FIND command that comes with 2010 - now that you have the additional options, it has much more versatility. As for your explanation Mark, yes, you are correct - tfindfun is a subfunction that requires three arguments (old string, new string and mode flag I believe), these can be entered straight into the command line, example: (tfindfun "old" "new" 1) Or, you can create a new function to call the subfunction, as shown by the newfun function. I might add that the filename.lsp need not be identical to the function syntax of these codes, in case you were unaware. Lee Quote
ReMark Posted December 29, 2009 Posted December 29, 2009 Thanks Lee. Yep, aware of that last statement. I call mine newparam. Bear in mind not everyone will be running 2010 with the new and improved Find command. Quote
Lee Mac Posted December 29, 2009 Posted December 29, 2009 Bear in mind not everyone will be running 2010 with the new and improved Find command. True.. Quote
ReMark Posted December 30, 2009 Posted December 30, 2009 My bad. Seems I neglected to really look at the Find pop-up window. Specifically the lower left-hand corner and the More Options arrow. I'm using 2009 at the moment. Click on the arrow and see exactly what Lee Mac has depicted in the image above. Once I was blind. I guess I still am. Need coffee now. Quote
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.