abzn Posted September 12, 2009 Share Posted September 12, 2009 Yes, I believe, that since it related to proposed solution, it is also related to the original question. Quote Link to comment Share on other sites More sharing options...
Juucejunkie Posted November 27, 2009 Share Posted November 27, 2009 That script by Terry Cadd works great, except for in Multileaders & Tables. Any chane someone can help me out by telling me how to add multileaders and tables into the script? Also does not work with Annotative text, which all my text is - Cheers Quote Link to comment Share on other sites More sharing options...
steves0118 Posted February 11, 2010 Share Posted February 11, 2010 To find and replace text in AutoCAD 2000 I use a LISP routine I found, mfind. I also changed my registry to add a "ASC Submittal" to my right click context menu in Windows Explorer. I just change the submittal.scr file accordingly. You will have to modify the .reg file for your computer, but it should give you enough of an idea on how to do it. I also have a script to batch plot. Since I run multiple versions of AutoCAD on my computer I had to change the registry for all of the versions to use the AutoCAD 2000 program from the right click menu. Also, selecting more than 5 files at a time will sometimes lockup my computer. If you are smart I would love it if you could improve on my idea! mfind.zip Right Click Script.zip Quote Link to comment Share on other sites More sharing options...
gilsoto13 Posted March 19, 2010 Share Posted March 19, 2010 Hi There,Would like some help on a small problem that i have. I am trying to do a batch 'Find and Replace' exercise on a batch of autocad drgs. ie i need a program of some sort that will open a drawing, find a series of text strings and replace them with another series text strings and then save and close the drg. old text string could be say 537:00089 and new text string would be 537D:0032. There could be dozens/hundreds of numbers within a drg. Any ideas? I add this option to this thread... just found it today.. untested by me... but it's published in cadalyst.. so I guess it works. http://www.cadalyst.com/cad/autocad/hot-tip-harry-tips-our-readers-april-2005-5143?print=1 It seems to work for text, mtext and attributes also. and nice dialog box features... I think. Replace Text In Dwgs.DCL Replace Text In Dwgs.LSP Quote Link to comment Share on other sites More sharing options...
steves0118 Posted March 19, 2010 Share Posted March 19, 2010 My method above works well in AutoCAD 2000, not sure of newer versions. It is not easy to setup, so you may want to look into some third party software such as Hurricane for AutoCAD. Quote Link to comment Share on other sites More sharing options...
AQucsaiJr Posted March 19, 2010 Share Posted March 19, 2010 You can find a LISP program Here that will run through multiple drawings and run a find and replace program. The Batch program was designed by Tony Tanzillo and the find and replace function is REPSTRING... With help from LeeMac, I was able to put the two together in that thread and create a batch find and replace lsp. Quote Link to comment Share on other sites More sharing options...
hosyn Posted June 7, 2020 Share Posted June 7, 2020 (edited) On 8/8/2007 at 2:26 AM, Terry Cadd said: Here is a function that I wrote to be used in programs, but it can be run on the command line using the following syntax: (FindReplaceAll "537:00089" "537D:0032") Use it with care, because it does exactly what it's named. Terry Cadd Quote ;------------------------------------------------------------------------------- ; FindReplaceAll - Changes Text, Mtext, Dimensions and Attribute Block entities ; that have a Find$ string with a Replace$ string. ; Arguments: 2 ; Find$ = Phrase string to find ; Replace$ = Phrase to replace it with ; Syntax: (FindReplaceAll "old string" "new string") ; Returns: Updates Text, Mtext, Dimension and Attribute Block entities ;------------------------------------------------------------------------------- (defun FindReplaceAll (Find$ Replace$ / BlkEntList@ BlkEntName^ BlkEntType$ Cnt# DimEntList@ DimEntName^ DimEntType$ EntList@ EntName^ EntType$ FindReplace: Mid$ Mid2$ NewText$ Num# Replace$ SS& Text$) ;----------------------------------------------------------------------------- ; FindReplace: - Returns Str$ with Find$ changed to Replace$ ; Arguments: 3 ; Str$ = Text string ; Find$ = Phrase string to find ; Replace$ = Phrase to replace Find$ with ; Returns: Returns Str$ with Find$ changed to Replace$ ;----------------------------------------------------------------------------- (defun FindReplace: (Str$ Find$ Replace$ / Cnt# FindLen# Loop Mid$ NewStr$ ReplaceLen#) (setq Loop t Cnt# 1 NewStr$ Str$ FindLen# (strlen Find$) ReplaceLen# (strlen Replace$)) (while Loop (setq Mid$ (substr NewStr$ Cnt# FindLen#)) (if (= Mid$ Find$) (setq NewStr$ (strcat (substr NewStr$ 1 (1- Cnt#)) Replace$ (substr NewStr$ (+ Cnt# FindLen#))) Cnt# (+ Cnt# ReplaceLen#) );setq (setq Cnt# (1+ Cnt#)) );if (if (= Mid$ "") (setq Loop nil)) );while NewStr$ );defun FindReplace: ;----------------------------------------------------------------------------- ; Start of Main function ;----------------------------------------------------------------------------- (if (and (= (type Find$) 'STR)(= (type Replace$) 'STR)(/= Find$ "")) (progn (if (setq SS& (ssget "x" (list '(-4 . "<AND")'(-4 . "<OR")'(0 . "TEXT")'(0 . "MTEXT")'(0 . "DIMENSION")'(0 . "INSERT")'(-4 . "OR>")(cons 410 (getvar "CTAB"))'(-4 . "AND>")))) (progn (command "UNDO" "BEGIN") (setq Cnt# 0) (repeat (sslength SS&) (setq EntName^ (ssname SS& Cnt#) EntList@ (entget EntName^) EntType$ (cdr (assoc 0 EntList@)) Text$ (cdr (assoc 1 EntList@)) );setq (if (= EntType$ "INSERT") (if (assoc 66 EntList@) (progn (while (/= (cdr (assoc 0 EntList@)) "SEQEND") (setq EntList@ (entget EntName^)) (if (= (cdr (assoc 0 EntList@)) "ATTRIB") (progn (setq Text$ (cdr (assoc 1 EntList@))) (if (wcmatch Text$ (strcat "*" Find$ "*")) (progn (setq ReplaceWith$ (FindReplace: Text$ Find$ Replace$)) (entmod (subst (cons 1 ReplaceWith$) (assoc 1 EntList@) EntList@)) (entupd EntName^) );progn );if );progn );if (setq EntName^ (entnext EntName^)) );while );progn );if (if (wcmatch Text$ (strcat "*" Find$ "*")) (progn (setq ReplaceWith$ (FindReplace: Text$ Find$ Replace$)) (entmod (subst (cons 1 ReplaceWith$) (assoc 1 EntList@) EntList@)) (entupd EntName^) );progn );if );if (setq Cnt# (1+ Cnt#)) );repeat (command "UNDO" "END") );progn );if );progn );if (princ) );defun FindReplaceAll IF WE WANT RUN THIS FOR SELECTED AREA INSTEAD OF ALL DRAWING, HOW WE CAN MODIFIED IT?? (INDEED THE FIRST DRAG MUSE AND SELECT OBJECTS ) Edited June 7, 2020 by hosyn 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.