Jump to content

Find and Replace mulitple text


Fire Alarm

Recommended Posts

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.

Link to comment
Share on other sites

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • Fire Alarm

    9

  • ReMark

    8

  • Lee Mac

    6

  • daveyboyd

    2

Top Posters In This Topic

Posted Images

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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!:lol:

 

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

My bad.:oops: 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.:lol: Need coffee now.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...